highlightAuto

Highlights code with Highlight.js automatic language detection.

This is convenient when the language is not known ahead of time, but it is typically slower and less accurate than passing an explicit language to highlight.

engine.highlightAuto(code, theme).onSuccess { result ->
println("Detected: ${'$'}{result.detectedLanguage}")
render(result.annotated)
}

Return

Result wrapping an AutoHighlightResult, or Result.failure with a HighlightException on error.

Parameters

code

The source code to highlight.

theme

The HighlightTheme whose colour map will be applied.