rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.35k stars 739 forks source link

JSX and TSX lexers treat custom HTML elements as invalid syntax #2056

Open justinbhopper opened 5 months ago

justinbhopper commented 5 months ago

Name of the lexer jsx and tsx

Code sample

<my-custom-element foo="bar">
  Hello world
</my-custom-element>

image

https://rouge.jneen.net/v4.3.0/tsx/Y29uc3QgSGVsbG9Xb3JsZCA9ICgpID0-IHsKICByZXR1cm4gKAogICAgPG15LWN1c3RvbS1lbGVtZW50IGZvbz0iYmFyIj4KICAgICAgSGVsbG8gd29ybGQKICAgIDwvbXktY3VzdG9tLWVsZW1lbnQ-CiAgKTsKfQo

Additional context The hyphen in custom elements are treated as invalid syntax in JSX/TSX lexers. Custom HTML elements require a hyphen.

Surprisingly, the html lexer does not have this issue.