github - 有什么方法可以禁用 Github 中的错误突出显示吗?

标签 github github-linguist

Github 将此行中的第二个 % 突出显示为错误:

fscanf(fp, "%d%*[^\n]\n", &ints[i]);

但是,代码可以完美编译,删除“错误”将导致程序无法正常运行。
有什么方法可以禁用此错误突出显示或让 Github 将其识别为正确的吗?

最佳答案

更新:pchaigno指出in the comments本节linguist#Overrides ,您可以在其中使用例如 .gitattributes:

Add a .gitattributes file to your project and use standard git-style path matchers for the files you want to override to set linguist-documentation, linguist-language, linguist-vendored, and linguist-generated. .gitattributes will be used to determine language statistics and will be used to syntax highlight files. You can also manually set syntax highlighting using Vim or Emacs modelines.

$ cat .gitattributes
*.rb linguist-language=Java

2017 年 1 月的原始答案

由于您无法轻松删除 GitHub 突出显示,您可以尝试使用我在“How to fix/ignore syntax error in github”中建议的类似解决方法

尝试在同一行中添加一个带有 '%' 的注释,以便词法分析器(由语法高亮引擎 RougePygment 使用)不传播所有后续行的“错误”。

关于github - 有什么方法可以禁用 Github 中的错误突出显示吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41604413/

相关文章:

git - 如何在 pull 之前检查本地和 GitHub 存储库之间的差异

Github Repo 未显示语言栏以及最常用的语言

python - 如何加快从 python 重复调用 ruby​​ 程序(github 的语言学家)的速度?

GitHub 将存储库更改为错误的语言

git - 是否可以在 GitHub 存储库上定义自己的语法?

javascript - 当提交到 GitHub 时,像 jQuery 这样的第三方库应该存储在哪里才不会影响语言统计数据?

github protected 分支机构不提供任何真正的安全性

git - 恢复 git push

gitignore - 忽略文件夹中生成的文件,但不忽略文件夹

git - 根据文件夹设置git凭据