-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Fix docs syntax highlighting errors #50836
Fix docs syntax highlighting errors #50836
Conversation
Both Pygments PRs have been merged for the next release, i.e. once that happens, we can throw out some of the lexers. |
Once Pygments has been a released do we remove the file |
Personally, I think we need to evolve to an Ansible lexer that:
That said, I am quite happy with the progress we have made. Priority should be on easy selection of docsite version. It is the number one inconvenience for our users. It should not be that hard to do IMO. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@gundalow we can't remove it, since it contains the Ansible output lexer which isn't part of Pygments (yet). (For adding it to Pygments, I guess it needs to be more complete and better tested. Right now it's mostly good enough to run the output examples we have in the docs.) |
@dagwieers I didn't notice that it doesn't know about all the other boolean values. That's something easy to add, though! (I guess we should add all of them, for completeness, and try to get it into Pygments.) About |
@felixfontein I think the YAML lexer implements strict YAML 1.2, but we decided to allow both yes/no and true/false in documentation and examples. Adding all boolean values (i.e. on/off) is fine as well, since that's what Ansible does support anyway, but I doubt the strict YAML 1.2 is something they want to see changed. |
@felixfontein thanks for doing this work - it looks great. As a next step, I think we need to document which lexers are available and when to use them. But meanwhile I'm going to merge this fix. |
@acozine The plugin adds lexers |
@felixfontein I'm thinking we could add them to the style guide, under https://docs.ansible.com/ansible/devel/dev_guide/style_guide/index.html#restructuredtext-guidelines |
@felixfontein does |
@webknjaz parts of it definitely, for example |
Sweet! Do you think it'd be possible to only keep the customized parts and just depend on the rest maintained somewhere else and installed by Pip? |
Should I add a new enough pygments version to https://github.com/ansible/ansible/blob/devel/docs/docsite/requirements.txt ? Or where should I add that requirement? |
(FYI: the required patches so that the code is actually equivalent are in Pygments 2.4.0 and newer.) |
@felixfontein there's also a constraints file: https://github.com/ansible/ansible/blob/devel/test/runner/requirements/constraints.txt |
SUMMARY
This PR contains a couple of fixes of syntax highlighting errors reported in #50040. In most cases, the wrong lexer was used. Besides that, small problems with the Ansible output, YAML and Django lexers had to be fixed. I'll create upstream PRs for Pygments next.
Fixes #50040
CC @dagwieers @gundalow
ISSUE TYPE
COMPONENT NAME
docs