🎁 Get the FREE AI Skills Starter GuideSubscribe →
BytesAgainBytesAgain
🦀 ClawHub

Markdown to HTML Converter

by @frankxpj

Convert Markdown files to formatted HTML. Use when the user asks to convert, export, or save a Markdown file as HTML format. Triggers on phrases like "conver...

Versionv1.0.1
Downloads509
TERMINAL
clawhub install md-2-html

📖 About This Skill


name: md-2-html description: Convert Markdown files to formatted HTML. Use when the user asks to convert, export, or save a Markdown file as HTML format. Triggers on phrases like "convert md to html", "markdown to html", "转成html", "md转html", "markdown转html". Also useful for AI content pipelines that generate Markdown but need browser-ready HTML output.

Markdown to HTML Converter

Convert Markdown files or strings to well-formatted HTML, suitable for web display or CMS publishing.

Quick Start

node scripts/md2html.js  [output.html]

Or via stdin:

echo "# Hello World" | node scripts/md2html.js -

Or as a Node.js module:

var converter = require('./scripts/md2html.js');
var html = converter.markdownToHtml(markdownString);

Parameters

| Parameter | Required | Description | |-----------|----------|-------------| | input.md | Yes | Path to source Markdown file, or - for stdin | | output.html | No | Output path (defaults to input name with .html) |

Supported Markdown Features

| Feature | Markdown Syntax | HTML Output | |---------|----------------|-------------| | Headings | # h1 through ###### h6 |

through
| | Bold | text | text | | Italic | *text* | text | | Inline code | ` code | code | | Code blocks | ``lang ` |
 |
| Links | text | text |
| Images | !alt | alt |
| Unordered lists | - item or * item | 
  • item
| | Ordered lists | 1. item |
  1. item
| | Blockquotes | > text |

text

| | Horizontal rule | --- or *** |
| | Paragraphs | Blank line separation |

text

|

Design Principles

  • Zero dependencies — Pure Node.js, works with v0.12+ (no npm install needed)
  • CMS-friendly — Output is clean HTML suitable for direct database insertion
  • No wrapper HTML — Outputs content HTML only (no , , )
  • Safe escaping — Code blocks escape < and > to prevent XSS
  • Typical Use Cases

    1. AI Content Pipeline — LLM generates Markdown → convert to HTML → publish to CMS 2. Static site generation — Batch convert .md files to .html 3. Documentation — Convert README.md to HTML for web display

    Pipeline Integration Example

    For automated AI content pipelines that generate Markdown but publish HTML:

    var converter = require('./scripts/md2html.js');
    var rawMarkdown = llmResponse.choices[0].message.content;
    var htmlContent = converter.markdownToHtml(rawMarkdown);
    // Now publish htmlContent to your CMS API
    

    💡 Examples

    node scripts/md2html.js  [output.html]
    

    Or via stdin:

    echo "# Hello World" | node scripts/md2html.js -
    

    Or as a Node.js module:

    var converter = require('./scripts/md2html.js');
    var html = converter.markdownToHtml(markdownString);