AgentSkillsCN

HTML to Markdown Converter CLI

将 HTML 转换为整洁的 Markdown 格式。适用于网页、文档、文章等内容的转换,同时保留原有排版、链接与图片。支持批量转换,免费使用。

SKILL.md
--- frontmatter
name: HTML to Markdown Converter CLI
description: Convert HTML to clean Markdown. Web pages, docs, articles. Preserve formatting, links, images. Batch conversion. Free tool.
tags: [markdown, html, converter, documentation, cli, content, web-scraping]

HTML to Markdown Converter CLI

Convert any HTML to clean Markdown.

Web pages. Docs. Articles. Clean output.

Quick Start

bash
npm install -g @lxgicstudios/markdownify
bash
# Convert HTML file
markdownify page.html -o page.md

# Convert from URL
markdownify https://example.com/article -o article.md

# Convert clipboard
pbpaste | markdownify

What It Handles

Preserves

  • Headings (H1-H6)
  • Lists (ordered, unordered, nested)
  • Code blocks with language
  • Tables
  • Images with alt text
  • Links

Cleans

  • Removes scripts/styles
  • Strips empty elements
  • Normalizes whitespace
  • Fixes encoding

Commands

bash
# Basic conversion
markdownify input.html

# From URL with article extraction
markdownify https://blog.com/post --article

# Batch convert directory
markdownify ./html/*.html -o ./markdown/

# Preserve specific elements
markdownify page.html --keep-classes

# GitHub Flavored Markdown
markdownify page.html --gfm

# Include images as data URIs
markdownify page.html --inline-images

# Extract main content only
markdownify https://news.site/article --readability

Piping Support

bash
# From curl
curl https://example.com | markdownify > page.md

# Chain with other tools
markdownify page.html | grep -A5 "## Features"

Use Cases

  • Documentation conversion
  • Blog migration
  • Content archival
  • Note-taking from web
  • CMS migration

Built by LXGIC Studios

🔗 GitHub · Twitter