CHM to Markdown Converter
About
A Python utility that converts Compiled HTML Help (.chm) files into clean Markdown. It uses a profile system—a generic profile works with any CHM file, and a revit profile is built for Autodesk Revit API documentation. Designed for developers and technical writers who need a…
Details
- Author
- DTDucas
- GitHub stars
- 83
- Downloads
- 617
- Categories
- Other
Jump to
- Profile-based conversion with generic or revit profiles
- Auto‑encoding detection via chardet (UTF-8, GB18030, GBK, GB2312, etc.)
- Cross‑platform 7‑Zip detection (Windows, Linux, macOS)
- Flexible CHM structure support (flat, nested, DirectX SDK style)
- Preserving code blocks with language detection (C#, VB, C++, F#, Python, etc.)
- Generating file_index.json, id_lookup.json, and index.md for AI integration
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
CHM to Markdown ConverterCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install Python 3.10+ and 7-Zip (must be on PATH). Clone the repository, run pip install -r requirements.txt, place .chm files in the resources/ folder, then execute python chm_to_markdown.py. Use --single, --all, --profile, --preserve-structure, --keep-html, and concurrency tuning flags as needed.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"chm to markdown converter": {
"chm-to-markdown": {
"command": "python",
"args": [
"chm_to_markdown.py"
]
}
}
}
}
McpServers
{
"chm-to-markdown": {
"command": "python",
"args": [
"chm_to_markdown.py"
]
}
}
CHM to Markdown Converter
A Python utility for converting Compiled HTML Help (.chm) files into clean Markdown, with built-in support for multiple document types through a profile system.
Originally built for Autodesk Revit API documentation; the generic profile works with any CHM file.
Features
- Profile-based conversion — generic profile for any CHM, revit profile for Autodesk Revit API docs
- Auto encoding detection — handles UTF-8, GB18030, GBK, GB2312, and more via chardet
- Cross-platform 7-Zip detection — finds 7z/7za/7zz on PATH (Windows, Linux, macOS)
- Flexible CHM structure support — handles html/ subdirectory, flat, and deeply nested layouts (e.g. DirectX SDK)
- --preserve-structure — optionally mirrors the CHM's internal folder hierarchy in the output instead of flattening everything into data/
- Code block preservation — detects language from class names and named divs; supports C#, VB, C++, F#, Python, Java, JS/TS, Bash, SQL, XML, JSON
- Table normalization — cleans and re-formats Markdown tables
- Index generation — produces file_index.json, id_lookup.json, and index.md for search and AI integration
- Async + batched processing — bounded concurrency and periodic GC prevent memory overflow on large CHM files (6 000+ pages)
Project Structure
chm_converter/ # Core package
├── config.py # ConversionConfig dataclass + built-in profiles
├── encoding.py # Encoding detection (chardet + CJK fallbacks)
├── extractor.py # CHM extraction via 7-Zip; HTML folder detection
├── html_processor.py # HTML cleaning, link rewriting, code block extraction
├── md_converter.py # HTML → Markdown conversion + post-processing
├── indexer.py # File dictionary building + index file generation
└── pipeline.py # High-level async pipeline (process_chm_file, process_all_chm_files)
chm_to_markdown.py # CLI entry point
resources/ # Place CHM files here
output/ # Generated Markdown (created automatically)
Output layout
output/
└── <name>/
├── core/
│ ├── file_index.json # id → {title, filename, version}
│ ├── id_lookup.json # lowercase id → {title, filename, keywords, version}
│ └── index.md # alphabetical navigation page
└── data/
├── Topic1.md
├── Topic2.md
└── ...
Requirements
- Python 3.10+
- 7-Zip — 7z must be reachable via the default install path or PATH
- Windows: installs to C:\Program Files\7-Zip\7z.exe by default, or add to PATH
- Linux: sudo apt install p7zip-full
- macOS: brew install p7zip
Installation
git clone https://github.com/DTDucas/chm-converter.git
cd chm-converter
pip install -r requirements.txt
Usage
Place .chm files in the resources/ folder, then run:
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



