mirror of
https://github.com/typecho/plugins.git
synced 2024-12-21 20:40:08 +08:00
markdown: support plain (no highlight) code block
Sometimes we want no-highlight code blocks. For example, log files, languages highlight.js does not know. ``plain codeblock here won't get highlighted. `` You can use `text` or `txt`, too. Using `plain` and `text` as markup is inspired by [沙渺](http://segmentfault.com/q/1010000000354936)。
This commit is contained in:
parent
40941a9acc
commit
845138a8b8
@ -130,7 +130,9 @@ for (var i = 0; i < codes.length; i ++) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!!finalLang) {
|
||||
if (["plain", "text", "txt"].indexOf(lang) != -1) {
|
||||
code.className = code.className.replace(/ *\blang-(plain|text|txt)\b/ig, "no-highlight");
|
||||
} else if (!!finalLang) {
|
||||
var result = hljs.highlight(finalLang, code.textContent, true);
|
||||
code.innerHTML = result.value;
|
||||
highlighted = true;
|
||||
|
Loading…
Reference in New Issue
Block a user