Page MenuHomePhorge

Support backticks in inline and block code by wrapping with multiple backticks
Open, Needs TriagePublic


It is currently impossible (AFAIK) to mark up an inline code element that contains a backtick while using backticks as delimiters. Escaping the middle backtick doesn't work: foo\bar`. It's also not possible to use three backticks inside code blocks, since they conflict with the wrappers of the code blocks themselves.

Note: the first issue can be bypassed by using the other code formatting delimiter, #:

Lorem ##foo`bar## ipsum

results in "Lorem foo`bar ipsum". But that is clunky, does not fix the issue in code blocks, and relies on using two characters simultaneously for the same effect.

Markdown (well, CommonMark) also has this limitation, but works around it by allowing multiple backticks to be used in code spans and blocks: two backticks at the edges to allow a single backtick inside; three to allow double backticks inside; and so on. The same is true for code blocks: if three backticks are needed inside, then the whole block is wrapped with four backticks, and so on.

So the request here is to implement support for code spans wrapped with double backticks or more, and code blocks wrapped with four backticks or more.

One small benefit of this change is that one could then use two characters for code blocks (even if they don't contain backticks) so as to make the syntax more consistent with the other delimiters that also use doubled characters.