How do you display a section of plain text in gith

2019-03-22 22:01发布

问题:

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 user@example.com. 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?

回答1:

You can wrap such text in pre tags.

<pre>Text I want left alone@donotlink.me</pre>

I just tested this out on github.



回答2:

Wrap the block in backticks:

```text
code();
address@domain.com
```


回答3:

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

So this will work also:

~~~text
code();
address@domain.com  
~~~