# deft/syntax-highlight
Tokenize a Deft source string and return highlighted HTML wrapped as
`%__HtmlSafe{:value "<spans>"}`. Each token whose type has a class is
wrapped in `<span class="<tailwind-class>">…</span>`; lex failures fall
back to plain HTML-escaped text.
## Syntax
[deft/syntax-highlight $source]
## Parameters
- `$source` — Deft source text (string)
## Examples
[type [deft/syntax-highlight "set x 42"]] # → __HtmlSafe [get [deft/syntax-highlight "set x 42"] :value] # → "<span class=\"text-cyan-400\">set</span> x <span class=\"text-amber-400\">42</span>"
## Returns
`%__HtmlSafe{ :value "<html>" }`; the value is HTML-escaped (`& < > " '`)
and every token is emitted, so it round-trips as rendered source. Classes:
keywords/builtins `text-cyan-400`, variables `text-purple-400`,
numbers/booleans/nil `text-amber-400`, strings and keywords `text-green-400`,
comments `text-zinc-500`. Interpolated block openers/closers (`[html …`,
`\html]`, `[*codeblock …`) and shell-exec spans (`[| … ]`) are re-emitted
verbatim.
## See Also
`deft/parse`, `deft/parse-forms`, `deft/stringify`, `codeblock`, `html`