feat: mermaid diagram integration (#202)

This commit is contained in:
Philip Okugbe
2024-08-24 18:30:07 +01:00
committed by GitHub
parent 17475bf123
commit 7e80797e3f
10 changed files with 733 additions and 17 deletions

View File

@ -0,0 +1,25 @@
import CodeBlockLowlight, {
CodeBlockLowlightOptions,
} from "@tiptap/extension-code-block-lowlight";
import { ReactNodeViewRenderer } from "@tiptap/react";
export interface CustomCodeBlockOptions extends CodeBlockLowlightOptions {
view: any;
}
export const CustomCodeBlock = CodeBlockLowlight.extend<CustomCodeBlockOptions>(
{
selectable: true,
addOptions() {
return {
...this.parent?.(),
view: null,
};
},
addNodeView() {
return ReactNodeViewRenderer(this.options.view);
},
},
);