You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support language and diff highlighting together #2025
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
After investigating, this is about combining language-specific syntax highlighting with diff highlighting. Syntax highlighting is handled by github/linguist (step 3 of the rendering pipeline), not by this repository.
This repo (github/markup) only handles step 1: converting markup formats to raw HTML. Check out this part of the README for a fuller picture:
Please note that only the first step is covered by this gem — the rest happens on GitHub.com's backend.
Linguist is only responsible for providing the grammars used by the syntax highlighting engines (there are two; both are internal repos). The ability to specify two options in inline code blocks and have them used by the highlighting engine would need to be implemented in markup, like the suggestion box does (Linguist isn't responsible for that functionality).
Reopening this — I'm sorry for the runaround and for not understanding this better the first time. I know that's not a great experience and I'd like to get this back on track.
After digging into the code, the linguist maintainer's comment is right: this does start in github/markup.
Here's my understanding: in lib/github/markup/markdown.rb, CommonMarker is invoked with :GITHUB_PRE_LANG but without the full_info_string option. That means when you write ```diff js, CommonMarker outputs:
<prelang="diff"><code>...</code></pre>
The js token is discarded entirely at this stage — before the syntax highlighting engine ever sees it. CommonMarker already supports preserving it via full_info_string, which would output something like <pre lang="diff" data-meta="js"> — but we don't enable it.
A full implementation would also require the internal highlighting engine to recognize that preserved token and apply dual highlighting (language syntax + diff markers). The good news is that suggestion blocks in PR reviews already do exactly this — so the capability exists internally, it just isn't wired up for fenced code blocks.
Linguist doesn't need changes — it only provides grammars, and grammars for both diff and all supported languages already exist.
Sorry again for the misdirection. This is a valid feature request for this repo.
Reacted by Mr Beedell, Roke Julian Lockhart and H. Z. Sababa
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Activity
github-actions commentedon Mar 17, 2026
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
hb20007 commentedon Mar 17, 2026
Bump
zkoppert commentedon Apr 24, 2026
Thanks for the report.
After investigating, this is about combining language-specific syntax highlighting with diff highlighting. Syntax highlighting is handled by github/linguist (step 3 of the rendering pipeline), not by this repository.
This repo (
github/markup) only handles step 1: converting markup formats to raw HTML. Check out this part of the README for a fuller picture:For syntax highlighting and code block rendering feedback, GitHub's feedback discussions or the linguist repo would be better venues.
Closing as out of scope for this repository.
hb20007 commentedon Apr 24, 2026
@zkoppert According to a comment by the linguist repo maintainer,
zkoppert commentedon May 5, 2026
Reopening this — I'm sorry for the runaround and for not understanding this better the first time. I know that's not a great experience and I'd like to get this back on track.
After digging into the code, the linguist maintainer's comment is right: this does start in
github/markup.Here's my understanding: in
lib/github/markup/markdown.rb, CommonMarker is invoked with:GITHUB_PRE_LANGbut without thefull_info_stringoption. That means when you write```diff js, CommonMarker outputs:The
jstoken is discarded entirely at this stage — before the syntax highlighting engine ever sees it. CommonMarker already supports preserving it viafull_info_string, which would output something like<pre lang="diff" data-meta="js">— but we don't enable it.A full implementation would also require the internal highlighting engine to recognize that preserved token and apply dual highlighting (language syntax + diff markers). The good news is that
suggestionblocks in PR reviews already do exactly this — so the capability exists internally, it just isn't wired up for fenced code blocks.Linguist doesn't need changes — it only provides grammars, and grammars for both
diffand all supported languages already exist.Sorry again for the misdirection. This is a valid feature request for this repo.
beedell-roke commentedon May 22, 2026
talk.commonmark.org/t/4903/2would be useful to remediate, for the sake of allowing explicit sub-syntax specification in any potential implementation.github-actions commentedon Jul 22, 2026
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
hb20007 commentedon Jul 22, 2026
Still relevant
github-actions commentedon Sep 22, 2026
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Neirda24 commentedon Sep 22, 2026
still relevant. never mark it as stale