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

Make Python 3 the default lexer for highlighting Python code in Markdown #97

Merged
merged 2 commits into from
Apr 20, 2018

Conversation

theacodes
Copy link
Member

Fixes #96

@theacodes theacodes requested a review from di April 20, 2018 17:19
@di
Copy link
Member

di commented Apr 20, 2018

I'm not sure we want to introduce a shortname (python2) that doesn't actually exist in pygments. I'm also hesitant to add anything that produces inconsistencies between how these READMEs are rendered on PyPI and how they're rendered elsewhere (e.g. on Github), which is what will happen if folks use the python shortname with this PR.

Perhaps the original issue is actually invalid, and we should tell users that want to highlight Python 3 code that they should use the python3 shortname? I agree that python should probably map to the Python 3 lexer someday, but I'm not sure if it's for us to decide.

@theacodes
Copy link
Member Author

Yeah I'm hestant here, but I can think of some arguments in favor of doing this.

The biggest is that GitHub's highlighter defaults python to python3 for example this is just python after the code fence:

async def meep():
   pass

await meep()

Since the goal of supporting gfm is to be as close to github as possible, I am okay with us aliasing python to python3. Especially because without aliasing there's no way to get highlighting to work correctly for Python 3 code on both github and warehouse at the same time.

Whether or not we should allow python2 to work is another story. I wanted at least some sort of escape hatch in case some user really, really needed Python 2 highlighting mode. But, I'm happy to leave that out until someone asks for it.

@di
Copy link
Member

di commented Apr 20, 2018

Ah, I didn't realize GFM was already mapping python->python3. In that case, we probably should as well.

Copy link
Member

@di di left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ditch the python2 shortname.

@theacodes
Copy link
Member Author

Let's ditch the python2 shortname.

Done.

@theacodes theacodes merged commit de63706 into pypa:master Apr 20, 2018
@theacodes theacodes deleted the highlight-python-3 branch April 20, 2018 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants