Skip to content

feat(html): add source-range annotations - #1492

Draft
AnshulBhati01 wants to merge 1 commit into
alecthomas:masterfrom
AnshulBhati01:feat/html-source-annotations
Draft

AnshulBhati01 wants to merge 1 commit into
alecthomas:masterfrom
AnshulBhati01:feat/html-source-annotations

Conversation

@AnshulBhati01

@AnshulBhati01 AnshulBhati01 commented Nov 15, 2026 •

Copy link
Copy Markdown

Adds Formatter.FormatAnnotated for attaching IDs, classes and titles to source byte ranges in highlighted HTML. Ranges may cross token and line boundaries; invalid UTF-8 boundaries are rejected before writing output, and annotation metadata is escaped.

The renderer composes annotations with the existing inline, line-number and table layouts. Tests cover crossing and nested ranges, Unicode, escaping, invalid input, writer errors and formatter reuse.

Validation: go test ./formatters/html passes against current master; git diff --check is clean.

Draft for API review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant