convert

Converts highlighted HTML to AnnotatedString using the provided color map.

The .hljs base rule's text color (if present in colorMap) is applied as an outer span covering the full string. This means callers can render the result with a plain Text() composable without needing to pass an explicit color - uncolored tokens inherit the theme's default text color rather than LocalContentColor.

Parameters

html

HTML fragment output from highlight.js (not a full document)

colorMap

Map of hljs class names to SpanStyle, from ThemeParser