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.
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",
);
pip install md-ulb-pwrap
from md_ulb_pwrap import ulb_wrap_paragraph
markdown = "aaa ``` `` ` a b c ``` ccc"
expected_result = "aaa\n``` `` ` a b c ```\nccc"
assert ulb_wrap_paragraph(markdown, 3, 3) == expected_result
ulb_wrap_paragraph(text: str, width: int, first_line_width: int) -> str
Returns (str): The wrapped text.