Skip to content

Commit

Permalink
Disable highlight.js for "text" language.
Browse files Browse the repository at this point in the history
highlight.js's auto-highlight is distracting for plain-text fenced blocks.

This change checks the specified language and skips auto-highlighting for
"text" language, similar to GFM.
  • Loading branch information
eskwayrd authored Nov 1, 2018
1 parent 5ec4354 commit d282cc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/server/static/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
})();

marked.setOptions({
highlight: function (code) {
highlight: function (code, lang) {
var i, len, line;
code = code.split('\n');
for(i = 0, len = code.length; i < len; i++) {
Expand All @@ -223,7 +223,7 @@
}
}
code = code.join('\n');
code = hljs.highlightAuto(code).value;
if (lang != 'text') code = hljs.highlightAuto(code).value;
return code.replace('code' + options.flagSign + 'code', options.aPoint);
},
renderer: options.renderer,
Expand Down

0 comments on commit d282cc9

Please sign in to comment.