md-ulb-pwrap 0.1.3

Markdown paragraph wrapper using Unicode Line Breaking Algorithm.
Documentation

md-ulb-pwrap

Crate PyPI

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.