Skip to main content

Markdown2html

@svendowideit/markdown2htmlv2026.10.24.2· MIT· 1d agoBEHAVIORS
01README

Render Markdown files into a static HTML site with an index page, without requiring Python or special content markers. WHAT IT DOES

Scan a directory of Markdown files, parse optional YAML frontmatter, render titles/dates/excerpts/body as HTML with marked, apply an optional template, write one HTML file per post, create index.html, and create rss.xml. Prefer it over copy-pasting Markdown or hand-writing HTML when the source notes already contain the content you want published.

Optional YAML frontmatter is parsed only if the file begins with --- and ends with ---. Supported fields are title, date, slug, and excerpt. Title also falls back to the first H1, then the file name. Date falls back to an empty string. Slug falls back to the file name without its extension. Excerpt falls back to the first paragraph. Pages are sorted newest date first (empty dates sort last), then title, and the generated index.html links to every page.

INSTALL

swamp extension pull @svendowideit/markdown2html

DEPENDENCIES

marked, js-yaml, and the swamp CLI only. Everything is bundled into the extension, so no separate runtime is needed.

RUN

# Render /home/me/notes into a static site.
swamp workflow run @svendowideit/markdown2html-render \
  --input sourceDir=/home/me/notes \
  --input outputDir=/home/me/site

# Validate a direct model run first.
swamp model method run pages generate \
  --input sourceDir=/home/me/notes \
  --input outputDir=/home/me/site

CONFIGURE

Global/module inputs: sourceDir Directory containing Markdown files outputDir Directory where the site is written siteTitle Site title (default Notes) indexTitle Title for index.html and rss.xml (defaults to siteTitle) templatePath Optional HTML template; supported tokens are {{title}}, {{body}}, {{date}}, {{slug}}, {{excerpt}}, {{siteTitle}}, {{recent_posts}}, and {{archives}} recursive Scan subdirectories (default true)

WHAT IT INSTALLS

Nothing on the host. It writes HTML, index.html, and swamp data only. Upgrade with swamp extension update.

02Behaviors1
@svendowideit/markdown2htmlv2026.10.24.2markdown2html.ts

Global Arguments

ArgumentTypeDescription
sourceDirstringDirectory containing Markdown files
outputDirstringDirectory where the site is written
siteTitle?stringSite title
indexTitle?stringTitle used for index.html and rss.xml; defaults to siteTitle
templatePath?stringOptional HTML template using {{title}}, {{body}}, {{date}}, {{slug}}, and {{excerpt}}
recursive?booleanScan subdirectories
fn generate(sourceDir?: string, outputDir?: string, siteTitle?: string, indexTitle?: string, templatePath?: string, recursive?: boolean)
Render all Markdown files in sourceDir to HTML in outputDir and create index.html
ArgumentTypeDescription
sourceDir?stringOverride source directory
outputDir?stringOverride output directory
siteTitle?stringOverride site title
indexTitle?stringOverride index/feed title
templatePath?stringOverride template path
recursive?booleanOverride recursive scan

Resources

result(infinite)— Result of rendering Markdown files to an HTML site
03Previous Versions1
2026.10.24.1MIT
04Stats
B
87 / 100
Downloads
0
Archive size
22.3 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented0/1missing
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit1/2partial
    • marked--npm:marked@14 is a range; audited 14.1.4, the version the registry resolved
    1 dependency found
    • npm:marked@14 -- audited 14.1.4
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
05Platforms
06Labels