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>
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.
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.
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.
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> ```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With