1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! beautiful-md: A CLI tool and library to format and beautify Markdown files.
//!
//! This crate provides functionality to parse, format, and beautify Markdown files
//! according to configurable style rules. It can be used as a library or as a
//! command-line tool.
//!
//! # Examples
//!
//! ```no_run
//! use beautiful_md::{Config, format_markdown};
//!
//! let markdown = "# Heading\n\n|Name|Age|\n|---|---|\n|Alice|30|";
//! let config = Config::default();
//! let formatted = format_markdown(markdown, &config).unwrap();
//! println!("{}", formatted);
//! ```
//!
//! # Features
//!
//! - Table alignment and padding
//! - Heading spacing normalization
//! - List indentation consistency
//! - Code block formatting
//! - Configurable via TOML files
//!
//! # Configuration
//!
//! Create a `.beautiful-md.toml` file in your project root or home directory:
//!
//! ```toml
//! [tables]
//! align = true
//! min_column_width = 3
//! padding = 1
//!
//! [headings]
//! blank_lines_before = 2
//! blank_lines_after = 1
//! space_after_hash = true
//!
//! [lists]
//! indent_size = 2
//! marker = "-"
//! normalize_numbers = true
//!
//! [code]
//! ensure_language_tag = false
//! fence_style = "```"
//! ```
// Re-export main types for convenience
pub use Config;
pub use ;
/// Format markdown content according to the provided configuration.
///
/// # Errors
///
/// Returns an error if the markdown cannot be parsed or formatted.
///
/// # Examples
///
/// ```
/// use beautiful_md::{Config, format_markdown};
///
/// let markdown = "# Heading\n\nSome text.";
/// let config = Config::default();
/// let result = format_markdown(markdown, &config);
/// assert!(result.is_ok());
/// ```
/// Format a markdown file in-place.
///
/// # Errors
///
/// Returns an error if the file cannot be read, parsed, formatted, or written.