Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark multiline HTML comments as such #1896

Closed
bjones1 opened this issue Sep 16, 2021 · 1 comment
Closed

Mark multiline HTML comments as such #1896

bjones1 opened this issue Sep 16, 2021 · 1 comment
Assignees
Labels
A-lexing area: changes to individual lexers
Milestone

Comments

@bjones1
Copy link

bjones1 commented Sep 16, 2021

Thanks for the great work on Pygments! I use it regularly and am amazed by the breadth of languages it supports.

The current HTML lexer marks HTML comment as the token.Comment class, instead of the more specific token.Comment.Multiline. It also pushes into a sub-state which marks various flavors of embedded comments as token.Comment as well.

Would it be possible to replace this line with (r'<!--(.|\n)*?-->', Comment.Multiline), to mark all HTML comments as multi-line? The comment sub-state seems (to me) mostly useless, since it seems to mark everything as a token.Comment. I assume it can be removed?

@bjones1
Copy link
Author

bjones1 commented Oct 14, 2021

The same is true of the XML lexer -- would you consider making the same changes?

@Anteru Anteru added the A-lexing area: changes to individual lexers label Oct 15, 2021
@Anteru Anteru self-assigned this Oct 15, 2021
@Anteru Anteru added this to the 2.11.0 milestone Nov 13, 2021
@Anteru Anteru closed this as completed in 337ddde Nov 13, 2021
hwayne pushed a commit to hwayne/pygments that referenced this issue Nov 29, 2021
Use a simpler expression to match comments in HTML/XML.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lexing area: changes to individual lexers
Projects
None yet
Development

No branches or pull requests

2 participants