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

Syntax Highlighting in README.md seems not to work properly when coming from Bitbucket #1447

Closed
Moskito89 opened this issue Apr 29, 2024 · 4 comments

Comments

@Moskito89
Copy link

I assume that syntax highlighting in a README.md file seems not to work properly when the repository comes from Bitbucket.

Here are to libraries to compare:

In both of them, the PHP code has been written with three backticks, followed by php.

Strangely enough, the HTML of the rendered documents is different:

From GitHub:

<pre><span class="pl-ent">&lt;?php</span>
<span class="pl-k">use</span> <span class="pl-v">Solaris</span>\<span class="pl-v">MoonPhase</span>;
[…]
</pre>

From Bitbucket:

<pre><code class="language-php">&lt;?php
use BitAndBlack\SentenceConstruction;
[…]
</code></pre>

Has anyone an idea what happens here and why?

@glaubinix
Copy link
Contributor

Code syntax highlighting currently only works for GitHub repositories. For GitHub repositories, Packagist uses the GitHub API to fetch the rendered HTML of a readme file. For all other repositories a cebe/markdown is used to render the markdown as HTML which doesn't seem to support code syntax highlighting.

@Moskito89
Copy link
Author

Oh, interesting! Thanks for the explanation, @glaubinix! I thought we'd be using something like highlight.js here... What were the reasons against solving this on the front-end side?

@glaubinix
Copy link
Contributor

I don't know, but I would assume that the GitHub API call is convenient, covers >95% of installed packages without the need for an additional dependency. So far the lack of code syntax highlighting in other repositories probably just hasn't come up yet.

@Seldaek
Copy link
Member

Seldaek commented May 20, 2024

Yeah it just works and GitHub is almost 99% of packages, so not really worth the hassle to fix IMO. We have so many other things to do.

@Seldaek Seldaek closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
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

No branches or pull requests

3 participants