mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
Refactor code language and ts types (#9300)
* 🎨 Code block language list adds custom languages * Update index.d.ts * 🎨 Improve global variable type definition * 🎨 Improve global variable type definition * 🎨 Add constant `EXTRA_CODE_LANGUAGES`
This commit is contained in:
parent
17d2a16a94
commit
b2a27bb54c
16 changed files with 86 additions and 72 deletions
|
|
@ -66,7 +66,7 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =
|
|||
// bazaar readme
|
||||
language = block.className.replace("language-", "");
|
||||
}
|
||||
if (!hljs.getLanguage(language)) {
|
||||
if (!window.hljs.getLanguage(language)) {
|
||||
language = "plaintext";
|
||||
}
|
||||
block.classList.add("hljs");
|
||||
|
|
@ -110,7 +110,7 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =
|
|||
matchElement.scrollIntoView();
|
||||
}
|
||||
}
|
||||
block.innerHTML = hljs.highlight(
|
||||
block.innerHTML = window.hljs.highlight(
|
||||
block.textContent + (block.textContent.endsWith("\n") ? "" : "\n"), // https://github.com/siyuan-note/siyuan/issues/4609
|
||||
{
|
||||
language,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue