Commit Graph

7 Commits

Author SHA1 Message Date
Sam Atkins
d3cb52dc3f LibWeb/HTML: Expose HTML syntax highlighter's token kinds
This will be used for outputting the highlighted document as HTML.

(cherry picked from commit a231435321b232d8873a65bd859152ce98e892a5)
2024-11-16 14:05:12 -05:00
Sam Atkins
73b2383313 LibWeb/HTML: Use unique offsets for nested highlighters' tokens
The code previously ensured that JS/CSS tokens did not share values with
the HTML tokens, but still let them share values with each other. The
numbers chosen (1000 and 2000) are somewhat arbitrary, but give us
plenty of room to avoid overlaps.

(cherry picked from commit 07f0d9209a49fa349ce3763dd7ab8835b78edf85)
2024-11-16 14:05:12 -05:00
Sam Atkins
487ed33e2e LibWeb/HTML: Remove unused SyntaxHighlighter fields
(cherry picked from commit 2b961f145c545ea34227227062171a1b99191e4b)
2024-11-16 14:05:12 -05:00
Kyle Lanmon
31290c8527 LibSyntax: Teach each highlighter about it's comment syntax 2022-11-27 18:28:43 -07:00
Ali Mohammad Pur
71b4433b0d LibWeb+LibSyntax: Implement nested syntax highlighters
And use them to highlight javascript in HTML source.
This commit also changes how TextDocumentSpan::data is interpreted,
as it used to be an opaque pointer, but everyone stuffed an enum value
inside it, which made the values not unique to each highlighter;
that field is now a u64 serial id.
The syntax highlighters don't need to change their ways of stuffing
token types into that field, but a highlighter that calls another
nested highlighter needs to register the nested types for use with
token pairs.
2021-06-07 14:45:49 +04:30
Max Wipfli
93d830b5cc LibWeb: Add debugging statements in SyntaxHighlighter
This also changes SyntaxHighlighter.{h,cpp} to use east const style.
2021-06-05 00:32:28 +04:30
Ali Mohammad Pur
97a230e4ef LibWeb: Add a super basic HTML syntax highlighter
This can currently highlight tag names and attribute names/values.
2021-05-20 22:06:45 +02:00