Skip to content

blockquote

Turns text into a Markdown blockquote by prefixing every line with > .

Empty lines get a bare > (no trailing space), so the quote stays one block. Line breaks are kept as they are, including a trailing one, and a quote inside a quote nests naturally (> > text).

use helpers4::markdown::blockquote;

Cargo feature markdown (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features markdown

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.6", default-features = false, features = ["markdown"] }
pub fn blockquote(text: &str) -> String
ParameterTypeDescription
text&strThe text to quote, on one or several lines.

String — The quoted text.

use helpers4::markdown::blockquote;

assert_eq!(blockquote("first\n\nsecond"), "> first\n>\n> second");

src/markdown/blockquote.rs