feat: 优化highlight行数显示

This commit is contained in:
neo 2019-11-19 14:41:33 +08:00
parent 1555c24441
commit 12f48a99ad
2 changed files with 10 additions and 1 deletions

View File

@ -8,11 +8,16 @@ importScripts('https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/
onmessage = function (event) {
var data = JSON.parse(event.data);
var result = self.hljs.highlight(data.lang, data.code);
try {
var result = self.hljs.highlight(data.lang, data.code);
} catch (e) {
var result = self.hljs.highlightAuto(data.code);
}
postMessage(JSON.stringify({
result: {
value: result.value,
language: result.language,
}, index: data.index
}));
};

View File

@ -194,6 +194,10 @@ table.hljs-ln,
border: none;
}
.hljs-ln td.hljs-ln-code:after {
content: " ";
}
td.hljs-ln-numbers {
-webkit-touch-callout: none;
-webkit-user-select: none;