Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backticks are not escaped with the escape character (`\`) #363

Closed
zspencer opened this issue Sep 13, 2014 · 12 comments
Closed

Backticks are not escaped with the escape character (`\`) #363

zspencer opened this issue Sep 13, 2014 · 12 comments

Comments

@zspencer
Copy link

@zspencer zspencer commented Sep 13, 2014

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?

@zspencer
Copy link
Author

@zspencer zspencer commented Sep 13, 2014

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

@zspencer zspencer closed this Sep 13, 2014
@amm-catapult
Copy link

@amm-catapult amm-catapult commented Mar 23, 2016

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 :)

cheapsteak added a commit to cheapsteak/babel-plugin-import that referenced this issue Apr 24, 2018
The backticks were triggering the end of the code block. Needed to add more backticks :)
Reference: github/markup#363
@psharma9145
Copy link

@psharma9145 psharma9145 commented Aug 24, 2018

<p>test<p>
@pyzae
Copy link

@pyzae pyzae commented Dec 30, 2018

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

@matthiasstock
Copy link

@matthiasstock matthiasstock commented Mar 11, 2019

@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.

@pyzae
Copy link

@pyzae pyzae commented Mar 12, 2019

@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?

@matthiasstock
Copy link

@matthiasstock matthiasstock commented Mar 12, 2019

@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.

@fireattack
Copy link

@fireattack fireattack commented May 11, 2019

I'm very confused by the examples in #363 (comment), did something change?

@mbrowne
Copy link

@mbrowne mbrowne commented Sep 19, 2019

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

@masaeedu
Copy link

@masaeedu masaeedu commented Feb 18, 2020

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.

@fireattack
Copy link

@fireattack fireattack commented Feb 18, 2020

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

arantius added a commit to arantius/kernel-wasm that referenced this issue Feb 28, 2020
To escape backticks-in-backticks, switch the outer/container backticks to double-backticks.  (See: github/markup#363 (comment) .)
@Cliabhach Cliabhach mentioned this issue Mar 24, 2020
1 of 4 tasks complete
laughinghan added a commit to laughinghan/mechanical that referenced this issue Apr 8, 2020
github/markup#363 (comment)

Also, fix code block that shouldn't have been dedented
@magni-
Copy link

@magni- magni- commented May 8, 2020

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: ``kill `pgrep -f rspec```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.