This escapes a string for LaTeX, HTML, Typst or RTF.
sanitize(str, type = c("latex", "html", "typst", "rtf"))The sanitized character object.
HTML and LaTeX code was copied over from xtable::sanitize().
txt <- "Make $$$ with us"
sanitize(txt, type = "latex")
#> [1] "Make \\$\\$\\$ with us"