agentleFS
fabioc-alohafabioc-aloha/Alex_ACT_Edition/.github/skills/md-to-html/SKILL.md

md-to-html

Skill0 starsChanged 4 months agoMITView on GitHub

Convert Markdown to standalone HTML pages with embedded CSS, images, and Mermaid diagrams

  • Installs packages

2 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No background colors (ink-friendly)

    line 138
  2. Distinctive:

    Not earning tokens if the output loses semantic structure (headings, lists, code blocks) that raw Pandoc preserves without the documented …

    line 222

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Md To Html

Write in Markdown, share as a polished web page — zero dependencies for viewers

Convert Markdown documents into self-contained HTML files with embedded CSS, base64 images, and Mermaid diagram rendering. Ready for quick-share distribution, offline viewing, print, or email attachment.


When to Use

  • Sharing formatted documents without requiring Word or PDF viewers
  • Creating self-contained HTML pages for offline distribution
  • Generating printable web pages from Markdown sources
  • Quick previews of documentation with professional styling
  • Email attachments that open in any browser
  • Static site generation from Markdown sources

Supported Formatting

FormatStatusNotes
Headings✅H1-H6 with styled colors
Bold/Italic✅Standard emphasis
Links✅Styled with underline on hover
Images✅Base64 embedded or linked
Code blocks✅Syntax highlighting, monospace font
Inline code✅Background highlight
Tables✅Striped rows, header styling
Blockquotes✅Left border, italic style
Lists✅Ordered, unordered, nested
Task lists✅Checkbox rendering
Mermaid diagrams✅PNG or table fallback
SVG✅Inline or base64 embedded
Horizontal rules✅Styled dividers
Footnotes✅Via pandoc
Math (KaTeX)⚠️Requires --katex flag

Key Features

FeatureDetails
Style presetsprofessional, academic, minimal, dark
Self-containedAll CSS embedded in <style> block, no external deps
Image embeddingLocal images converted to base64 data URIs
Mermaid supportPNG rendering or table fallback for diagrams
Print-readyCSS @media print rules included
TOC generationOptional table of contents via --toc
FrontmatterExtracted for title, stripped from output

Usage

# Basic conversion (professional style)
node .github/skills/md-to-html/scripts/md-to-html.cjs report.md

# Academic style with TOC
node .github/skills/md-to-html/scripts/md-to-html.cjs thesis.md --style academic --toc

# Dark mode output
node .github/skills/md-to-html/scripts/md-to-html.cjs docs.md --style dark

# Mermaid diagrams rendered as PNG (high quality)
node .github/skills/md-to-html/scripts/md-to-html.cjs architecture.md --mermaid-png

# Custom output path
node .github/skills/md-to-html/scripts/md-to-html.cjs README.md output/readme.html

# Dry run (validate without generating)
node .github/skills/md-to-html/scripts/md-to-html.cjs report.md --dry-run

# Debug mode (save preprocessed markdown)
node .github/skills/md-to-html/scripts/md-to-html.cjs report.md --debug

Options Reference

OptionDefaultDescription
--style PRESETprofessionalStyle preset: professional, academic, minimal, dark
--tocoffGenerate table of contents from headings
--embed-imagestrueConvert local images to base64 data URIs
--no-embed-images-Keep image paths as-is (external references)
--strip-frontmattertrueRemove YAML frontmatter from output
--mermaid-pngoffRender Mermaid as PNG (requires mmdc)
--mermaid-fallbackdefaultConvert Mermaid to table representation
--debugoffSave preprocessed markdown as _debug_combined.md
--dry-runoffValidate only, no HTML output

Style Presets

PresetFontMax WidthColorsBest For
professionalSegoe UI900pxBlue headings, white bgBusiness docs, reports
academicPalatino Linotype750pxDark headings, cream bgPapers, theses
minimalInter800pxBlack/gray, white bgClean, modern pages
darkSegoe UI900pxLight text, dark bgDark mode preference

Mermaid Diagram Support

Diagram TypePNG ModeFallback Mode
Flowchart✅ Full render✅ Table
Sequence✅ Full render✅ Table
Class✅ Full render✅ Table
State✅ Full render✅ Table
ER✅ Full render✅ Table
Gantt✅ Full render⚠️ Limited
Pie✅ Full render✅ Table
Journey✅ Full render⚠️ Limited

PNG Mode (--mermaid-png): Requires mermaid-cli (mmdc). Renders at scale 8, 2400px width for crisp output. Diagrams are embedded as base64 PNGs.

Fallback Mode (default): No external dependencies. Converts diagram syntax to an ASCII table representation suitable for text-only viewing.


Print Styling

HTML output includes @media print CSS rules:

  • Page breaks before H1 headings
  • No background colors (ink-friendly)
  • Link URLs shown after text
  • Code blocks with borders instead of background
  • Proper margins for binding

Batch Processing

# Convert all markdown files in a directory
for file in docs/*.md; do
  node .github/skills/md-to-html/scripts/md-to-html.cjs "$file" --style professional
done

# PowerShell equivalent
Get-ChildItem docs/*.md | ForEach-Object {
  node .github/skills/md-to-html/scripts/md-to-html.cjs $_.FullName --style professional
}

Troubleshooting

ProblemCauseSolution
"pandoc not found"pandoc not installedwinget install pandoc
Mermaid not renderingmmdc not installednpm install -g @mermaid-js/mermaid-cli or use fallback
Images missingRelative paths brokenUse --embed-images (default)
Output too wide on printStyle preset issueUse academic style for print
Special characters garbledEncoding issueEnsure source is UTF-8

Requirements

  • Node.js 24+
  • pandoc (winget install pandoc)
  • mermaid-cli (optional, only for --mermaid-png)

Muscle Script

.github/skills/md-to-html/scripts/md-to-html.cjs (v1.0.0)


Conversion Acceptance Decision Table

ConditionVerdictAction
All headings, lists, tables, code blocks render correctlyAcceptShip as-is
Mermaid diagrams rendered as PNG/SVG with correct layoutAcceptVerify diagram labels readable
Mermaid diagrams missing or show raw syntaxRejectCheck mermaid-cli installed; re-run with --mermaid-png
Math equations (KaTeX/MathJax) render correctlyAcceptSpot-check complex equations
Math equations show raw LaTeX sourceRejectVerify KaTeX CSS/JS included in template
Embedded images display at correct sizeAcceptConfirm no broken <img> tags
Images missing or show broken placeholdersRejectCheck paths are relative and files exist
CSS custom properties resolve (colors, fonts)AcceptVisual spot-check against brand
Inline styles lost or overridden by browser defaultsWarningAdd !important or inline fallbacks
Output file size >5MB for a simple documentWarningCheck for unoptimized base64 images
HTML validates (no unclosed tags, no script injection)AcceptRequired for security
HTML contains <script> from untrusted sourceRejectSanitize; only allow known libraries

Related Skills

  • md-to-word — Sister converter for Word document output
  • md-scaffold — Generate converter-ready Markdown templates
  • markdown-mermaid — Diagram authoring for embedded Mermaid
  • lint-clean-markdown — Pre-validate markdown before conversion
  • nav-inject — Add navigation tables for multi-file suites

Skill version: 2.0.0 | Last updated: 2026-04-14 | Category: document-conversion

Falsifiability

  • This skill is wrong if generated HTML fails W3C validation on structural elements the skill explicitly handles
  • The conversion flags are stale if Pandoc changes default HTML5 output behavior in a major version
  • Not earning tokens if the output loses semantic structure (headings, lists, code blocks) that raw Pandoc preserves without the documented options

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.