CLI toolkit to extract code, export tables, generate styled HTML/PDF from Markdown โ with GitHub repo support
Project description
๐ Markdown Toolkit โ mdtoolkit
A powerful CLI toolkit to extract code blocks, export tables, generate styled HTML/PDF, and process entire GitHub repositories โ all from your Markdown files.
โจ Features
| Feature | Description |
|---|---|
| ๐ Code Extraction | Extracts all fenced code blocks; named from markdown hint or code_line<N>.ext |
| ๐ Table Export | Exports Markdown tables to CSV or styled XLSX workbooks |
| ๐จ Styled HTML | Generates dark-themed professional HTML with embedded CSS |
| ๐ PDF Export | Renders PDF via wkhtmltopdf or headless Chrome |
| ๐ GitHub Mode | Clones any public repo, discovers all .md files, lets you pick and process |
| ๐ File Summary | Quick stats โ headings, code blocks, tables, word count |
๐ Quick Start
Installation
# Clone the repo
git clone https://github.com/cgmafia/mdtoolkit.git
cd mdtoolkit
# Install dependencies
pip install -r requirements.txt
Usage
# Process a local Markdown file directly
python3 tool.py README.md
# Interactive launcher (local file OR GitHub mode)
python3 tool.py
๐ Menu Options
[1] ๐ Extract Code Blocks named from markdown or code_line<N>.ext
[2] ๐ Export Tables -> CSV one .csv per table
[3] ๐ Export Tables -> XLSX all tables in one styled workbook
[4] ๐จ Export Styled HTML dark-themed HTML with embedded CSS
[5] ๐ Export PDF via wkhtmltopdf or Chrome headless
[6] ๐ Do Everything run all 5 actions at once
[7] ๐ File Summary headings, code blocks, tables count
๐ GitHub Mode
When you run python3 tool.py without arguments, you get a launch menu with a GitHub repository option. Accepts any URL format:
https://github.com/owner/repo
https://github.com/owner/repo/tree/develop
https://github.com/owner/repo/tree/feature/my-branch
git@github.com:owner/repo.git
owner/repo
The tool will:
- Clone the repo (depth 1 for speed), with ZIP fallback
- Scan for all
.md/.markdownfiles (skippingnode_modules,.git, etc.) - Present an interactive picker (README.md always listed first)
- Process the chosen file โ or all files at once
- Cache the clone and offer to reuse it on repeat runs
Output is written to:
md_toolkit_output/
github_output/
owner_repo/
README/
code/
tables/
README.html
README.pdf
๐ Code Block Naming
| Fence in Markdown | Saved As |
|---|---|
```java:SecurityConfig.java |
SecurityConfig.java |
```python at line 42 |
code_line42.py |
```sql at line 87 |
code_line87.sql |
๐ฆ Dependencies
| Package | Purpose | Required? |
|---|---|---|
markdown |
MD โ HTML conversion | Recommended |
openpyxl |
XLSX table export | For XLSX feature |
wkhtmltopdf |
PDF rendering (system tool) | For PDF feature |
Install Python packages:
pip install markdown openpyxl
Install wkhtmltopdf (system):
# Ubuntu / Debian
sudo apt install wkhtmltopdf
# macOS
brew install wkhtmltopdf
# Windows โ download installer from:
# https://wkhtmltopdf.org/downloads.html
๐ฅ Platform Support
| Platform | Status |
|---|---|
| Linux | โ Fully supported |
| macOS | โ Fully supported |
| Windows | โ
Works (use python tool.py not python3) |
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
๐ค Author
Anand Venkataraman
- ๐ง Email: vand3dup@gmail.com
- ๐ GitHub: @cgmafia
โญ Show Your Support
If this tool helped you, please consider giving it a โญ on GitHub!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdtoolkit-1.0.0.tar.gz.
File metadata
- Download URL: mdtoolkit-1.0.0.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b8c1c0ea92c402a7adaca0e9142924695a955c0bb33b7671f49c98a436f78f2
|
|
| MD5 |
0ba69de3f9d835b46d0452c0645c8a70
|
|
| BLAKE2b-256 |
22bbe8f3b153566c2e7a0afd9e66a506d4c599a0a59f0a96ed35b264b2c02d3f
|
File details
Details for the file mdtoolkit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mdtoolkit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22ea693f42ec1e19fd5618b000383af24bab95e9ef1b70157bff18f7b290f806
|
|
| MD5 |
6df4dc49693ca2cf229621edb1644084
|
|
| BLAKE2b-256 |
7627c346e0f842408f5d8facaef45a0d066bf18fdc41cadd46abd9fa41c4dc8d
|