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

Add a tooltips option to HtmlFormatter. #1822

merged 7 commits into from
Dec 28, 2021


Copy link

This pull requests adds an option tooltips to HtmlFormatter. When tooltips is true, the generated HTML includes a title attribute for each token <span> tag, that includes the token name.

This helps with developing and debugging styles.

Copy link

Anteru commented Jun 20, 2021

Thanks for the PR. This sounds like it's only useful for debugging, right? There's no reason to ever have that in production -- and I think that should be reflected in the name. Maybe debug_token_types instead of tooltips? It would be also good to mention this on the "how to write a style" page.

Copy link
Contributor Author

Yes, this is mostly useful for debugging and developing lexers and styles.

It is less useful on sites that simply use Pygments for syntax highlight. But it might be somewhat useful on the Pygments site itself.

I've updated the pull request to rename the option from tooltips to debug_token_types.

I've added a paragraph to lexerdevelopment.rst to explain the new debug_token_types option.

@Anteru Anteru added this to the 2.11.0 milestone Dec 28, 2021
@Anteru Anteru merged commit 34bf90d into pygments:master Dec 28, 2021
Copy link

Anteru commented Dec 28, 2021

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants