-
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
Render Markdown using GitHub rendering engine #16466
Comments
This seems more like an issue with the font used rather than with the rendering engine? FWIW, this is what it looks like on PyPI in my browser:
This is a duplicate of pypa/readme_renderer#169, there are more details there.
We basically use a rendering engine that's as close as possible to GitHub's: |
Is it the CSS styling then that two different fonts are used between GitHub and PyPi? |
Here's a clue as to the difference in styling: PyPi website normally: If I uncheck the By contrast, here's GitHub font style for I remain stumped why a font named "Source Code Pro" would not be a fixed-width font, but anyway it seems worth avoiding since one almost always wants fixed-width font for backtick Markdown environments. |
Something to consider: we use Google Fonts' implementation of Source Code Pro, see https://github.com/google/fonts/blob/43405b42bd150c0a667f82c53eeb226e5d789926/ofl/sourcecodepro/METADATA.pb Looks like you could submit a font upgrade to that repo - https://googlefonts.github.io/gf-guide/onboarding.html#font-upgrades |
I could also be convinced to adopt a different monospace font if Source Code Pro isn't the most ideal one for us to use here as well. |
I don't know much about fonts or styling, but here's a clue. If I go here and type the table
into the normal text, it cannot render any of the frame symbols: Those frame symbols are non-ASCII Unicode variants of dashes and so forth. So perhaps the issue is that Source Code Pro does not support non-ASCII Unicode? That also seems unimaginable in 2024. But if it's true, perhaps the browser tries to style individual symbols at a time, instead of whole HTML elements (I don't know, I always assumed it would always use a single font for one HTML element), and then what's happening is that it applies Source Code Pro to the ASCII symbols, but switches to monospace for the non-ASCII symbols that Source Code Pro cannot handle, and then Source Code Pro and monospace use slightly different widths from each other. |
I tinkered with another monospace font today - specifically GitHub Next's Monaspace Neon, and it looks even further emphasized, making me think that the underlying data has spacing in it that it shouldn't? It looks like the project in question uses |
The format I used to generate the table in previous comments is Most of the table formats on the tabulate PyPi page look off in my browser (I suspect the ones using non-ASCII symbols): When I remove |
Blocked on google/fonts#8030 |
Describe the bug
By default, both Github and PyPi show the README.md page as the "home" page. Many things render differently between them, forcing me to put a disclaimer "This document is intended to be read on github. Some of what appears below does not render properly on other websites such as pypi.org.". I show a couple of examples.
Expected behavior
This table renders nicely on Github when put in backtick quotes, as you can see since you are reading this on the Github site:
However, the length of the horizontal dash characters is not equal to others in the rendering engine used on PyPi, leading the above table to look bad. I don't have an example of that particular table, but look at the tables here: https://pypi.org/project/aggie-unterprise/
The top table on that page looks nice because it is rendered as a Markdown table. But the tables below it are put in backticks, and note how on PyPi they render poorly due to the shortened dashes in the first, third, and final lines of text:
compared to how it looks on Github:
Another example is that on Github, you can link to sections using the section name. For example, I have a table of contents here: https://github.com/dave-doty/aggie-unterprise that does not work here: https://pypi.org/project/aggie-unterprise/
To Reproduce
There's many examples of this, but they would all be solved if PyPi used the same Markdown rendering engine as GitHub (or maybe they do but have CSS styling slightly different or something). For a concrete example of how to reproduce, make a Github repo with a README.md file containing either use the tables above in backticks to see the difference, or create a table of contents like this:
then publish that as a Python package on PyPi.org. Note how the relative links created when rendering the table of contants work on GitHub but not on PyPi.
My Platform
Chrome and Firefox both have this behavior.
Additional context
None
The text was updated successfully, but these errors were encountered: