bobzhang/pygments/formatters does not have a README file
fn Formatter::new(info : FormatterInfo, base : BaseOptions, format : (Array[(TokenType, String)]) -> String raise, style_defs? : (String?) -> String raise, aux_files? : () -> Array[AuxFile]) -> Formatterpub struct HtmlFormatter {
base : BaseOptions
nowrap : Bool
noclasses : Bool
classprefix : String
cssclass : String
cssstyles : String
prestyles : String
cssfile : String
noclobber_cssfile : Bool
tagurlformat : String
filename : String
wrapcode : Bool
debug_token_types : Bool
linenos : Int
linenostart : Int
linenostep : Int
linenospecial : Int
nobackground : Bool
lineseparator : String
lineanchors : String
linespans : String
anchorlinenos : Bool
hl_lines : Array[Int]
// private fields
}fn HtmlFormatter::format(self : HtmlFormatter, tokens : Array[(TokenType, String)]) -> String raise FormatterErrortest {
let f = @formatters.HtmlFormatter::new()
inspect(
f.format([(@token.keyword, "def"), (@token.text, " f\n")]),
content=(
#|<div class="highlight"><pre><span></span><span class="k">def</span> f
#|</pre></div>
#|
),
)
}fn HtmlFormatter::get_background_style_defs_for(self : HtmlFormatter, args : Array[String]) -> Array[String]fn HtmlFormatter::get_token_style_defs_for(self : HtmlFormatter, args : Array[String]) -> Array[String]pub struct LatexFormatter {
base : BaseOptions
nowrap : Bool
docclass : String
preamble : String
linenos : Bool
linenostart : Int
linenostep : Int
verboptions : String
nobackground : Bool
commandprefix : String
texcomments : Bool
mathescape : Bool
escapeinside : String
envname : String
// private fields
}fn escape_tex(text : String, commandprefix : String) -> Stringfn find_formatter_class(name : String) -> (FormatterInfo, (Map[String, String], Style?) -> Formatter raise)?test {
let f = @formatters.get_formatter_by_name("html", options={ "nowrap": "true" })
inspect(
f.format([(@token.keyword, "if")]),
content="<span class=\"k\">if</span>\n",
)
}test {
inspect(
@formatters.get_formatter_for_filename("out/a.tex").name(),
content="LaTeX",
)
}fn webify(color : String) -> StringInstall
Download zipA port of Pygments (generic syntax highlighter) to MoonBit
Dependencies