Add pan/zoom controls to Mermaid diagrams#215
Add pan/zoom controls to Mermaid diagrams#215kabilar wants to merge 5 commits intobrain-bican:mainfrom
Conversation
Summary of ChangesHello @kabilar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience for documentation viewers by introducing interactive pan and zoom capabilities for Mermaid diagrams. This change directly addresses the readability issue of small text within complex diagrams, making visual information more accessible. The implementation involves configuring the MkDocs site and updating project dependencies to support the new functionality. Highlights
Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the issue of small text in Mermaid diagrams by adding pan and zoom controls, which is a great improvement for readability. However, a critical security vulnerability was identified in the mkdocs.yml file: the pymdownx.superfences configuration allows for arbitrary code execution, posing a significant risk to the build environment. To resolve this and complete the transition to native Mermaid support, please remove the insecure pymdownx.superfences configuration and the now-redundant mkdocs-mermaid2-plugin and its associated dependency.
| - pymdownx.superfences: | ||
| custom_fences: | ||
| - name: mermaid | ||
| class: mermaid | ||
| format: !!python/name:pymdownx.superfences.fence_code_format No newline at end of file |
There was a problem hiding this comment.
The use of !!python/name:pymdownx.superfences.fence_code_format introduces a critical security vulnerability. This YAML tag allows for arbitrary code execution when the mkdocs.yml file is parsed. An attacker with write permissions to this file could execute arbitrary commands on the documentation build server, potentially leading to a full compromise of the build environment. It is strongly recommended to remove this configuration and use a safer method for rendering Mermaid diagrams. MkDocs Material has native support for Mermaid, which should be preferred.
| - panzoom: | ||
| full_screen: true | ||
| always_show_hint: true | ||
| hint_location: "top" |
There was a problem hiding this comment.
This plugin is a great addition for large diagrams. On a related note, as you correctly pointed out in the PR description, the mermaid2 plugin on line 13 is now redundant because you've enabled native Mermaid support via markdown_extensions. I recommend removing - mermaid2 from the plugins list to simplify the configuration.
| "mkdocs-mermaid2-plugin", | ||
| "mkdocs-panzoom-plugin" |
|
@kabilar - since we use the linkml generated repo for this, should this be taken upstream? |
Hi @satra, that's fair but those docs don't seem to have any large ERDs, so this extra plugin may not be needed there. I might have missed it but they all seem to be pretty small. For example: https://linkml.io/linkml-model/latest/docs/specification/03schemas/#classdefinition-uml. |
Issue
Currently the text in the Mermaid diagrams is quite small (example below):

Changes
workflow_dispatchto trigger docs deployment manually.mermaid2plugin but I don't think we need it since mkdocs material natively supports Mermaid diagrams with themarkdown_extension. See reference.Preview: https://kabilar.github.io/bican-models/anatomical_structure/
cc @satra