优化 Mermaid 流程图的支持

This commit is contained in:
tianyaxiang 2025-02-02 18:33:08 +08:00
parent 0bce491e86
commit 57967258a9

View File

@ -119,10 +119,8 @@ export class MarkdownRenderer {
} }
const styleStr = cssPropertiesToString(style) const styleStr = cssPropertiesToString(style)
// Generate unique ID for the diagram // Remove the random ID generation since it's not needed
const id = `mermaid-${Math.random().toString(36).substring(2)}` // Return a simple div with the mermaid class and content
// Since we can't use async/await in the renderer, we'll return a div that will be rendered by client-side JavaScript
return `<div${styleStr ? ` style="${styleStr}"` : ''} class="mermaid">${token.text}</div>` return `<div${styleStr ? ` style="${styleStr}"` : ''} class="mermaid">${token.text}</div>`
} catch (error) { } catch (error) {
console.error('Mermaid rendering error:', error) console.error('Mermaid rendering error:', error)