53
highlight
9
Usage
highlight(file, output = stdout(), detective = simple_detective, renderer,
encoding = "unknown", parse.output = parse(file, encoding = encoding,
keep.source = TRUE), styles = detective(parse.output), expr = NULL,
final.newline = FALSE, showPrompts = FALSE,
prompt = getOption("prompt"), continue = getOption("continue"),
initial.spaces = TRUE, size = c("normalsize", "tiny", "scriptsize",
"footnotesize", "small", "large", "Large", "LARGE", "huge", "Huge"),
show_line_numbers = FALSE, ...)
Arguments
file
codefiletoparse.Thisisonlyusediftheparse.outputisgiven
output
wheretowritetherenderedtext.Ifthisisanythingelsethanthedefault(standard
output),thesinkfunctionisusedtoredirectthestandardoutputtotheoutput.
detective
thedetectivechoosesthestyletoapplytoeachtoken,basingitsinvestigationon
theresultsoftheparse
renderer
highlightdelegatesrenderingtheinformationtotherenderer. Thispackagein-
cludeshtmlandlatexrenderers.Seerenderer_htmlandrenderer_latex
encoding
encodingtoassumeforthefile.theargumentisdirectlypassedtotheparse.
parse.output
outputfromtheparse. Ifthisisgiven,theargumentsfileandencodingare
notused
styles
resultofthedetectiveinvestigation. Acharactervectorwithasmanyelements
astherearetokensintheparseroutput
expr
Incasewewanttorenderonlyoneexpressionandnotthefullparsetree,thisar-
gumentcanbeusedtospecifywhichexpressiontorender.Thedefault(NULL)
meansrenderallexpressions.Thisfeatureisusedbythesweavedrivershipped
withthispackage.SeeHighlightWeaveLatex
final.newline logical.Indicatesifanewlinecharacterisaddedafteralltokens.
showPrompts
ifTRUE,thehighlightedtextwillshowstandardandcontinueprompt
prompt
standardprompt
continue
continueprompt
initial.spaces shouldinitialspacesbedisplayedorskipped.
size
fontsize.onlyrespectedbythelatexrenderersofar.
show_line_numbers
logical.WhenTRUE,linenumbersareshownintheoutput.
...
additionalarguments,currentlyignored.
Value
Theresultingformattedtextisreturnedinvisibly.Itisalsowrittentotheoutputiftheoutputisnot
NULL