beautiful-md
A CLI tool and Rust library to format and beautify Markdown files with configurable style rules.
Features
- ✨ Table Formatting: Align columns, consistent padding, and clean appearance
- 📝 Heading Normalization: Consistent spacing and hash mark formatting
- 📋 List Formatting: Uniform indentation and bullet markers
- 💻 Code Block Styling: Consistent fence styles and language tags
- ⚙️ Configurable: Customize formatting rules via TOML configuration
- 🚀 Fast: Written in Rust for optimal performance
- 📦 Multiple Modes: In-place editing, stdout output, or file output
Installation
From crates.io
From source
Usage
Command Line
# Format and output to stdout
# Format file in-place
# Format multiple files
# Format with custom config
# Check if files need formatting (useful for CI)
# Generate default configuration file
As a Library
use ;
Configuration
Create a .beautiful-md.toml file in your project root or home directory:
[]
= true
= 3
= 1
[]
= 1
= 1
= true
[]
= 2
= "-"
= true
[]
= false
= "```"
Configuration Options
Tables
align(bool): Enable column alignmentmin_column_width(usize): Minimum width for columnspadding(usize): Spaces around cell content
Headings
blank_lines_before(usize): Empty lines before headingsblank_lines_after(usize): Empty lines after headingsspace_after_hash(bool): Ensure space after#symbols
Lists
indent_size(usize): Spaces per indentation levelmarker(string): Bullet character (-,*, or+)normalize_numbers(bool): Fix ordered list numbering
Code
ensure_language_tag(bool): Require language tagsfence_style(string): Fence style (```or~~~)
Examples
Before
- *+
After
- --
Development
Prerequisites
- Rust 1.70 or later
- Cargo
Building
Testing
Linting
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.