Simple Markdown to HTML conversion
</> WebConvert Markdown to HTML
$ echo "# Hello
This is **bold** and *italic*.
- Item one
- Item t..." | md-to-html (input) => {
return input
.replace(/^### (.+)$/gm, "<h3>$1</h3>")
.replace(/^## (.+)$/gm, "<h2>$1</h2>")
.replace(/^# (.+)$/gm, "<h1>$1</h1>")
.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>")
.replace(/\*(.+?)\*/g, "<em>$1</em>")
.replace(/`(.+?)`/g, "<code>$1</code>")
.replace(/^\- (.+)$/gm, "<li>$1</li>")
.replace(/^(?!<[hlo])(.*\S.*)$/gm, "<p>$1</p>")
.replace(/\n{2,}/g, "\n");
}