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

footnote in triple tick not being escaped #172

Open
lrstanley opened this issue Dec 14, 2014 · 2 comments
Open

footnote in triple tick not being escaped #172

lrstanley opened this issue Dec 14, 2014 · 2 comments

Comments

@lrstanley
Copy link

I'm in the process of making an API using this utility, and I'm running into issues generating help for the footnote extra. It looks like when you have the footnote extra added, adding

This is a paragraph with a footnote. 1

inside ```'s, it's executing itself as a footnote, rather than escaping and showing the pre tags or whatever.

tl;dr: footnotes should be escaped when using triple ticks.

Footnotes

  1. This is the text of the note.

@lrstanley
Copy link
Author

Taking a look further, it looks like something isn't parsed right, because the top one doesn't work, and the bottom one does:

https://paste.ml/husu

@devvyn
Copy link
Contributor

devvyn commented Dec 15, 2014

I believe I can confirm an issue, but there are some conditions that affect it. (tl,dr: something is wrong with the example but also wrong with the code, and I share my findings but want someone to tell me if I'm overlooking anything. I might have time to contribute a PR.)

with fenced-code-blocks on

Fenced code blocks which are indented sufficiently ("tab width") are treated as code because they are indented (including fences), not because of the triple backticks (which become quoted content).

In your paste example, the first block is indented 2 spaces, which by default is less than the "tab width" number of spaces (4), so the indentation is not considered to be significant and therefore normal paragraphs are formed. This might be considered normal.

However, the same block, when indented by 4 spaces, becomes a code block due to indentation and the backticks are treated as part of the quoted matter. See example gist for 2-space and 4-space comparison.

https://gist.github.com/devvynm/4ff8b3e0dc9bad60ca4b#file-python-markdown-extras-issue-demo-py

indented interior of fenced block vs everything flush left

I also tested indenting the contents of the fenced code block without indenting the backtick fences, and found that made a difference: if interior lines are indented, contents are not parsed; if flush with line start, footnotes are parsed even though the fences still triggered the code and pre tags to be rendered (probably not expected).

fenced-code-blocks off

The bottom of the output from running the above gist also shows the footnote not getting parsed from a properly indented code block (4 spaces, the default tab width) when the fenced-code-blocks extra is disabled. However, without researching more I'm not sure whether indented blocks (whether being wrapped in <code></code> or not) should allow footnote parsing, or if that sort of quoting power should be limited to explicitly fenced code blocks. Regardless, I do expect footnotes to be quoted, not parsed, inside fenced code blocks, for the obvious reason of quoting Markdown source.

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

No branches or pull requests

2 participants