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

[Suggestion] Use a Commonmark parser for the rendering of readmes #989

Open
stof opened this issue Jan 16, 2019 · 3 comments
Open

[Suggestion] Use a Commonmark parser for the rendering of readmes #989

stof opened this issue Jan 16, 2019 · 3 comments

Comments

@stof
Copy link
Contributor

stof commented Jan 16, 2019

Currently, the rendering of readmes has 2 different paths:

  • using the Github rendered readme for github repos, which ensures that we get the same parsing than on Github (as Github is doing it)
  • rendering the markdown with cebe/markdown for other packages (as we don't have pre-rendered readme for them)

This suggestion is about replacing cebe/markdown for the second case.

Nowadays, most non-github repositories on packagist are probably Gitlab ones. And Gitlab's markdown is based on CommonMark (with a few extensions of their similar to the Github ones, see https://docs.gitlab.com/ee/user/markdown.html). And Bitbucket also uses CommonMark (https://confluence.atlassian.com/bitbucketserver/markdown-syntax-guide-776639995.html).
So using a CommonMark parser would probably be better for compatibility of the rendering. But cebe/markdown is not such a parser.

@stof
Copy link
Contributor Author

stof commented Jan 16, 2019

Another idea: make another special case for the rendering for Gitlab, as they now have an endpoint to render markdown: https://gitlab.com/gitlab-org/gitlab-ce/issues/24124#note_131775879

@Seldaek Seldaek added this to the nice-to-have milestone Jan 29, 2019
@stof
Copy link
Contributor Author

stof commented Feb 12, 2020

Note that the go-to commonmark parser for PHP is https://commonmark.thephpleague.com/

@colinodell
Copy link
Contributor

FYI league/commonmark now includes an extension which provides full GFM support: https://commonmark.thephpleague.com/1.3/extensions/github-flavored-markdown/

This 100% meets the GFM spec, meaning that what we render should be nearly identical. (The only difference is that Github's Markdown API has some extra post-processing in their HTML pipeline, to do things like render emoji)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants