Skip to content

Instantly share code, notes, and snippets.

@dmitrykolesnikovich
Forked from takiyu/README.html
Created January 20, 2023 03:34
Show Gist options
  • Save dmitrykolesnikovich/0cf48a09c444dda2ab724b3c13e53eb7 to your computer and use it in GitHub Desktop.
Save dmitrykolesnikovich/0cf48a09c444dda2ab724b3c13e53eb7 to your computer and use it in GitHub Desktop.
HTML file to visualize README.md
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title></title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<style type="text/css">
body {
margin: 0px;
padding: 0px;
text-align: center;
}
#display_content {
margin-left: auto;
margin-right: auto;
text-align: left;
width: 720px;
}
</style>
<script>
$(function(){
// Load `README.md` and show
$("#included_content").load("README.md", function(data) {
marked.setOptions({
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: true,
smartLists: true,
smartypants: false,
langPrefix: '',
highlight: function(code, lang) {
return code;
}
});
var html_str = marked(data);
$("#display_content").html(html_str);
// Apply highlight.js again
hljs.initHighlighting.called = false;
hljs.initHighlighting();
});
});
</script>
</head>
<body>
<div id="included_content" style="display:none"></div>
<div id="display_content"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment