Convert Markdown to clean HTML. Runs entirely in your browser.
$1β);
// Headings
html = html.replace(/^######\s+(.+)$/gm, β$1
β); html = html.replace(/^#####\s+(.+)$/gm, β$1
β); html = html.replace(/^####\s+(.+)$/gm, β$1
β); html = html.replace(/^###\s+(.+)$/gm, β$1
β); html = html.replace(/^##\s+(.+)$/gm, β$1
β); html = html.replace(/^#\s+(.+)$/gm, β$1
β); // Bold and italic html = html.replace(/***(.+?)***/g, β$1β); html = html.replace(/**(.+?)**/g, β$1β); html = html.replace(/*(.+?)*/g, β$1β); // Images html = html.replace(/![([^]])](([^)]+))/g, '$1β); // Horizontal rules html = html.replace(/^---$/gm, '
'); // Unordered lists html = html.replace(/^[-*]\s+(.+)$/gm, β
- $1
$1
β); // Clean up empty paragraphs html = html.replace(/\s*</p>/g, β); return html.trim(); } function convertMd() { var md = document.getElementById(βmd-inputβ).value; var html = mdToHtml(md); document.getElementById(βmd-htmlβ).value = html; document.getElementById(βmd-previewβ).innerHTML = html; } function togglePreview() { document.getElementById(βmd-preview-wrapβ).style.display = document.getElementById(βmd-show-previewβ).checked ? βblockβ : βnoneβ; } function copyMdHtml(btn) { navigator.clipboard.writeText(document.getElementById(βmd-htmlβ).value); btn.textContent = βCopied!β; setTimeout(function() { btn.textContent = βCopy HTMLβ; }, 1500); } document.getElementById(βmd-inputβ).addEventListener(βinputβ, convertMd);
Supported Syntax
- Headings (
# H1through###### H6) - Bold (
**text**) and italic (*text*) - Links (
[text](url)) and images () - Code blocks (triple backticks) and inline code
- Unordered and ordered lists
- Blockquotes (
> text) - Horizontal rules (
---)
For a full reference, see the Markdown Cheat Sheet.
Related: Best Hosting for AI Projects