File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
src/components/MarkdownPreview/plugins Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -78,11 +78,11 @@ export const mermaidPlugin = (md, options = {}) => {
7878 if ( cache . has ( hash ) ) {
7979 svg = cache . get ( hash )
8080 } else {
81- const { isValid } = await verifyMermaid ( content )
81+ // const { isValid } = await verifyMermaid(content)
8282
83- if ( ! isValid ) {
84- return
85- }
83+ // if (!isValid) {
84+ // return
85+ // }
8686
8787 // 使用唯一 ID 渲染(避免图表冲突)
8888 const { svg : renderedSvg } = await mermaid . render ( `mermaid-${ hash } ` , content )
@@ -120,22 +120,24 @@ export const mermaidPlugin = (md, options = {}) => {
120120 if ( container . dataset . mermaidStatus !== 'pending' ) {
121121 container . dataset . mermaidStatus = 'pending'
122122 }
123- renderMermaid ( container )
123+ nextTick ( ( ) => {
124+ renderMermaid ( container )
125+ } )
124126 } )
125127 }
126128
127129 // 初始化 Mermaid
128130 mermaid . initialize ( {
129131 startOnLoad : false ,
130- securityLevel : 'antiscript ' ,
132+ securityLevel : 'loose ' ,
131133 markdownAutoWrap : true ,
132134 suppressErrorRendering : true ,
133135 ...options
134136 } )
135137
136138 // 触发 Mermaid 图表渲染 export
137139 processMermaid . fn = ( ) => {
138- requestAnimationFrame ( processContainers )
140+ processContainers ( )
139141 }
140142}
141143
You can’t perform that action at this time.
0 commit comments