Last active
April 30, 2018 06:41
-
-
Save danmaq/19ad153a57b7fbc0742592cbd1da6491 to your computer and use it in GitHub Desktop.
If you embed Markdown, you can preview on browser only this HTML. Using: chjj/marked
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0" /> | |
<title>Markdown preview</title> | |
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.8.0/github-markdown.min.css" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js" integrity="sha384-aP8BvMiS2buEdB040zV1ZNg4Yz3vzmY0biq0UhB05amexdPMAx3uPjIvFWKa7Jnz" crossorigin="anonymous"></script> | |
<script type="text/template" id="source"> | |
# Hello, world | |
* mark | |
* down | |
* example | |
1. foo | |
2. bar | |
1. qux | |
</script> | |
<script> | |
const mark = | |
function () | |
{ | |
document.getElementById('body').innerHTML = | |
marked(document.getElementById('source').innerHTML); | |
}; | |
window.addEventListener('load', mark); | |
</script> | |
</head> | |
<body> | |
<div id="body" class="markdown-body"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment