How does one escape backticks in markdown?

后端 未结 3 478
天涯浪人
天涯浪人 2020-12-29 02:54

I am writing some documentation in markdown and I want to document how to create a text file using a bash HEREDOC. Here is the command I want to document:

3条回答
  •  失恋的感觉
    2020-12-29 03:27

    The original Markdown syntax documentation covers this; it says that you have to use multiple backticks to bracket the code expression, so like this:

    ``here you go - ` this was a backtick``
    

    renders like this:

    here you go - ` this was a backtick

    If you want to include a backtick in normal text, not in a code block, a backslash escape does the trick; for example this:

    Here's a backtick: \`; then, here's another one: \`
    

    renders like this:

    Here's a backtick: `; then, here's another one: `

    (I tested this on commonmark and github and it behaves the same so it's not just a SO oddity)

提交回复
热议问题