Files
SeeMD/obj/code_highlight.o
NotAlexNoyleandClaude Opus 4.8 181cbf79b2 Add GitHub-style syntax highlighting to the code-block preview
The WebKit HTML preview previously rendered fenced code blocks
monochrome. Wire the existing tokenizer into the HTML renderer so code
blocks are highlighted like GitHub, and extend language coverage.

- markdown.c: accumulate each code block's text, tokenize it on block
  leave, and emit <span class="pl-*"> per token with HTML-escaped gaps
  and token text; unknown languages fall back to plain escaped text.
- Add GitHub Primer syntax colors (light/dark) for keywords, constants,
  strings, and comments.
- code_highlight.c: tokenize comments (//, /* */, #), which were
  previously skipped and left uncolored.
- Add languages: javascript, kotlin, and bash (aliases js, kt, sh,
  shell). Bash uses a dedicated scanner whose '#' comments are
  word-position aware so $#, x=$#, and a.com#frag are not comments.
- Create the code_comment tag so the source editor colors comments too.
- README: document the highlighted languages.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 15:20:50 -04:00

61 KiB