-
Notifications
You must be signed in to change notification settings - Fork 34
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
supporting GitHub-flavored Markdown as Description-Content-Type #126
Comments
Should be specified as a
|
Would require implementation in https://github.com/pypa/readme_renderer and https://github.com/pypa/warehouse with documentation in the specifications at https://github.com/pypa/python-packaging-user-guide Specific lines of code/places this would need to touch: readme_renderer: https://github.com/pypa/readme_renderer/blob/ecfc0a163b2965dcfaafaae3757cdb0c60233fcb/readme_renderer/markdown.py#L21-L23 |
I'm trying to hunt down a good candidate for the gfm markdown renderer. GitHub uses https://github.com/github/markup to determine which renderer to use. For There is a set of Python bindings for the upstream cmark available over at https://pypi.python.org/pypi/paka.cmark. It should be (relatively) easy to fork/extend that to use GitHub's fork. There's a lot of other options but few are well maintained or promise as much compatibility. |
To make my last comment actionable:
|
A little more research: cmark is actually fairly easy to wrap if we don't need any of the AST / Node functionality. |
Any reason to avoid https://pypi.org/project/Markdown/? It seems to be fairly extensible and and would be straightforward to keep in sync with various variants. I haven’t dug deeply into the codebase but have used it with great success for other projects. Biggest risk I see is any potentially nasty attack vectors brought on by executing the rendering code. New infra makes spinning a task like that out into its own service fairly straightforward, but I’m unsure of the trade off in complicating things. |
Mostly just that if we're going to say we support "GitHub Flavored Markdown", I would ideally want to use the exact same renderer. Of course, that's not my decision to make, but wrapping a small C library to ensure the exact same semantics seems better than having to bend another implementation our will. Happy to be convinced otherwise. |
This may not be the last request for a specific flavor of Markdown, as the specifications are poor and everyone seems to do it differently. I don’t think we can sanely meet the same standard of shipping the reference implementation for every variant, so an extensibile Markdown renderer we can iterate/tune for each flavor is my preference. |
This is exactly my argument in favor of using the reference implementations. In fact, if we use github's fork of cmark we can actually use that for both CommonMark and gfm. Considering these two variants are by far the most common, I think we could potentially draw the line there. |
You make a sound point. I’m absolutely good with this approach, but would love to hear others input, particularly @di, having done most of the prior art in the space for Warehouse/PEP 566 |
From a portability perspective, the main tool where we want to avoid introducing a C dependency is However, I don't see a problem with adding a C extension dependency for publishing tools or index servers (especially if that extension wraps a C library that is amenable to static linking). |
Cool, yeah, this wouldn't require I've got a proof of concept working already using github's fork (rendering CommonMark), I'm going to try to get it uploaded to github tonight (as soon as I can get the extensions API working and render GFM). |
Alright: https://pypi.org/project/cmarkgfm/ and https://github.com/jonparrott/cmarkgfm are up - feel free to test it out and see if it's worth continuing to pursue. Couple of notes:
|
C dependency for |
Given how many folks will probably want GFM over CommonMark, I wonder if we should make that the default variant. |
From pypa/readme_renderer#67 (comment) @di:
We need to change this to accept the "gfm" variant in addition to the "CommonMark" variant. |
@jonparrott Ah yup, good catch, forgot that we were validating the variant as well. |
@ewdurbin caught it, not me. :) |
Okay, it seems all the pieces of the puzzle are in place for this:
Once those are done (and warehouse is deployed):
|
This is done. @brainwane we're good to close this! |
GFM is now fully deployed as the default variant. Thanks @jonparrott! |
@jonparrott I nominate you -- take a victory lap! :) |
Some users would like PyPI to support READMEs (
long_description
s) written in GitHub-flavored Markdown as adescription_content_type
. Right now we only support CommonMark. Implementing this may span readme_renderer and other projects, so I'm putting it in this repo for discussion and sorting out next steps.Followup to #46.
Ref:
The text was updated successfully, but these errors were encountered: