public interface Highlighter extends SyntaxHighlighterAdapter
SyntaxHighlighterAdapter alone might only include the necessary stylesheets and
scripts to highlight the sources in the browser, a Highlighter can actually transform the
source to static HTML.
If a SyntaxHighlighterAdapter also implements this interface, the
method highlight(Block, String, String, Map) will be called for every source block.
This API is experimental and might change in an incompatible way in a minor version update!
| Modifier and Type | Method and Description |
|---|---|
HighlightResult |
highlight(Block node,
java.lang.String source,
java.lang.String lang,
java.util.Map<java.lang.String,java.lang.Object> options)
Highlights the source according to the language.
|
getDocinfo, hasDocInfoHighlightResult highlight(Block node, java.lang.String source, java.lang.String lang, java.util.Map<java.lang.String,java.lang.Object> options)
node - The node of the Asciidoctor AST that contains the source to be highlighted.source - The full content of the source block as one String.lang - The language that was associated with the source block, e.g. java or
ruby.options - A map containing options for conversion:
callouts((Map)options.get("callouts")).get(1L) will
return the List of callouts in the first line.
The value for each callout is a List with 2 elements:
The optional comment text before the callout, e.g. // ,
and the callout number, e.g "1".
"class" or
"inline"
"table" or "inline") (optional).HighlightResult containing the converted HTML as a String and optionally a
line offset.