how to visualize whitespace?

hey guys, i was wondering how to visualize whitespace in codemirror 6.
i would like space to show as dots and tabs as little arrows like it is in vscode.
any help will be much appreciated, thank you :slight_smile:

1 Like

It seems like highlightWhitespace might help here.

1 Like

thank you so much marijn, that’s exactly what i was looking for. can’t believe i didn’t see that one before.

one minor thing i would change is to hide whitespace between words, but that i can probably do on my own now with your code as a basis.

thanks again!

Hi marijn, I search around but do not find any example of how to use highlighWhitespace, do you mind sharing me a snippet so I could use as reference? Currently I am using fromTextArea for creating a codemirror editor. Great thanks!

That suggests you’re using version 5. highlightWhitespace is part of version 6 (which has an entirely new, incompatible API).

Yeah I am using version 5 now so I do not understand how to use it with the doc of version 6. :joy: But thanks again! :grinning: