-
Notifications
You must be signed in to change notification settings - Fork 7
feat: integrate Mermaid plugin with server-side rendering for ByteMD editor #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Co-authored-by: ruibaby <21301288+ruibaby@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
1 similar comment
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@copilot 能将 mermaid 渲染的结果保存吗?避免需要在文章页面再加载 mermaid 进行渲染。 |
目前 方案1:使用 rehype-mermaid 插件实现服务端预渲染
方案2:保持当前客户端渲染方式
请问您希望采用哪种方案?如果选择方案1,我可以添加 rehype-mermaid 来实现预渲染。 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot 方案一 |
Co-authored-by: ruibaby <21301288+ruibaby@users.noreply.github.com>
已实现方案一:使用 rehype-mermaid 进行服务端预渲染。 实现方案:
效果:
提交 hash: 6ce1472 |
Adds Mermaid diagram support to the ByteMD editor with server-side pre-rendering, enabling users to create flowcharts, sequence diagrams, and other Mermaid visualizations directly in markdown. Diagrams are pre-rendered to SVG during save, eliminating the need to load mermaid.js on article pages.
Changes
@bytemd/plugin-mermaid@^1.22.0dependency for editor UI features (toolbar, syntax highlighting)rehype-mermaid@^3.0.0dependency for server-side renderingpluginMermaidSSR()that uses rehype-mermaid with inline-svg strategyHow It Works
Usage