github / github/markup

Support language and diff highlighting together

未关闭
#2,025 8 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Ruby
星标
6k
派生
3.4k
PR 合并指标
30 天内没有已合并 PR

描述

Support for both language and diff highlighting together is a popular feature request, 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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。