Crates.io | md-ulb-pwrap |
lib.rs | md-ulb-pwrap |
version | 0.1.2 |
source | src |
created_at | 2023-02-16 18:23:39.094557 |
updated_at | 2024-08-01 12:36:42.995656 |
description | Markdown paragraph wrapper using Unicode Line Breaking Algorithm. |
homepage | |
repository | |
max_upload_size | |
id | 786961 |
size | 21,839 |
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",
);
ulb_wrap_paragraph(text: &str, width: usize, first_line_width: usize) -> String
Returns (String): The wrapped text.