summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/text/lorem.rs
blob: 5d01a550df05ad91de5392970230d806b3073d57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::foundations::{func, Str};

/// Creates blind text.
///
/// This function yields a Latin-like _Lorem Ipsum_ blind text with the given
/// number of words. The sequence of words generated by the function is always
/// the same but randomly chosen. As usual for blind texts, it does not make any
/// sense. Use it as a placeholder to try layouts.
///
/// # Example
/// ```example
/// = Blind Text
/// #lorem(30)
///
/// = More Blind Text
/// #lorem(15)
/// ```
#[func(keywords = ["Blind Text"])]
pub fn lorem(
    /// The length of the blind text in words.
    words: usize,
) -> Str {
    lipsum::lipsum(words).replace("--", "–").into()
}