# Support syntax highlighting for two languages in a small number of cases

**URL:** <https://talk.commonmark.org/t/support-syntax-highlighting-for-two-languages-in-a-small-number-of-cases/4903>\
**Category:** Spec\
**Created:** [February 13, 2025, 12:36am UTC](https://talk.commonmark.org/t/support-syntax-highlighting-for-two-languages-in-a-small-number-of-cases/4903 "2025-02-13T00:36:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sedyh](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/sedyh/32/3092_2.png) [@sedyh](https://talk.commonmark.org/u/sedyh)\
**Post date:** [February 13, 2025, 12:36am UTC](https://talk.commonmark.org/t/support-syntax-highlighting-for-two-languages-in-a-small-number-of-cases/4903/1 "2025-02-13T00:36:35Z")

</div>

Hello. I’ve encountered that it can be very useful to enable simultaneous syntax highlighting for some exceptional cases. However, we are not talking about complex scenarios like nested language constructs, but about showing diff and patch changes alongside with the default language. This is a fairly universal highlight that colors the entire background of some lines. Is it possible to allow the combination of languages ​​in code blocks when this mode comes first?

I.e. I suggest to allow this syntax:

````auto
```diff go
+ func NewGame() *Game {
- return &Game{
      ui: &ebitenui.UI{},
    }
  }
```

````

---

<div class="post-metadata">

**Author:** ![rokejulianlockhart](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/rokejulianlockhart/32/3399_2.png) [@rokejulianlockhart](https://talk.commonmark.org/u/rokejulianlockhart)\
**Post date:** [May 22, 2026, 4:32pm UTC](https://talk.commonmark.org/t/support-syntax-highlighting-for-two-languages-in-a-small-number-of-cases/4903/2 "2026-05-22T16:32:26Z")

</div>

@sedyh, this would be a simple way to implement the undermentioned:

> [@Code Blocks Extension for filenames and line numbers](https://talk.commonmark.org/t/code-blocks-extension-for-filenames-and-line-numbers/536/1):
>
> ```markdown
> ~~~CPP file.CPP:100
> int main() {
> return 0;
> }
> ~~~
> 
> ```

Additionally, it allow certain common downstream uses to be standardised:

> <https://github.com/github/markup/issues/2025#issue-3817470402>
>
> Support for both language and diff highlighting together is a popular feature re…quest, as can be seen from the discussion https://github.com/github-linguist/linguist/discussions/5758 on the Linguist repo and \[this Stack Overflow question\](https://stackoverflow.com/questions/40883421/diff-syntax-highlighting-in-github-markdown).
> 
> This feature has already been implemented on other markdown-powered sites. The most straightforward syntax would be:
> 
> \`\`\`diff
> ՝՝՝diff js
> let fileIcon = document.querySelector("li.file-entry \> span.icon");
> +fileIcon.classList.remove("icon-file-text");
> const disposable = addIconToElement(fileIcon, "/path/to/file.txt");
> ՝՝՝
> \`\`\`
> 
> Currently, this ignores the “js” part and only applies the “diff” syntax highlighting.
