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` results in the second backtick closing the code span, i.e. the backslash+backtick sequence doesn't escape the backtick at all:
Using multiple backticks for an inline code span is not supported either — doing ``foo`bar`` results in:
It's also not possible to use three backticks inside code blocks, since they conflict with the wrappers of the code blocks themselves Actually, this seems to work as long as the inner triple-backticks don't appear by themselves in a single line:
foo```bar
Note: the first issue can be bypassed by using the other code formatting delimiter, # — in particular, doing
Lorem ##foo`bar## ipsum
...results in:
(Using # characters is how I wrote the source for the examples above). But that is clunky and hard to figure out. It also doesn't work for triple backticks within code blocks, since the latter can't be created with ### as delimiters.
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 surrounding a code span to allow a single backtick inside it; three around to allow double backticks inside; and so on. The same is true for code blocks: if three backticks are needed inside (even if standing on a line by themselves), then the whole block can be wrapped with four backticks, and so on.
In summary: 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 it would become possible to use two characters for code blocks even if they don't contain backticks, which would make the syntax more consistent with the other delimiters that also use doubled characters.)