mirror of
https://github.com/heyman/heynote.git
synced 2024-11-21 23:43:22 +01:00
8d8f6cdcb3
Remove Lezer support
34 lines
713 B
JavaScript
34 lines
713 B
JavaScript
importScripts("highlight.min.js")
|
|
|
|
const HIGHLIGHTJS_LANGUAGES = [
|
|
"json",
|
|
"python",
|
|
"javascript",
|
|
"html",
|
|
"sql",
|
|
"java",
|
|
"plaintext",
|
|
"cpp",
|
|
"php",
|
|
"css",
|
|
"markdown",
|
|
"xml",
|
|
"rust",
|
|
]
|
|
|
|
onmessage = (event) => {
|
|
//console.log("worker received message:", event.data)
|
|
//importScripts("../../lib/highlight.min.js")
|
|
|
|
const result = self.hljs.highlightAuto(event.data.content, HIGHLIGHTJS_LANGUAGES);
|
|
postMessage({
|
|
highlightjs: {
|
|
language: result.language,
|
|
relevance: result.relevance,
|
|
illegal: result.illegal,
|
|
},
|
|
content: event.data.content,
|
|
idx: event.data.idx,
|
|
})
|
|
}
|