npx skills add ...
npx skills add github/awesome-copilot --skill markdown-to-html
Convert Markdown files to HTML similar to `marked.js`, `pandoc`, `gomarkdown/markdown`, or similar tools; or writing custom script to convert markdown to html and/or working on web template systems like `jekyll/jekyll`, `gohugoio/hugo`, or similar web templating systems that utilize markdown documents, converting them to html. Use when asked to "convert markdown to html", "transform md to html", "render markdown", "generate html from markdown", or when working with .md files and/or web a templating system that converts markdown to HTML output. Supports CLI and Node.js workflows with GFM, CommonMark, and standard Markdown flavors.
npx skills add github/awesome-copilot --skill markdown-to-html
Expert skill for converting Markdown documents to HTML using the marked.js library, or writing data conversion scripts; in this case scripts similar to markedJS/marked repository. For custom scripts knowledge is not confined to marked.js, but data conversion methods are utilized from tools like pandoc and gomarkdown/markdown for data conversion; jekyll/jekyll and gohugoio/hugo for templating systems.
The conversion script or tool should handle single files, batch conversions, and advanced configurations.
For more see basic-markdown-to-html.md
For more see code-blocks-to-html.md
For more see collapsed-sections-to-html.md
For more see writing-mathematical-expressions-to-html.md
For more see tables-to-html.md
markedJS/markednpm install -g markednpm install markedSee marked.md Quick Conversion Methods
See marked.md Step-by-Step Workflows
Create ~/.marked.json for persistent options:
Or use a custom config:
| Option | Description |
|---|---|
-i, --input <file> | Input Markdown file |
-o, --output <file> | Output HTML file |
-s, --string <string> | Parse string instead of file |
-c, --config <file> | Use custom config file |
--gfm | Enable GitHub Flavored Markdown |
--breaks | Convert newlines to <br> |
--help | Show all options |
⚠️ Marked does NOT sanitize output HTML. For untrusted input, use a sanitizer:
Recommended sanitizers:
| Flavor | Support |
|---|---|
| Original Markdown | 100% |
| CommonMark 0.31 | 98% |
| GitHub Flavored Markdown | 97% |
| Issue | Solution |
|---|---|
| Special characters at file start | Strip zero-width chars: content.replace(/^[\u200B\u200C\u200D\uFEFF]/,"") |
| Code blocks not highlighting | Add a syntax highlighter like highlight.js |
| Tables not rendering | Ensure gfm: true option is set |
| Line breaks ignored | Set breaks: true in options |
| XSS vulnerability concerns | Use DOMPurify to sanitize output |
pandoc| Option | Description |
|---|---|
-f, --from <format> | Input format (markdown, html, latex, etc.) |
-t, --to <format> | Output format (html, latex, pdf, docx, etc.) |
-s, --standalone | Produce standalone document with header/footer |
-o, --output <file> | Output file (inferred from extension) |
--mathml | Convert TeX math to MathML |
--metadata title="Title" | Set document metadata |
--toc | Include table of contents |
--template <file> | Use custom template |
--help | Show all options |
⚠️ Pandoc processes input faithfully. When converting untrusted markdown:
--sandbox mode to disable external file access| Flavor | Support |
|---|---|
| Pandoc Markdown | 100% (native) |
| CommonMark | Full (use -f commonmark) |
| GitHub Flavored Markdown | Full (use -f gfm) |
| MultiMarkdown | Partial |
| Issue | Solution |
|---|---|
| PDF generation fails | Install LaTeX (MacTeX, MiKTeX, or texlive) |
| Encoding issues on Windows | Run chcp 65001 before using pandoc |
| Missing standalone headers | Add -s flag for complete documents |
| Math not rendering | Use --mathml or --mathjax option |
| Tables not rendering | Ensure proper table syntax with pipes and dashes |
gomarkdown/markdowngo get github.com/gomarkdown/markdowngo install github.com/gomarkdown/mdtohtml@latestThe mdtohtml CLI tool has minimal options:
For advanced configuration, use the Go library programmatically with parser and renderer options:
| Parser Extension | Description |
|---|---|
parser.CommonExtensions | Tables, fenced code, autolinks, strikethrough, etc. |
parser.AutoHeadingIDs | Generate IDs for headings |
parser.NoEmptyLineBeforeBlock | No blank line needed before blocks |
parser.MathJax | MathJax support for LaTeX math |
| HTML Flag | Description |
|---|---|
html.CommonFlags | Common HTML output flags |
html.HrefTargetBlank | Add target="_blank" to links |
html.CompletePage | Generate complete HTML page |
html.UseXHTML | Generate XHTML output |
⚠️ gomarkdown does NOT sanitize output HTML. For untrusted input, use Bluemonday:
Recommended sanitizer: Bluemonday
| Flavor | Support |
|---|---|
| Original Markdown | 100% |
| CommonMark | High (with extensions) |
| GitHub Flavored Markdown | High (tables, fenced code, strikethrough) |
| MathJax/LaTeX Math | Supported via extension |
| Mmark | Supported |
| Issue | Solution |
|---|---|
| Windows/Mac newlines not parsed | Use parser.NormalizeNewlines(input) |
| Tables not rendering | Enable parser.Tables extension |
| Code blocks without highlighting | Integrate with syntax highlighter like Chroma |
| Math not rendering | Enable parser.MathJax extension |
| XSS vulnerabilities | Use Bluemonday to sanitize output |
jekyllgem install jekyll bundler| Command | Description |
|---|---|
jekyll new <path> | Create new Jekyll site |
jekyll build | Build site to _site directory |
jekyll serve | Build and serve locally |
jekyll clean | Remove generated files |
jekyll doctor | Check for configuration issues |
| Serve Options | Description |
|---|---|
--livereload | Reload browser on changes |
--drafts | Include draft posts |
--port <port> | Set server port (default: 4000) |
--host <host> | Set server host (default: localhost) |
--baseurl <url> | Set base URL |
⚠️ Jekyll security considerations:
safe: false in productionexclude in _config.yml to prevent sensitive files from being published| Flavor | Support |
|---|---|
| Kramdown (default) | 100% |
| CommonMark | Via plugin (jekyll-commonmark) |
| GitHub Flavored Markdown | Via plugin (jekyll-commonmark-ghpages) |
| RedCarpet | Via plugin (deprecated) |
Configure markdown processor in _config.yml:
| Issue | Solution |
|---|---|
| Ruby 3.0+ fails to serve | Run bundle add webrick |
| Gem dependency errors | Run bundle install |
| Slow builds | Use --incremental flag |
| Liquid syntax errors | Check for unescaped { in content |
| Plugin not loading | Add to _config.yml plugins list |
hugo| Command | Description |
|---|---|
hugo new site <name> | Create new Hugo site |
hugo new content <path> | Create new content file |
hugo | Build site to public directory |
hugo server | Start development server |
hugo mod init | Initialize Hugo Modules |
| Build Options | Description |
|---|---|
-D, --buildDrafts | Include draft content |
-E, --buildExpired | Include expired content |
-F, --buildFuture | Include future-dated content |
--minify | Minify output |
--gc | Run garbage collection after build |
-d, --destination <path> | Output directory |
| Server Options | Description |
|---|---|
--bind <ip> | Interface to bind to |
-p, --port <port> | Port number (default: 1313) |
--liveReloadPort <port> | Live reload port |
--disableLiveReload | Disable live reload |
--navigateToChanged | Navigate to changed content |
⚠️ Hugo security considerations:
hugo.toml for external commands--enableGitInfo carefully with public repositories| Flavor | Support |
|---|---|
| Goldmark (default) | 100% (CommonMark compliant) |
| GitHub Flavored Markdown | Full (tables, strikethrough, autolinks) |
| CommonMark | 100% |
| Blackfriday (legacy) | Deprecated, not recommended |
Configure markdown in hugo.toml:
| Issue | Solution |
|---|---|
| "Page not found" on paths | Check baseURL in config |
| Theme not loading | Verify theme in themes/ or Hugo Modules |
| Slow builds | Use --templateMetrics to identify bottlenecks |
| Raw HTML not rendering | Set unsafe = true in goldmark config |
| Images not loading | Check static/ folder structure |
| Module errors | Run hugo mod tidy |
markedJS/markedpandocgomarkdown/markdownjekyllhugo