Skip to content

Instantly share code, notes, and snippets.

@tamizhvendan
Created July 6, 2019 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamizhvendan/7218386b956e83c0233bdfc4b6367513 to your computer and use it in GitHub Desktop.
Save tamizhvendan/7218386b956e83c0233bdfc4b6367513 to your computer and use it in GitHub Desktop.
PrismJs Rainbow Parentheses Extension
var level = 0
Prism.hooks.add('wrap', function (env) {
if (env.language == "clojure" && env.type == "punctuation") {
if (env.content == "(" || env.content == "[" || env.content == "{") {
level++;
env.classes.push("rbl" + level);
}
if (env.content == ")" || env.content == "]" || env.content == "}") {
env.classes.push("rbl" + level);
level--;
}
}
});
.rbl1 {
color: #ccc !important;
}
.rbl2 {
color: #0098e6 !important;
}
.rbl3 {
color: #e16d6d !important;
}
.rbl4 {
color: #3fa455 !important;
}
.rbl5 {
color: #c968e6 !important;
}
.rbl6 {
color: #999 !important;
}
@tamizhvendan
Copy link
Author

Sample output from my Clojure blog posts

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment