Zulip Chat Archive

Stream: Zulip meta

Topic: escaping backtics in one-line code block


Edward van de Meent (Apr 04 2025 at 09:59):

it has occurred on multiple occasions that i'd like to have a backtick ` in a code block. However, getting a single backtick to display correctly in a code block seems nigh impossible, as there seems to be no way to "escape" it... in particular, the automatic insertion of backticks by selecting the text and pressing the "Code" button in the interface does commonly not display as intended...

Edward van de Meent (Apr 04 2025 at 10:00):

in particular, it looks like we can use backslash to escape backtics but the backslash is displayed?

Edward van de Meent (Apr 04 2025 at 10:00):

\` example `

Edward van de Meent (Apr 04 2025 at 10:00):

example

Edward van de Meent (Apr 04 2025 at 10:01):

more \ example ` <- seems to render bad?

Edward van de Meent (Apr 04 2025 at 10:01):

``` <- does not render as a single backtick in a code block

Edward van de Meent (Apr 04 2025 at 10:02):

`\`` <- also does not render as a single backtick in a code block

Eric Wieser (Apr 04 2025 at 10:05):

`

Edward van de Meent (Apr 04 2025 at 10:05):

note that you are forced to have spaces somewhere around the backtick to have the backtick in the codeblock

Kevin Buzzard (Apr 04 2025 at 11:06):

yeah I always feel a bit funny telling people "start your code with a line like this: ``` " whereas I actually mean "...with a line like this but without the spaces"

Julian Berman (Apr 04 2025 at 11:12):

Isn't this behavior just "normal" for markdown?

Julian Berman (Apr 04 2025 at 11:14):

Ah sorry I misread, the point is specifically that there's no way to render it without the spaces, and that's not normal, I understand now -- and <code>`</code> doesn't work either for that given no markdown HTML tag rendering.


Last updated: May 02 2025 at 03:31 UTC