feat(markdown): add enhanced code blocks with syntax highlighting

- Add codeblock.go for custom Goldmark renderer
- Add code block header with language icon, filename, copy button
- Use Chroma for syntax highlighting with class-based output
- Add GenerateChromaCSS for theme CSS generation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Josh 2026-01-12 02:01:09 +02:00
parent 6e2959f619
commit 771ff7615a
4 changed files with 323 additions and 4 deletions

View file

@ -6,7 +6,6 @@ import (
"github.com/yuin/goldmark"
emoji "github.com/yuin/goldmark-emoji"
highlighting "github.com/yuin/goldmark-highlighting/v2"
"github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark/renderer/html"
@ -41,9 +40,7 @@ func getRenderer(codeTheme string) goldmark.Markdown {
extension.GFM,
extension.Typographer,
emoji.Emoji,
highlighting.NewHighlighting(
highlighting.WithStyle(codeTheme),
),
NewCodeBlockExtension(codeTheme),
),
goldmark.WithParserOptions(
parser.WithAutoHeadingID(),