steven-tey / novel

Notion-style WYSIWYG editor with AI-powered autocompletion.
https://novel.sh
Apache License 2.0
11.8k stars 980 forks source link

bug: codeblock-lowlight doesn't render in html output #394

Closed MODSetter closed 1 month ago

MODSetter commented 1 month ago

Provide environment information

System: OS: Windows 11 10.0.22631 CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor Memory: 4.96 GB / 15.92 GB Binaries: Node: 22.1.0 - C:\Program Files\nodejs\node.EXE npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD pnpm: 9.0.6 - C:\Program Files\nodejs\pnpm.CMD

Describe the bug

With recent codeblock-lowlight extension integration: https://github.com/steven-tey/novel/pull/375 it works perfectly in the editor but when I render the editor contents as HTML from (window.localStorage.getItem("html-content")), it changes the code content to plain html text.

Editor:

148836219-bbad8c30-318f-4d37-b748-c96b7b033bc4

When HTML rendered from from (window.localStorage.getItem("html-content")):

148836232-daf4c2ed-309c-4d34-a75c-c1658b0575c2

Link to reproduction

None

To reproduce

Just render the content from (window.localStorage.getItem("html-content")) using dangerouslySetInnerHTML like:

<div className="tiptap ProseMirror prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full"
dangerouslySetInnerHTML={{
__html: window.localStorage.getItem("html-content"),
}}
></div>

Additional information

I am working on its fix will raise PR soon.

MODSetter commented 1 month ago

Fixed