How to write three ticks (`) in post content?


(Jan P.) #1

I want to educate some users on using code fences for posting code.
How can I post three ticks (```) as text without the “after one tick mark text as preformatted”?


(Jeff Atwood) #2

Like this?

```

Four spaces, then three ticks. Check out Markdown Reference for a reference as well!


(Jan P.) #3

Actually directly inside a line of text, so I can post something like

I edited your code to display better. Please use (three ticks) in the line in front and after your code to enable this formatting yourself. Thanks.)

But with the three ticks instead of “(three ticks)” of course.

(Man is it hard to describe this if every try to actually type it gets removed ;))


(Jeff Atwood) #4

It’s very, very tricky to get that right inline. Another way is backslash

```

\`\`\`

(Jan P.) #5

Testing: ```

That works, thanks.


(Jeff Atwood) #6

Good luck with that :wink:


(Jan P.) #7

To make it even more complicated:
Is there a way to preformat the three ticks now in line? So we have this nice grey background to make the command stand out…


(stefan) #8

Try this ```
Using so:
<code>\```
Edit: forgot to close tag :sweat_smile:


(Jan P.) #9

Fancy².

Let’s see if this works to output the three ``` (```) needed to format code. Yes it does. Didn’t know about <code> before. Thanks!

PS: Uh, did I just discover a “bug” in the quote engine? Backslashes are gone…


(stefan) #10

Back slash where?
Inside your bracket?


(Jan P.) #11

I quoted your <code>\``` in my response. There it shows without the backslashes.
Super edge case of course, but [quote] seems to miss the \ on output.


(stefan) #12

Oh… that might be a separate bug but we can ask @codinghorror
Maybe raise a new bug topic.
But it seems your use case is covered for now :smile:
Cheers


(Jan P.) #13

Done: [quote] loses backslashes on this super edge case

And yes, I’m happy with my solution. Thanks!


(stefan) #14

just an FYI :smile:

you can click the chain icons > new topic to create a topic out of a post.


(Jan P.) #15

What kind of sorcercy…

Awesome. Thanks.