Get started with markdown.js CDN

MIT licensed

Markdown.js is a lightweight library for converting Markdown text into HTML.

Tags:
  • markdown
  • markdown-js
  • text processing
  • ast

Stable version

Copied!

How to start using markdown.js CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with markdown.js CDN - cdnhub.io</title>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/markdown-it.min.js"></script>
    <script src="https://cdn.cdnhub.io/markdown.js/0.5.0/markdown.min.js"></script>
    <style>
        pre code {
            background: transparent;
            border: none;
            padding: 0;
            margin: 0;
        }
    </style>
</head>
<body>
    <div id="container"></div>
    <script>
        const markdownIt = require('markdown-it')();
        const container = document.getElementById('container');

        const markdownText = `
# Heading 1
## Heading 2
### Heading 3

**Bold text**

`;

        const renderedMarkdown = markdownIt.render(markdownText);
        container.innerHTML = renderedMarkdown;
    </script>
</body>
</html>
Copied!

All versions