Module crowbook_text_processing::escape [] [src]

Some functions to escape character for display in HTML or LaTeX.

The two most useful ones are tex and html.

Example

use crowbook_text_processing::escape;
let input = "<foo> & <bar>";
let output = escape::html(input);
assert_eq!(&output, "&lt;foo&gt; &amp; &lt;bar&gt;");

let input = "#2: 20%";
let output = escape::tex(input);
assert_eq!(&output, r"\#2: 20\%");

Functions

html

Escape characters for HTML output, replacing <, >, and & with appropriate HTML entities.

nb_spaces [
Deprecated
]

Escape non breaking spaces for HTML.

nb_spaces_tex

Escape non breaking spaces for LaTeX, replacing them with ~.

nnbsp

Escape narrow non-breaking spaces for HTML.

quotes

Very naively escape quotes

tex

Escape characters for LaTeX