Improve coding formats in footnote
diff --git a/R/from_knitr.R b/R/from_knitr.R
new file mode 100644
index 0000000..f782a19
--- /dev/null
+++ b/R/from_knitr.R
@@ -0,0 +1,25 @@
+# These functions are imported from knitr/highr as `:::` is not recommended by
+# CRAN
+
+#' escape special LaTeX characters
+#' @author Yihui Xie
+escape_latex <- function(x, newlines = FALSE, spaces = FALSE) {
+ x = gsub('\\\\', '\\\\textbackslash', x)
+ x = gsub('([#$%&_{}])', '\\\\\\1', x)
+ x = gsub('\\\\textbackslash', '\\\\textbackslash{}', x)
+ x = gsub('~', '\\\\textasciitilde{}', x)
+ x = gsub('\\^', '\\\\textasciicircum{}', x)
+ if (newlines) x = gsub('(?<!\n)\n(?!\n)', '\\\\\\\\', x, perl = TRUE)
+ if (spaces) x = gsub(' ', '\\\\ \\\\ ', x)
+ x
+}
+
+#' escape special HTML characters
+#' @author Yihui Xie
+escape_html <- function(x) {
+ x = gsub('&', '&', x)
+ x = gsub('<', '<', x)
+ x = gsub('>', '>', x)
+ x = gsub('"', '"', x)
+ x
+}