GitHub README to HTML

How to use md2html.js in your project

md2html.js is a simple JavaScript module that fetches a Markdown file from a URL and converts it to HTML using marked.js.
Here is a basic usage example:

<!-- Import marked.js and md2html.js in your HTML -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="md2html.js"></script>

<!-- Use md2html to convert a Markdown file to HTML -->
const url = "https://raw.githubusercontent.com/user/repo/refs/heads/branch/README.md";
md2html(url).then(html => {
    document.getElementById('output').innerHTML = html;
});

Just provide the raw GitHub URL to any Markdown file. The HTML will be rendered in the element you choose.
See the form below for a live demo.

URL must contain /refs/heads/ (e.g. https://raw.githubusercontent.com/user/repo/refs/heads/branch/README.md)

Preview