51

I'm having a hard time finding any real answer to this (really simple?) question on Google, and I'm starting to worry that there is no solution.

I am learning GitHub markdown. I would like to show some example code that contains fake email address like [email protected]. But GitHub insists on auto-linking this text. I also have a large chunk of text that has many special characters.

Is there a way to escape blocks or sections so that no special characters are processed, and no auto-links are generated?

3 Answers 3

104

Wrap the block in backticks:

```text
code();
[email protected]
```
Sign up to request clarification or add additional context in comments.

4 Comments

That sometimes triggers syntax highlighting though. You can (probably, I haven't checked) fix that by adding the word "text" right after the opening three backticks at the start of the code fence: ```text
This works in github formatted comments, such as issue reports. Also interesting to note that this works in Discord. You can specify syntax highlighting by including a language name on the same line as the first triple back ticks. For example, ```js will block the encapsulated text and highlight Javascript syntax.
@danday74 at the time, the accepted answer was the only answer available. I do not want to take the green check mark away from a correct answer that came first, however I gave an upvote to this. Hopefully, users will have the habit of seeking more than just the first answer on the page.
for single line text you can also use single backticks like `[email protected]`
33

You can wrap such text in pre tags.

<pre>Text I want left [email protected]</pre>

I just tested this out on github.

1 Comment

I tried this but it actually messed with some of the formatting on github. The ```text answer is safer.
9

This is all part of the kramdown syntax. The last link shows every GitHub markdown trick.

So this will work also:

~~~text
code();
[email protected]
~~~

1 Comment

This is actually what helps the most if you want to show how to use markdown itself. Unlike the backticks or XML/HTML like <pre> . . . </pre> this seems to allow truly verbatim text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.