Closed zspencer closed 10 years ago
Never mind; it appears the proper syntax for inserting backticks inside of codeblocks is to use more backticks: `
Edit with example: ``console.log(`Now this is ${excitingAdventureWhichIsLegallyDistinctButNotDissimilarToPodracing}`) ``
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:
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: `kill
pgrep -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`
Do you have to have spaces on both ends to avoid a space?
`git grep ">pre(@"
git rev-list --all```git grep ">pre(@" `git rev-list --all`
git grep ">pre(@" `git rev-list --all`
Huh... That's really strange. No trailing ending space in case 2, but the same markdown in a comment on an issue in our (private) repo shows a trailing space inside the in-line code. Why would that be? Let me try the whole sentence:
According to git grep ">pre(@" `git rev-list --all`
, that line in joblog.pl is the only call of pre with an array argument in the entire history of the repo. And the blame claims it has been that way since laurie's initial checkin 17 months ago.
Yep. Why the differing behaviors? Is it because the line ends with git grep ">pre(@" `git rev-list --all`
hmmm...
Perhaps.
It seems that this only works with blocks of code starting on a new line, not inline code blocks.
I confirm that with inline code blocks none of the examples above works unless the backticks are in the middle of the sentence and not at the boundaries.
EDIT: Per the next comment, it is documented.
Since three backticks has special meaning to Github, the following needs to be made clear in Github's documentation: If you need to show three backticks in your code block, then surround the code block with four-backtick delimiters.
Since three backticks has special meaning to Github, the following needs to be made clear in Github's documentation: If you need to show three backticks in your code block, then surround the code block with four-backtick delimiters.
I guess they do so: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#fenced-code-blocks
How might I do render: "<CR>
where the "
is a backtick?
Ok I got it, phew. Just use a <code>
block.. though I still have to escape the <CR>
, heh.
<code>`\<CR\></code>
Ala.. `\<CR>
I think this should update to the documentation: Basic writing and formatting syntax, the documentation seems didn't mention this.
Come on, this is such a simple thing.
There's still issues with having a single backtick in a fenced codeblock. And no amount multiple backticks seem to fix this.
I wanted a single backtick within an inline code block. This post helped me figure it out.
`` ` ``
gives `
I believe the following code:
should render:
as specified in the markdown syntax reference
A "kinda workaround" is to use
`
in place of the backtick (`) character; however this doesn't work inside of backticks:`
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?