Skip to content

GitHub code show whitespace

Rob Garrison edited this page Dec 22, 2017 · 47 revisions

A userscript that shows whitespace (space, tabs and carriage returns) in code blocks

  • All spaces and tabs are shown.
  • It works on repo file and diff-view pages, and gist pages.
  • A toggle button is added to each file block and allows you to enable or disable the whitespace view.
  • It does not interfere with the selection, copying & pasting of the code.
  • A CSS tab-size of 2 is set by this script. This will be overridden by GitHub-Dark tab settings.
  • This script is not fully compatible with the GitHub code folding userscript as they interfere with each other.
  • Click this link to install from GitHub; or, install from GreasyFork or OpenUserJS.

Screenshots

File view

Diff view

† A leading space, + or - is added to every line by GitHub. Use the GitHub remove diff signs script to remove them.

Change Log

Version 1.1.6 (12/17/2017)

  • Tooltips show below sticky header.

Version 1.1.5 (12/14/2017)

  • Add GM4 polyfill & update assets.

Version 1.1.3 – 1.1.4 (12/05/2017)

  • Use updated mutations script. Fixes issue #33.
  • Use smaller icon.

Version 1.1.1 – 1.1.2 (10/11/2017)

  • Hide leading space in diff. See issue #27.
  • Fix expanded & diff rows.

Version 1.1.0 (10/03/2017)

  • Fix weird alignment issues in markdown files. See issue #27.
  • Fix alignment for no-extension files. See issue #27.
  • Remove all tab-size adjustments.

Version 1.0.0 (10/01/2017)

Version 0.1.8 (9/22/2017)

  • Include trailing whitespace.

Version 0.1.7 (9/2/2017)

  • Properly add whitespace to all lines.

Version 0.1.6 (5/16/2017)

  • Change license to MIT.

Version 0.1.5 (4/21/2017)

  • Update mutation url.

Version 0.1.2 - 0.1.4 (4/13/2017)

  • Switch to using mutations.js.

Version 0.1.1 (3/27/2017)

  • Add to gist pages.

Version 0.1.0 (3/26/2017)

  • Initial commit
Clone this wiki locally