| Crates.io | markdown-tool |
| lib.rs | markdown-tool |
| version | 2.0.0 |
| created_at | 2025-04-30 19:05:45.379078+00 |
| updated_at | 2025-09-22 14:22:59.114402+00 |
| description | A CLI utility for converting Markdown into AST and vice versa |
| homepage | https://github.com/johnlepikhin/markdown-tool#readme |
| repository | https://github.com/johnlepikhin/markdown-tool |
| max_upload_size | |
| id | 1655349 |
| size | 65,013 |
markdown-tool is a powerful command-line utility for converting Markdown documents to various formats including HTML, LaTeX, and abstract syntax tree (AST) representations.
Install via crates.io (requires Rust and Cargo):
cargo install markdown-tool
Alternatively, download pre-built packages:
.deb):
sudo dpkg -i markdown-tool_<VERSION>_<ARCH>.deb
The tool uses a modern subcommand structure for better organization:
Usage: markdown-tool convert-to [OPTIONS] <COMMAND>
Commands:
markdown Convert to Markdown format
html Convert to HTML format
latex Convert to LaTeX format
ast-json Convert to AST JSON format
ast-yaml Convert to AST YAML format
Options:
-f, --from <FROM> Input format: markdown, ast-json, ast-yaml [default: markdown]
-h, --help Print help
Most common use case (Markdown input is default):
echo "# Hello World" | markdown-tool convert-to html
# Output: <h1>Hello World</h1>
| Format | Input | Output | Description |
|---|---|---|---|
| markdown | ✅ | ✅ | Standard Markdown text |
| html | ❌ | ✅ | HTML-formatted text |
| latex | ❌ | ✅ | LaTeX document format |
| ast-json | ✅ | ✅ | JSON-formatted abstract syntax tree |
| ast-yaml | ✅ | ✅ | YAML-formatted abstract syntax tree |
Convert Markdown to HTML (default input format):
markdown-tool convert-to html < input.md > output.html
Convert Markdown to LaTeX with custom formatting:
markdown-tool convert-to latex --table-style booktabs --code-style minted < input.md > output.tex
Convert Markdown to JSON AST:
markdown-tool convert-to ast-json < input.md > ast.json
Convert JSON AST back to Markdown:
markdown-tool convert-to -f ast-json markdown < ast.json > output.md
Convert YAML AST to Markdown with custom width:
markdown-tool convert-to -f ast-yaml markdown --width 120 < ast.yaml > output.md
Pretty-print Markdown with custom formatting:
markdown-tool convert-to markdown --width 100 --spaces-before-list-item 2 < unformatted.md > formatted.md
markdown-tool convert-to markdown --width 120 --spaces-before-list-item 2 --no-empty-line-before-list
markdown-tool convert-to html --width 100 --anchor-prefix "section-"
markdown-tool convert-to latex --width 80 --table-style booktabs --code-style minted
Available LaTeX options:
tabular (default), longtabu, booktabsverbatim (default), listings, mintedDepending on the options used, you may need these LaTeX packages:
hyperref - for links (\href)graphicx - for images (\includegraphics)ulem - for strikethrough (\sout)booktabs - if using --table-style booktabslongtabu - if using --table-style longtabulistings - if using --code-style listingsminted - if using --code-style minted (requires Python + Pygments)Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request on GitHub.
Dual-licensed under MIT. See LICENSE for details.