Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I type html in a markdown file without it rendering?

Tags:

html

markdown

I want to type the following sentence in a markdown file: she says <h1> is large. I can do it in StackOverflow with three backticks around h1, but this doesn't work for a .md file. I've also tried a single backtick, single quote, double quote, hashtags, spacing, <code>h1</code> and everything else I could think of. Is there a way to do this?

like image 794
jss367 Avatar asked Jan 17 '17 19:01

jss367


Video Answer


1 Answers

You can escape the < characters by replacing them with &lt;, which is the HTML escape sequence for <. You're sentence would then be:

she says &lt;h1> is large

As a side note, the original Markdown "spec" has the following to say:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single < and & in your example code needs to be escaped.)

...which means that, if you're still getting tags when putting them in backticks, whatever renderer you're using isn't "compliant" (to the extent that one can be compliant with that document), and you might want to file a bug.

like image 145
Haldean Brown Avatar answered Oct 06 '22 23:10

Haldean Brown