Expand description
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, "<foo> & <bar>");
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_ html - Escape narrow non-breaking spaces for HTML.
- nb_
spaces_ tex - Escape non breaking spaces for LaTeX, replacing them with the appropriate TeX code. This ensures it works correctly with some LaTeX versions (and it makes the non-breaking spaces shenanigans more visible with most editors)
- nnbsp
Deprecated - Old name of nb_spaces html
- quotes
- Very naively escape quotes
- remove_
xml_ chars - Remove xml 1.0 invalid characters
- tex
- Escape characters for LaTeX