agentleFS
phanghonghaophanghonghao/THU-Awesome-Skills/skills/html2md/SKILL.md

html2md

Skill8 starsChanged 3 months agoMITView on GitHub

Convert HTML to clean Markdown, optimized for slide-style presentation decks and huge files with inlined base64 images/videos. Strips data URIs BEFORE parsing (so a 10 MB deck converts in seconds, not minutes), detects `.slide` blocks and emits one `## Slide NN — Title` section per slide, and turns common deck semantic-divs (stat-num/stat-label, cards, timelines) into readable Markdown. Triggers: html2md, html to md, html→md, 转换 deck 为 markdown, deck 转 md, slide html to md.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read deck.md + the critique notes (e.g.

    line 100

≈ “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

html2md — HTML → Markdown (deck-aware, base64-safe)

A stdlib-only converter (html2md.py) tuned for two cases generic converters choke on:

  1. Slide decks — a .slide-per-page HTML presentation. A normal converter flattens it into one wall of text; this one keeps the slide structure and emits ## Slide NN — Title headers.
  2. Huge embedded HTML — decks saved as single .html with every image and video inlined as base64 (often 5–50 MB). markitdown and friends spend minutes decoding megabytes of base64 into useless inline blobs; this strips the data URIs first, then parses.

When to Use

  • User mentions: html2md, /html2md, "html to md", "html→md", "把 deck 转成 markdown", "deck 转 md"
  • You have a slide-style HTML deck (each slide is a <div class="slide"> / <section class="slide">) and want structured per-slide Markdown
  • You have a bloated HTML file (multi-MB) that is mostly base64 — markitdown hangs or produces garbage
  • You want to extract the text content of a deck so an LLM can critique / revise it

When NOT to Use (use a different skill instead)

NeedBetter skill
Generic non-deck HTML pagemarkitdown (/markitdown) — broad format support
DOCX with math/word2md (correct OMML→LaTeX)
PDF → Markdown/any2md --pdf-backend pymupdf or /pdf-reader
Want to render a deck to PDF (md/html → pdf)/html2pdf
A whole web page from a URLthe web_reader MCP tool

How to Use

# Convert, write to a sibling .md file
PYTHONIOENCODING=utf-8 python ~/.claude/skills/html2md/html2md.py "deck.html" "deck.md"

# Convert, print to stdout
PYTHONIOENCODING=utf-8 python ~/.claude/skills/html2md/html2md.py "deck.html"

# Extract the base64 images/videos to disk and rewrite refs (instead of [IMAGE] placeholders)
PYTHONIOENCODING=utf-8 python ~/.claude/skills/html2md/html2md.py "deck.html" "deck.md" --extract-assets

# Drop [IMAGE]/[VIDEO] placeholders entirely (pure text)
PYTHONIOENCODING=utf-8 python ~/.claude/skills/html2md/html2md.py "deck.html" "deck.md" --no-assets

# Flat document — don't try to split slides
PYTHONIOENCODING=utf-8 python ~/.claude/skills/html2md/html2md.py "page.html" "page.md" --no-slides

Always set PYTHONIOENCODING=utf-8 on Windows — Chinese/CJK decks mojibake without it.

Arguments

ArgRequiredDescription
inputyesInput .html file
outputnoOutput .md path (default: stdout)
--extract-assetsnoSave base64 blobs to <stem>_assets/ and reference them by path (default: replace with [IMAGE] / [VIDEO])
--no-assetsnoOmit asset placeholders entirely — pure text
--no-slidesnoDon't split into per-slide sections; one flat document

What It Detects

  • Slide structure: any <div class="…slide…"> / <section class="…slide…">. Reads .slide-num, .slide-title, .slide-title-en to build the ## Slide NN — Title / _EN subtitle_ header. Falls back to <!-- === NN LABEL === --> HTML comments if classes are absent.
  • Semantic divs common in decks: .stat-num + .stat-label, .phase-year/.phase-name/.phase-tag, .label/.source-link/.source-note, .maic-ms-* timeline milestones, .action-* 5W1H cards. These become readable inline Markdown (**13%** — global ATP share) instead of being lost.
  • Source links: <a class="source-link" href="…">Source: MIDA</a> → [→ Source: MIDA](url).
  • Tables: <table> → pipe tables.
  • Document <title>: becomes the top-level # Title.

Dependencies

None. Pure Python 3 stdlib (html.parser, re, base64, hashlib). Works on any machine with Python ≥ 3.8.

Notes / Gotchas

  • The slide-splitter caps each slide's inner HTML at 200 KB to defeat greedy regex across nested <div>s. If a slide is genuinely larger than that, raise the limit in split_slides().
  • --extract-assets is the way to recover the inlined videos/images from a bloated deck: it writes each blob to <input-stem>_assets/<kind>_<hash>.<ext> and emits ![image](assets/...). Hashes dedupe identical assets.
  • For a dark/light themed BFLab deck with .presentation { width:1280px; height:720px } and .slide { position:absolute }, the splitter works as-is.
  • This skill does not render HTML or produce PDF — for that use /html2pdf (Chrome headless --print-to-pdf, one PDF page per slide).

Workflow: critique-then-revise a deck

A common use of this skill is to get the text of a deck out so it can be reviewed or rewritten:

  1. html2md deck_embedded.html deck.md — extract clean per-slide Markdown.
  2. Read deck.md + the critique notes (e.g. eunice_suggestion.md).
  3. Author a revised deck HTML (a new file — don't edit the original).
  4. /html2pdf the revised HTML to PDF.

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.