Skip to content

Commit

Permalink
Add support for the space character for the show-invisibles plugin
Browse files Browse the repository at this point in the history
This patch adds a bit of position magic, so that the invisibles
are displayed on top of the original character. This allows for
the inclusion of the space character.
  • Loading branch information
zeitgeist87 committed Feb 1, 2016
1 parent 5b9bf72 commit 05442d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
15 changes: 14 additions & 1 deletion plugins/show-invisibles/prism-show-invisibles.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
.token.tab:not(:empty),
.token.cr,
.token.lf,
.token.space {
position: relative;
}

.token.tab:not(:empty):before,
.token.cr:before,
.token.lf:before {
.token.lf:before,
.token.space:before {
color: hsl(24, 20%, 85%);
position: absolute;
}

.token.tab:not(:empty):before {
Expand All @@ -18,3 +27,7 @@
.token.lf:before {
content: '\240A';
}

.token.space:before {
content: '\00B7';
}
1 change: 1 addition & 0 deletions plugins/show-invisibles/prism-show-invisibles.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ Prism.hooks.add('before-highlight', function(env) {
tokens.crlf = /\r\n/g;
tokens.lf = /\n/g;
tokens.cr = /\r/g;
tokens.space = / /g;
});
})();
2 changes: 1 addition & 1 deletion plugins/show-invisibles/prism-show-invisibles.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 05442d3

Please sign in to comment.