mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
core: do not throw if language grammar is not found on export
This commit is contained in:
committed by
Abdullah Atta
parent
0cd1ce3431
commit
fb34dd2864
@@ -69,7 +69,9 @@ async function preprocessHTML(templateData) {
|
||||
const { loadLanguage } = hasRequire()
|
||||
? require("../../../../editor/languages/index.js")
|
||||
: await import("../../../../editor/languages/index.js");
|
||||
prismjs.register = () => {};
|
||||
prismjs.register = (syntax) => {
|
||||
if (typeof arg === "function") syntax(prismjs);
|
||||
};
|
||||
for (const codeblock of codeblocks) {
|
||||
const language = LANGUAGE_REGEX.exec(
|
||||
codeblock.parentElement.className
|
||||
@@ -78,6 +80,7 @@ async function preprocessHTML(templateData) {
|
||||
|
||||
const { default: grammar } = await loadLanguage(language);
|
||||
grammar(prismjs);
|
||||
if (!prismjs.languages[language]) continue;
|
||||
|
||||
codeblock.innerHTML = prismjs.highlight(
|
||||
codeblock.textContent,
|
||||
|
||||
Reference in New Issue
Block a user