Skip to content
Discussion options

You must be logged in to vote

There's no per-element option for Show Invisibles like there is for Line Numbers, but you can get the same result with CSS alone.

The plugin works in two parts (plugins/show-invisibles/ on master, released as 1.30.0):

  1. JS: a before-highlight hook adds tab, cr, lf, crlf and space tokens to the grammar. The grammar is mutated once and shared, so every block in that language gets those <span class="token space"> etc. There's no per-element check in the JS.
  2. CSS: the visible glyphs (·, ⇥, ␊…) are only ::before pseudo-elements on those spans. The actual whitespace characters are untouched.

Because the display is pure CSS, you can make it opt-in per block by switching the pseudo-elements off ev…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by djbpitt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants