Markup: Backticks are not escaped with the escape character (`\`)

Created on 13 Sep 2014  路  13Comments  路  Source: github/markup

I believe the following code:

`\``

should render:

<p><code>`</code></p>

as specified in the markdown syntax reference

A "kinda workaround" is to use &#96; in place of the backtick (`) character; however this doesn't work inside of backticks: &#96;

Interestingly enough, the github basics of markdown documentation itself _does_ have backticks inside of a code block.

Also interesting is almost no processor seems to get this right.

Is 9:30AM to early to start drinking?

Most helpful comment

Never mind; it appears the proper syntax for inserting backticks inside of codeblocks is to use more backticks: `

All 13 comments

Never mind; it appears the proper syntax for inserting backticks inside of codeblocks is to use more backticks: `

Here are more examples:

  • CTRL+` gives: `CTRL+``
  • `` CTRL+` `` gives: CTRL+`

Just keep using more and more contiguous leading (and hence trailing) backticks with spaces inside them, per the pattern above, to go as crazy as you like :) For example:

`Oh you want FIVE backticks? ````` You'll need SIX to lead/trail, then :)`
...becomes...

Oh you want FIVE backticks? ````` You'll need SIX to lead/trail, then :)

<p>test<p>

ive found that in triple-backtick code blocks, following any backticks with zero-width spaces allows any number of backticks in a row without breaking out of the code block

@pyzae I just want to mention that everyone who copy-pastes these zero-width spaces can have a hard time depending on his context... We should not release them into the wild.

@matthiasstock what do you mean a hard time depending on his context?
do you mean people copy-pasting out of the code blocks not realizing there are invisible characters there?

@pyzae Yes, I just wanted to point out to later readers that there can be problems with these zero-width spaces in code examples. A code interpreter (in my context) generated a hard to understand error message.

I'm very confused by the examples in https://github.com/github/markup/issues/363#issuecomment-200097074, did something change?

It seems that this only works with blocks of code starting on a new line, not inline code blocks.

I wrote the following commit message:

    Remove unnecessary wrapping

    Made the classic error when testing of assuming that this: ``-1 `mod` 3``

    parses as this: ``(-1) `mod` 3``

    when it actually parses as this: ``-(1 `mod` 3)`

But the way this is rendered in Github is kind of wonky:

image

Am I misunderstanding the Markdown specification?

EDIT: Just noticed I have a typo on the last line (I'm missing a closing backtick), but this doesn't seem to work on the other lines either.

Seems to work fine here in the comments? See: -1 `mod` 3

Seems to work fine here in the comments? See: -1 `mod` 3

That does not work if the inner backticks are at the start/end of the inline code: `killpgrep -f rspec```

@magni- you can try:

`` `the-text-between-backtick` ``

You need to basically have a double backtick with a space (before and after). So in your case if you put a space after the first backtick at the end, it will work, ex: kill `pgrep -f rspec`

Was this page helpful?
0 / 5 - 0 ratings