6 releases
0.1.2 | Aug 1, 2024 |
---|---|
0.1.1 | May 28, 2024 |
0.1.0 | Aug 10, 2023 |
0.0.3 | Feb 19, 2023 |
#444 in Text processing
348 downloads per month
22KB
551 lines
md-ulb-pwrap
Markdown paragraph wrapper using Unicode Line Breaking Algorithm.
Wrap a Markdown paragraph using a maximum desired width. Only works for paragraphs that don't contain other container blocks. Respects the prohibition against wrapping text inside inline code blocks and links.
Usage
cargo add md-ulb-pwrap
use md_ulb_pwrap::ulb_wrap_paragraph;
assert_eq!(
ulb_wrap_paragraph(
&"aaa ``` `` ` a b c ``` ccc",
3,
3,
),
"aaa\n``` `` ` a b c ```\nccc",
);
Reference
ulb_wrap_paragraph(text: &str, width: usize, first_line_width: usize) -> String
- text (&str): The text to wrap.
- width (usize): The maximum width of the lines after the first.
- first_line_width (usize): The maximum width of the first line.
Returns (String): The wrapped text.
Dependencies
~78KB