Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML code into README.md on Github

I tried to put some HTML snippets into my README.md on Github but the HTML codes are parsed.

How do I do it?

<h2>Example of code</h2>  <pre>     <div class="container">         <div class="block two first">             <h2>Your title</h2>             <div class="wrap">                 //Your content             </div>         </div>     </div> </pre> 
like image 630
tonymx227 Avatar asked May 03 '13 02:05

tonymx227


People also ask

Can I use HTML in readme MD?

Wherever HTML is rendered on GitHub (gists, README files in repos, comments on issues and pull requests, ...) you can use any of the HTML elements that GitHub Flavored Markdown (GFM) provides syntactic sugar for.

Can you use HTML in .md file?

Not only is it okay to do, but it is encouraged. As the rules state: For any markup that is not covered by Markdown's syntax, you simply use HTML itself. There's no need to preface it or delimit it to indicate that you're switching from Markdown to HTML; you just use the tags.

Can you put HTML in Markdown?

Span-level HTML tags — e.g. <span> , <cite> , or <del> — can be used anywhere in a Markdown paragraph, list item, or header. If you want, you can even use HTML tags instead of Markdown formatting; e.g. if you'd prefer to use HTML <a> or <img> tags instead of Markdown's link or image syntax, go right ahead.


1 Answers

Try putting your HTML snippet inside an ```HTML block like this:

```html <h2>Example of code</h2>  <pre>     <div class="container">         <div class="block two first">             <h2>Your title</h2>             <div class="wrap">             //Your content             </div>         </div>     </div> </pre> ``` 
like image 108
Ivan Zuzak Avatar answered Sep 19 '22 15:09

Ivan Zuzak