为什么 GitHub 不喜欢 % 字符?

Why doesn't GitHub like the % character?

我有一个包含多个 C 源文件的 GitHub 存储库。 (除非绝对必要,否则我不会分享 link,这样我就不会被指责为做广告。)C 文件中 % 字符的每个实例都以红色突出显示:

我是否在 C 语言中遗漏了一些有关 % 的内容,这是一个错误,还是故意的?

我发现 this discussion 有一个合理的解释。这里我引用:

It's highlighting the % because it's assuming that you're making a printf format string, and that you've made it wrong. Unfortunately there's no way to tell it it's not a printf format string short of changing the syntax file.

GitHub 使用 linguist 来检测语言,可以在那里找到一些突出显示的问题(即使它不直接涉及语言检测模块)

参见 issue 2839 其中确实提到了

We use open source TextMate-style language grammars for syntax highlighting, which are available here:
https://github.com/github/linguist/blob/master/grammars.yml
Linguist pulls in grammar updates with each new release, which usually happens every couple of weeks.

对于 C,是 textmate/c.tmbundle, which had a percent-related highlighting issue before (issue 28):您可能需要在那里打开一个新问题。