Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown writer renders footnotes in figure captions under the figure #5123

Open
cprecioso opened this issue Dec 4, 2018 · 2 comments
Open

Comments

@cprecioso
Copy link

When implicit_figures is enabled and you're rendering to -t markdown_strict or -t markdown_mmd, if the figure caption has a footnote, it gets rendered under the figure itself and not with the rest of the footnotes at the end of the document.

Repro in pandoc 2.5

Posted in a new issue from #5121 as per #5121 (comment)

@cprecioso
Copy link
Author

I did a bit of research. As I see it, there can be two possible kind of outputs. I'll be comparing them on Babelmark to see which markdown renderers handle them correctly. For reference, I can see that only pandoc (not in strict mode), PHP Markdown Extra, Maruku, MultiMarkdown, kramdown and mistune handle footnotes at all.

Option A: (only pandoc and MultiMarkdown 6 handle it correctly, and mistune does not support the embedded figure HTML at all - it's escaped)

Paragraph 1

<figure>
<img src="./my-figure.jpg" alt="My caption " width="50" /><figcaption>

My caption[^1]

</figcaption>
</figure>

Paragraph 2[^2]

[^1]: footnote in the caption

[^2]: footnote in a paragraph

Option B: (only pandoc handles it - also tried with some variations with newlines in case it made a difference (1, 2))

Paragraph 1

<figure>
<img src="./my-figure.jpg" alt="My caption " width="50" />
<figcaption>My caption[^1]</figcaption>
</figure>

Paragraph 2[^2]

[^1]: footnote in the caption

[^2]: footnote in a paragraph

@cprecioso
Copy link
Author

I think the current approach is just ok for most markdown variants except two.

Maybe in -t markdown_mmd, the writer could output Option A, as MultiMarkdown handles that just fine.

And in -t markdown_strict, which is not expected to handle footnotes, the output should be in tune with the rest of the footnotes, like:

Paragraph 1

<figure>
<img src="./my-figure.jpg" alt="My caption " width="50" /><figcaption>My caption [1]</figcaption>
</figure>

Paragraph 2 [2]

[1] footnote in the caption

[2] footnote in a paragraph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants