Refined-github: Option to show whitespace characters

Created on 7 Jul 2017  路  13Comments  路  Source: sindresorhus/refined-github


Issuehunt badges

It'd be nice if we could see whitespace characters like in an IDE/code editor so it's easier to see things like tabs vs spaces, trailing spaces, etc.




IssueHunt Summary

notlmn notlmn has been rewarded.

Backers (Total: $80.00)

- #2073 Add show-whitespaces features

Tips

IssueHunt has been backed by the following sponsors. Become a sponsor


Rewarded on Issuehunt Please! 鈾ワ笌 enhancement help wanted

Most helpful comment

BitBucket do this quite well with an option to show whitespace.
screenshot from 2017-10-20 08-41-30
Then you get to see faint dots like:
screenshot from 2017-10-20 08-41-44

All 13 comments

Would be super useful. I think we should just do it by default without an option. Diffs are all about seeing changes, and whitespace characters are part of that.

I'm not sure I want to see poor code whenever I browse.

However it does make sense in diffs and CodeMirror. Perhaps this can be achieved with a custom font.

Oh, I assumed this was about diffs only. I agree, only makes sense in diffs and CodeMirror.

Tabs in CodeMirror have their own element, however spaces don't :(

.cm-tab {
     background: url(tab-symbol.svg);
}

https://codemirror.net/demo/visibletabs.html

Related content around the web, unfortunately not very positive:

I created a font with fontello and:

  • the space works
  • the tab uses the space character instead of its dedicated character on Chrome
  • (gray) color can't be set via font
  • character width has to match the selected character width

screen shot 2017-08-24 at 19 23 37

In short: this has to be built in JS. If we can access CodeMirror's instance there's a plugin for that https://github.com/coderaiser/cm-show-invisibles

BitBucket do this quite well with an option to show whitespace.
screenshot from 2017-10-20 08-41-30
Then you get to see faint dots like:
screenshot from 2017-10-20 08-41-44

Where are you seeing that? I can't find it anywhere in my BB repos.

@bfred-it hmm it is on private BitBucket server (without addons) maybe BitBucket Cloud is different.

https://github.com/Mottie/GitHub-userscripts/wiki/GitHub-code-show-whitespace seems to work for me. Perhaps the author will let the plugin pull it in?

https://github.com/glebm/render-whitespace-on-github shows whitespace in file and diff view, but not in codemirror (afaik).

https://groups.google.com/forum/m/#!topic/codemirror/L2EJ8Bs3mGA seems to imply it can be done with their specialChars option. That in combination with the script I posted above would solve both, I think.

@issuehunt has funded $80.00 to this issue.


@sindresorhus has rewarded $72.00 to @notlmn. See it on IssueHunt

  • :moneybag: Total deposit: $80.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $8.00
Was this page helpful?
0 / 5 - 0 ratings