Adds a language for highlighting fenced code blocks in
markdown_box_grob(), from a KDE syntax file (the format used by Kate
and Pandoc). The easiest start is a copy of a built-in grammar:
Details
file.copy(system.file("highlight", "python.xml",
package = "gridmicrotex"),
"mylang.xml")Many files from https://kate-editor.org/syntax/ work as they are. Files that use dynamic rules are refused with an error. Those files are mostly GPL or LGPL licensed; check the licence before you redistribute one.
Colours come from markdown_style(), using Pandoc's class names (kw
keyword, co comment, st string, ...), so a grammar needs no
colours of its own.
Examples
# Registering a grammar under a name of your own.
f <- system.file("highlight", "python.xml", package = "gridmicrotex")
register_highlighter("mypython", f)
"mypython" %in% available_highlighters()
#> [1] TRUE