Less than 200 lines of CSS replicate the GitHub Markdown style. A fork from sindresorhus/github-markdown-css, shortened so that the CSS file is smaller but still supports the same features (shortened from 1087 lines to 187 lines). Useful for people who want faster CSS rendering speed.
Download the github.css file and add a markdown-body
class to the container of the rendered Markdown.
For example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
<link rel="stylesheet" href="github.css">
</head>
<body>
<div class="markdown-body">
Rendered Markdown here.
</div>
</body>
</html>
- Include highlight.js before the CSS file if Syntax Highlighting is needed.
- Inline code should be in
<code>
tags when converted to HTML. - Code blocks should be in
<pre><code>
tags when converted to HTML.