markdown icon indicating copy to clipboard operation
markdown copied to clipboard

Backticks inside inline code blocks

Open philsturgeon opened this issue 10 years ago • 2 comments

This is one of those things that would be made easier with CommonMark compliance, but even without that as a goal seems like a bug to me.

Example

Please remove the `\` from ` \``` `

Babelmark

http://johnmacfarlane.net/babelmark2/?text=Please+remove+the+%60%5C%60+from+%60+%5C%60%60%60+%60%0A

Expected Output

<p>Please remove the <code>\</code> from <code>\```</code></p>

Actual Output

p>Please remove the <code>\</code> from <code> \</code><code>` </code></p>

Just a friendly report. I'm not trying to use cebe/markdown for this, just spotted it in the babelfish output while debugging something else. :)

philsturgeon avatar Mar 11 '15 20:03 philsturgeon

Thanks for reporting, already seen your tweet about it :)

The implementation is correct according to grubers markdown syntax description: https://daringfireball.net/projects/markdown/syntax#code According to that, if you want to include a literal backtick, you have to surround the whole code tag with more than one backtick or in this case the number of sequential backticks + 1:

http://markdown.cebe.cc/try?flavor=default&text=Please+remove+the+%60%60+from+%60%60%60%60+%60%60%60+%60%60%60%60

cebe avatar Mar 12 '15 19:03 cebe

I am considering to add a commonmark compatible class however when I find the time for it.

cebe avatar Mar 12 '15 19:03 cebe