As mentioned in #400, #819, #861, and others, Markdown does not allow formatting inside code blocks (backticks). So makeHtml by design escapes any character inside it to its corresponding entity where required. However, HTML allows formatting inside code blocks (e.g., <code><em>ab</em> cd</code> would make ab italic inside the code block). The problem is that makeMarkdown just blindly converts this <code> block to backticks, even though the result is not equivalent.
I believe the correct behaviour for <code> in makeMarkdown should be to retain the <code> tag whenever there is formatting inside. Converting code to backtick in this case does not generate equivalent Markdown code. So <code>abc<code> would convert to `abc`, but <code><em>ab</em> cd</code> would remain unchanged, maybe change to <code>*ab* cd</code>.
A similar issue is with entities inside code blocks. <code><</code> in makeMarkdown should not be converted to `<`, as converting that back to HTML would have a result of <code>&lt;</code> instead.
As mentioned in #400, #819, #861, and others, Markdown does not allow formatting inside code blocks (backticks). So
makeHtml
by design escapes any character inside it to its corresponding entity where required. However, HTML allows formatting inside code blocks (e.g.,<code><em>ab</em> cd</code>
would makeab
italic inside the code block). The problem is thatmakeMarkdown
just blindly converts this<code>
block to backticks, even though the result is not equivalent.I believe the correct behaviour for
<code>
in makeMarkdown should be to retain the<code>
tag whenever there is formatting inside. Converting code to backtick in this case does not generate equivalent Markdown code. So<code>abc<code>
would convert to`abc`
, but<code><em>ab</em> cd</code>
would remain unchanged, maybe change to<code>*ab* cd</code>
.A similar issue is with entities inside code blocks.
<code><</code>
inmakeMarkdown
should not be converted to`<`
, as converting that back to HTML would have a result of<code>&lt;</code>
instead.