Add hljs class manually
This commit is contained in:
parent
73999bb782
commit
93721e7e98
1 changed files with 2 additions and 20 deletions
|
|
@ -109,13 +109,9 @@
|
||||||
result.value = mergeStreams(originalStream, nodeStream(resultNode), text);
|
result.value = mergeStreams(originalStream, nodeStream(resultNode), text);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildClassName(line.className, result.language)
|
$line.addClass("hljs");
|
||||||
.split(" ")
|
$line.addClass(result.language);
|
||||||
.map(function(className) {
|
|
||||||
$line.addClass(className);
|
|
||||||
});
|
|
||||||
$line.html(result.value);
|
$line.html(result.value);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -207,20 +203,6 @@
|
||||||
* Will be removed when this part of the API is exposed
|
* Will be removed when this part of the API is exposed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function buildClassName(prevClassName, language) {
|
|
||||||
var result = [prevClassName.trim()];
|
|
||||||
|
|
||||||
if (!prevClassName.match(/\bhljs\b/)) {
|
|
||||||
result.push('hljs');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prevClassName.indexOf(language) === -1) {
|
|
||||||
result.push(language);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.join(' ').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
|
|
||||||
function escape(value) {
|
function escape(value) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue