Skip Navigation
Instance MethodMethod

highlight(_:)

Highlights Swift code and returns HTML with syntax highlighting spans.

func highlight(_ code: String) -> String

Parameters

code

The Swift code to highlight.

Return Value

HTML string with syntax highlighting applied.

Discussion

Like swift-docc-render, the rest of an import declaration’s line is plain text apart from comments, so imported module names are not coloured as types.