webmd-cli
v1.0.0
Published
Convert web pages to Markdown files. Supports single page conversion and full site crawling via sitemap.xml
Maintainers
Readme
webmd-cli
English
Convert web pages to Markdown files with preserved structure.
Features
- 🚀 Single page conversion
- 📦 Full site crawling via sitemap.xml
- 🔗 Converts relative URLs to absolute URLs
- 📁 Preserves directory structure (optional)
- 🎯 Maintains HTML structure in Markdown (h1 → #, h2 → ##, etc.)
Installation
npx webmd <URL>Or install globally:
npm install -g webmd-cliUsage
Single Page Conversion
Convert a single web page to Markdown:
npx webmd https://example.com/pageOutput: example-com/page.md
Full Site Crawling
Crawl entire site using sitemap.xml:
npx webmd -f https://example.comThis will:
- Fetch
https://example.com/sitemap.xml - Download all pages listed in the sitemap
- Save them to
example-com/directory
Preserve Directory Structure
Use the -d flag to maintain the original URL structure:
npx webmd -f -d https://example.com- Without
-d:example-com/about-team.md - With
-d:example-com/about/team.md
Examples
# Single page
npx webmd https://example.com/
# Full site (flat structure)
npx webmd -f https://example.com/
# Full site (preserve directory structure)
npx webmd -f -d https://example.com/Output
- Images:
 - Links:
[text](https://example.com/link) - All relative URLs are converted to absolute URLs
Requirements
- Node.js 14 or higher
- Site must have sitemap.xml for full site crawling
License
MIT
日本語
WebページをMarkdownファイルに変換するCLIツール。HTML構造を維持したまま変換します。
機能
- 🚀 単一ページの変換
- 📦 sitemap.xmlを使ったサイト全体のクロール
- 🔗 相対URLを絶対URLに自動変換
- 📁 ディレクトリ構造の保持(オプション)
- 🎯 HTML構造をMarkdownで維持(h1 → #、h2 → ##など)
インストール
npx webmd <URL>グローバルインストールする場合:
npm install -g webmd-cli使い方
単一ページの変換
1つのWebページをMarkdownに変換:
npx webmd https://example.com/page出力: example-com/page.md
サイト全体のクロール
sitemap.xmlを使ってサイト全体をクロール:
npx webmd -f https://example.com以下の処理を実行します:
https://example.com/sitemap.xmlを取得- sitemapに記載された全ページをダウンロード
example-com/ディレクトリに保存
ディレクトリ構造の保持
-d フラグを使うと、元のURL構造を維持します:
npx webmd -f -d https://example.com-dなし:example-com/about-team.md-dあり:example-com/about/team.md
使用例
# 単一ページ
npx webmd https://example.com/
# サイト全体(フラット構造)
npx webmd -f https://example.com/
# サイト全体(ディレクトリ構造を保持)
npx webmd -f -d https://example.com/出力形式
- 画像:
 - リンク:
[text](https://example.com/link) - すべての相対URLは絶対URLに変換されます
必要環境
- Node.js 14以上
- サイト全体のクロールにはsitemap.xmlが必要
ライセンス
MIT
