Backtick (`) cannot be escaped in inline code span/block

i type


i expect to see:


instead, it looks like this: foo\bar`

i don’t know about the markdown specification, but i’m pretty confident that there should be a way to have single backticks in an inline code span? and the expected way does not work.

Please complete the bug report template when submitting bug reports. Thanks.

Could this work for now?


Moved to help. From a quick search, I think this is expected behaviour.

Additional info: How do I escape a backtick ` within in-line code in Markdown? - Meta Stack Exchange

1 Like

You can also escape codeblocks:


Results in:

1 Like

Although in the original DaringFireball syntax linked from the page you linked, it specifically states that the backslash escaping should work:

1 Like

Where? Can you point it out? I only see an agreement:

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:

As the “literal character would otherwise have special meaning” (close the inline code block), sounds to me like it should escape it.

Currently, escaping backticks with \ only works in js scripts, not in Obsidian markdown.

But not in a code block. I quoted the part that said that.

Yes escaping a backtick works fine in Obsidian Markdown, but not in a code block.


The part you quoted says that you can use double backticks. It does not say you can’t escape them, unless I missed that.

“Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax” sounds pretty clear and straightforward.

What I meant is markdown’s code block with single backtick. E.g.:
I cannot write


unless I use 4 backtick-ed blocks as well.

  • Notice the backtick after the single quote in regex.

While this topic may never cross my path, that daringfireball site is an awesome markdown reference. Cheers!

yes, thank you, for some reason i completely missed the possibility of inline code blocks being able to be quoted by multiple backticks. this works for most cases, however, i’m not sure how i could write a single backtick in a code block, without padding spaces or anything?

for context, this was my (other) original usecase; i’m drafting a description of a programming language, and i want to write down a single backtick in a single-character code block, because i use that every time i refer to a symbol of my programming language’s syntax

(i’m very stupid and i accidentally deleted the above post)

i forgot to mention, i read the stackexchange answer linked above, and from what i understand, `` ` `` should produce a single backtick. but it seems like obsidian does not strip the spaces around it SPECIFICALLY in live preview mode.

in reading mode, it produces a single backtick with no surrounding spaces, in source mode, it shows all 5 backticks. but in live preview mode, it does not strip the surrounding spaces.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.