rouge-ruby / rouge

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

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

Open justinbhopper opened 1 week ago

justinbhopper commented 1 week 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.