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

Is There Any Way to Disable Error Highlighting in Github?

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

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

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

更新:pchaigno points out the section 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 突出显示,您可以尝试使用我在“

中建议的类似解决方法

尝试在同一行中添加带有“%”的注释,以便词法分析器(由语法高亮引擎 Rouge and Pygment 使用)不传播 "error" 到所有后续行。

为了完成 VonC 的回答,如果您认为突出显示不正确,您实际上可以提交错误报告甚至修复它; github.com 使用的所有语法都是开源的!

如何查找语法?要查找您的案例中用于语法高亮的语法,您可以访问this page on the Linguist project. In front of each language (looks like C in your case), you'll find the repository where the grammar for that language lives (for C, github.com/textmate/c.tmbundle)。你可以在那里打开一个关于你失败的测试用例的问题,或者更好的是,尝试自己修复它。