MCPcopy Create free account
hub / github.com/TruthHun/BookStack / doHightlight

Function doHightlight

static/wangEditor/js/wangEditor.js:6092–6104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6090 var lang = $langSelect ? $langSelect.val() : ''; // 获取高亮语言
6091 var langClass = '';
6092 var doHightlight = function () {
6093 $txt.find('pre code').each(function (i, block) {
6094 var $block = $(block);
6095 if ($block.attr('codemark')) {
6096 // 有 codemark 标记的代码块,就不再重新格式化了
6097 return;
6098 } else if (window.hljs) {
6099 // 新代码块,格式化之后,立即标记 codemark
6100 window.hljs.highlightBlock(block);
6101 $block.attr('codemark', '1');
6102 }
6103 });
6104 };
6105
6106 // 语言高亮样式
6107 if (lang) {

Callers 1

callbackFunction · 0.85

Calls 1

$Function · 0.50

Tested by

no test coverage detected