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
feat: enable iframe rendering in markdown code block (#2799)
Mark Zhaobd1cf627618a
diff --git a/web/src/components/MemoContent/CodeBlock.tsx b/web/src/components/MemoContent/CodeBlock.tsxindex 16f8fd930..4254b8ab9 100644--- a/web/src/components/MemoContent/CodeBlock.tsx+++ b/web/src/components/MemoContent/CodeBlock.tsx@@ -15,6 +15,16 @@ const CodeBlock: React.FC<Props> = ({ language, content }: Props) => {const formatedLanguage = language.toLowerCase() || "plaintext";let highlightedCode = hljs.highlightAuto(content).value;+ // Users can set Markdown code blocks as 'iframe'+ // to embed videos or external audio links from services like Apple Music or Spotify.+ if (formatedLanguage === "iframe") {+ const renderHTML = () => {+ return { __html: content };+ };++ return <div className="mx-auto w-11/12 !my-4" dangerouslySetInnerHTML={renderHTML()} />;+ }+try {const temp = hljs.highlight(content, {language: formatedLanguage,