Skip to content

fix: independant HTML implementation#194

Open
afu-dev wants to merge 6 commits intotempestphp:mainfrom
afu-dev:fix-xml-and-html-bugs
Open

fix: independant HTML implementation#194
afu-dev wants to merge 6 commits intotempestphp:mainfrom
afu-dev:fix-xml-and-html-bugs

Conversation

@afu-dev
Copy link
Contributor

@afu-dev afu-dev commented Feb 12, 2026

This PR fixes bugs with the XML implementation, regarding tags and attributes. It also add an independant interpreter for the HTML implementation.

Here's a before/after:

XML

image image

Note: tags, XML or HTML, cannot start with a digit or an hyphen.

HTML

image image

Notes:

Current known bugs / regressions

image image

Note: boolean attributes don't work (cannot work?) with the current regex implementation. Also if the string value contains an equal sign, the word before get highlighted (thanks to unquoted attributes).

@github-actions
Copy link

Benchmark Results

Comparison of fix-xml-and-html-bugs against main (34249c4c29c9a278f3e736c310a42da65d3af891).

Open to see the benchmark results
benchmark subject set revs its mem_peak mode rstdev
HighlighterBench benchParse blade 100 5 2.582mb +0.29% 1,065.465460μs -0.54% ±1.19% +57.45%
HighlighterBench benchParse css 100 5 2.032mb 0.00% 141.583249μs +0.01% ±0.63% -29.31%
HighlighterBench benchParse diff 100 5 2.031mb 0.00% 26.200607μs -1.16% ±1.41% +130.53%
HighlighterBench benchParse dockerfile 100 5 2.031mb 0.00% 82.178845μs -0.16% ±0.72% -27.47%
HighlighterBench benchParse dotenv 100 5 2.031mb 0.00% 76.981585μs -0.57% ±0.70% -22.64%
HighlighterBench benchParse ellison 100 5 2.090mb +0.03% 340.099550μs -1.73% ±0.46% -66.01%
HighlighterBench benchParse gdscript 100 5 2.084mb +0.03% 330.070528μs -2.12% ±1.68% +140.54%
HighlighterBench benchParse html 100 5 2.031mb 0.00% 117.923562μs +5.12% ±0.90% -28.74%
HighlighterBench benchParse ini 100 5 2.030mb 0.00% 86.629922μs -0.65% ±0.57% -31.40%
HighlighterBench benchParse javascript 100 5 2.072mb +0.03% 271.526967μs -0.51% ±1.12% +0.62%
HighlighterBench benchParse json 100 5 2.047mb +0.03% 238.553914μs -0.01% ±0.95% -5.58%
HighlighterBench benchParse markdown 100 5 2.031mb 0.00% 75.108689μs -1.29% ±1.17% +36.93%
HighlighterBench benchParse php 100 5 2.350mb +0.03% 744.396614μs -0.65% ±0.31% +6.48%
HighlighterBench benchParse python 100 5 2.248mb +0.03% 421.926536μs -0.44% ±0.43% -43.38%
HighlighterBench benchParse sql 100 5 2.030mb 0.00% 158.544873μs +0.12% ±0.40% -0.12%
HighlighterBench benchParse twig 100 5 19.118mb +0.04% 1,445.880411μs -0.33% ±0.35% -33.98%
HighlighterBench benchParse xml 100 5 2.037mb 0.00% 179.634168μs -0.02% ±0.25% -80.62%
HighlighterBench benchParse yaml 100 5 2.080mb +0.03% 320.130685μs -0.53% ±1.12% +109.99%

Generated by phpbench against commit bdf23d8

@coveralls
Copy link

Pull Request Test Coverage Report for Build 21951412065

Details

  • 13 of 13 (100.0%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 93.274%

Totals Coverage Status
Change from base Build 21943678429: 0.04%
Covered Lines: 1567
Relevant Lines: 1680

💛 - Coveralls

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.

HTML attributes not highlighted if unquoted

2 participants