最佳答案
My code is syntactically correct
不,不是:JSON doesn't permit comments .
解决方法是使用 Linguist override通过添加 .gitattributes
file内容如下:
*.json linguist-language=JavaScript
这告诉 GitHub 将存储库中的 .json
文件视为完整的 JavaScript(当然,允许注释)而不是 JSON。
GitHub appears to cache Linguist highlighting data ,因此在新的突出显示出现之前,可能需要修改、提交和再次推送任何现有的 JSON 文件。
关于json - 为什么我的 GitHub 存储库中的代码是红色的以及如何禁用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48634211/