minad / olelo

Wiki with git backend
MIT License
241 stars 44 forks source link

markdown: Header Interpretation breaks after editsection #54

Closed alexwall closed 13 years ago

alexwall commented 13 years ago

Markdown (kramdown) needs a newline or nothing (e.g. beginning of document) before a header (h1 #). When you click on "edit" to edit a section above another, all newlines at the end of the current section will be removed. After saving this section the header among them won't be interpreted as header.

Example:

# Upper Header

some text ....

# Second Header 

other text ....

after editing (or just load and save) the section "Upper Header" the result will be

# Upper Header

changed text ....
# Second Header 

other text ....

In my opinion the problem is in editsection.rb in line ~38 l = pos[i+1] ? pos[i+1][1] - pos[i][1] - 1 : len - pos[i][1]

I don't understand why the position is substracted by 1

minad commented 13 years ago

I don't understand that either. I think it was a hack to avoid problems with newlines of the next section. This should be fixed in the new version of the editsection filter. Please give it a try.

alexwall commented 13 years ago

It seams to work fine. thx