Create a Markdown document and put the following code at the end of the file. Save the document with the .html
extension, and a double-click will open it in the browser and show the content as rendered HTML. This is super-useful for simple documents where you want to keep just one Markdown file, but you want to “self-render”.
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.0.2/marked.min.js"></script><script>h=document.head,h.innerHTML+='<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.1.0/github-markdown-light.min.css"/>',b=document.body,b.innerHTML=marked.parse(b.innerHTML,{breaks:!0,gfm:!0,headerIds:!0,smartLists:!0,smartypants:!0}),hljs.highlightAll(),b.classList.add("markdown-body"),b.style.maxWidth="640",b.style.margin="auto",b.style.padding="2rem";</script>
To also use syntax highlighting, use this: