-
Notifications
You must be signed in to change notification settings - Fork 963
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 Pygments support #876
Comments
Hmm, we should already be doing this too. |
Yes, if you take a look at https://warehouse-staging.python.org/project/dstufft.cryptography/ it already has the classes there. It just needs styled. |
OK. So then, any code that is coming through without Pygments support (e.g. https://warehouse-staging.python.org/project/python-ldap-test/) is because the source file doesn't support it? Would it be worthwhile documenting how users should write their READMEs so that they get code highlighting on PyPI? ping @ddbeck |
Yea, they probably aren't instructing the rst renderer as to what language it is. Generally you want to do something like (taken from pyca/cryptography):
The name (like |
For my stuff on PyPI I've found that unrecognized languages also stop it from parsing. For example, with https://pypi.python.org/pypi/tox-travis, I have an example YAML file, and while GitHub recognized the rST, PyPI did not, and so assumed it was plain text. I had to remove the language specifier so PyPI would format it at all. |
@nlhkabu Sorry not getting to this quicker! I already had it in mind to briefly encourage readmes in the new tutorial about making packages, so I suppose the next step would be to provide guidelines on including a PyPI-friendly readme as well. I've opened a new issue for the idea. On another note, @ryanhiebert's report on unrecognized languages suggests that it would be nice if unrecognized lexers fell back to plain text rather than unformatted text. I'm not sure if that's something that would need to change in pygments or warehouse (or somewhere else) though. |
That'd be in https://github.com/pypa/readme probably. |
It would be great if code rendered in long descriptions could be syntax highlighted with a library like pygments.
I can handle the actual selection and application of colors in the CSS, if someone else is happy to integrate the library that applies the classes. Related #800.
The text was updated successfully, but these errors were encountered: