Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix: handle highlight unknown language error
Stevencc759bef5601
diff --git a/web/src/labs/marked/parser/CodeBlock.ts b/web/src/labs/marked/parser/CodeBlock.tsindex ca5afb3a8..52e945401 100644--- a/web/src/labs/marked/parser/CodeBlock.ts+++ b/web/src/labs/marked/parser/CodeBlock.ts@@ -10,11 +10,18 @@ const renderer = (rawStr: string): string => {}const language = escape(matchResult[1]) || "plaintext";- const highlightedCodes = hljs.highlight(matchResult[2], {- language,- }).value;+ let highlightedCode = hljs.highlightAuto(matchResult[2]).value;- return `<pre><code class="language-${language}">${highlightedCodes}</code></pre>${matchResult[3]}`;+ try {+ const temp = hljs.highlight(matchResult[2], {+ language,+ }).value;+ highlightedCode = temp;+ } catch (error) {+ // do nth+ }++ return `<pre><code class="language-${language}">${highlightedCode}</code></pre>${matchResult[3]}`;};export default {