bhollis / maruku

A pure-Ruby Markdown-superset interpreter (Official Repo).
MIT License
502 stars 80 forks source link

Footnote formatting #18

Closed andrewheiss closed 14 years ago

andrewheiss commented 14 years ago

Both Gruber's implementation of footnotes and MultiMarkdown/Markdown Extra put the Unicode return character on the same line as the footnote:

* footnotes [^foot]

[^foot]: I really was missing those.

would create:

<ol>
    <li>
        <p>I really was missing those. <a href="footnote stuff">↩</a></p>
    </li>
</ol>

Maruku puts the return character outside of the <p>, thus pushing it on a different line:

<ol>
    <li>
        <p>I really was missing those.</p><a href="footnote stuff">↩</a>
    </li>
</ol>

I forked Maruku to attempt to fix it, but it seems to automatically put <p> tags on the footnotes before REXML can take over in render_footnotes() in lib/output/to_html.rb, and it seems impossible to insert the return <a> inside the footnote <p>.

Is there any way to make the footnote return link appear within the footnote paragraph element itself á la Gruber?

bentomas commented 14 years ago

I fixed this in a local fork of Maruku. I changed the render_footnotes in lib/maruku/output/to_html.rb to look like this: http://gist.github.com/500015

Basically what my change does is find the last HTML node in the footnote, and then if it is a <p> render the footnote inside of it. Otherwise (like if it was a blockquote or a list or something) I render it exactly like Maruku does it.

I hope that's helpful!

andrewheiss commented 14 years ago

Brilliant! That did it! Thanks!

See http://github.com/andrewheiss/maruku/commit/8902c316d451f4c90284a1fa6e08b57166123b58

etc commented 13 years ago

This glitch still arises in Nesta, which depends on Maruku 0.6.0. Any idea whether this is a Nesta problem or a Maruku problem?

etc commented 13 years ago

Sorry, I'm new at all this—just realised that this change was made in your fork of Maruku, and not in the main Maruku repo.