CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

html2markdown

Convert HTML files to Markdown using pandoc. Use when processing HTML files for text extraction, converting web content to readable markdown, or batch converting HTML files in a course/project directory to markdown format for downstream processing.

Quality

80%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./skills/html2markdown/SKILL.md
SKILL.md
Quality
Evals
Security

HTML to Markdown Conversion

Convert HTML files to clean Markdown using pandoc.

Quick Start

Single File

pandoc -f html -t markdown input.html -o output.md

With Options

# Wrap lines at 80 characters
pandoc -f html -t markdown --wrap=auto --columns=80 input.html -o output.md

# No line wrapping (preserves original flow)
pandoc -f html -t markdown --wrap=none input.html -o output.md

# GitHub-flavored markdown
pandoc -f html -t gfm input.html -o output.md

Batch Processing

Use scripts/html2markdown.py for batch conversion:

python scripts/html2markdown.py /path/to/root/directory

Options:

  • --output-dir: Specify output directory (default: in-place with .md extension)
  • --flatten: Flatten all output to single directory
  • --wrap: Line wrapping mode (none, auto, preserve)

Output Formats

FormatFlagUse Case
GitHub Flavored-t gfmRecommended - cleaner output
Standard Markdown-t markdownPandoc extensions, may include div syntax
CommonMark-t commonmarkStrict CommonMark
Plain text-t plainText only, no formatting

Note: Standard markdown (-t markdown) may include pandoc-specific syntax like ::: {role="main"} div markers. Use -t gfm for cleaner, more portable output.

Common Issues

Malformed HTML

Pandoc handles most malformed HTML gracefully. For severely broken HTML, preprocess with:

tidy -q -ashtml input.html | pandoc -f html -t markdown -o output.md

Character Encoding

Force UTF-8 encoding:

pandoc -f html -t markdown --metadata encoding=utf-8 input.html -o output.md

Stripping Unwanted Elements

Pandoc converts everything. To strip scripts/styles before conversion:

from bs4 import BeautifulSoup

with open('input.html', 'r') as f:
    soup = BeautifulSoup(f.read(), 'html.parser')

for tag in soup(['script', 'style', 'nav', 'footer', 'header']):
    tag.decompose()

clean_html = str(soup)
# Then pass clean_html to pandoc via stdin

Integration with Preprocessing Pipeline

For course preprocessing workflows, the batch script outputs files suitable for concatenation into a single *_output.txt file with custom separators.

Repository

KennethJefferson/cc_sdk_knowledge_extractor

Path

skills/html2markdown/SKILL.md

Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.