What does a red text-background mean in GitHub comparison view?

I created a pull request and was browsing through, the differences are shown with light red/green line-brackgrounds, but some text is bolded with a red text background…

Update: Image changed to show file with some highlighted comments and some not.
GitHub comparison view showing text with red background

  • How to set tab size for pager used in git diff?
  • Git apply doesn't create new files?
  • Get a cumulative git diffs for multiple non-consecutuve commits
  • git diff shows unicode symbols in angle brackets
  • git diff --word-diff gives wrong result
  • Diff between Simulink models .slx
  • What does this mean?

  • GitHub is not configuring XCode project
  • Is the branch after “origin” the local branch or the remote branch?
  • File and directory permissions on a cloned github repository
  • Efficiently Git clone of huge svn repository
  • Git pull/push error: RPC failed; result=22, HTTP code = 408
  • How to stop Google indexing my Github repository
  • One Solution collect form web for “What does a red text-background mean in GitHub comparison view?”

    The red background-color is definitely being caused by the error-highlighting feature of GitHub’s text editor/viewer. You can find the same behaviour occurring to an intended block comment in another JSON file on GitHub:

    Screenshot of syntax error highlighting in GitHub

    As for your comment about some illegal characters not being highlighted: I also found that certain JSON errors aren’t caught by GitHub’s syntax processor. See this gist as an example:

    Example of uncaught errors in syntax highlighting

    In this case, the text outside of the outermost object isn’t being highlighted. Whatever reason there is for this may be the same reason that errors aren’t being highlighted for you.

    You can test it out for yourself by copy-pasting your code into a new Gist. Note that the ACE Editor has its own highlighting feature that can highlight code as you type, but its processing rules seem to be a bit different from that of GitHub’s code viewer.

    Git Baby is a git and github fan, let's start git clone.