-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add diagram/code toggles for Mermaid blocks #7
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
Conversation
Summary of ChangesHello @harley, 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 improves the user experience for Mermaid diagrams by implementing a toggle mechanism that allows users to easily switch between the visual diagram and its source code. This feature includes state persistence for the selected view and is supported by comprehensive unit and end-to-end tests to ensure reliability and correct behavior. Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a useful feature for toggling between the rendered Mermaid diagram and its source code. The implementation is solid, with good use of data attributes for state management and updates to both unit and end-to-end tests to cover the new functionality. I've identified a couple of areas for improvement: one is a bug in error handling where an error message might not be visible to the user, and another is an opportunity to clean up some leftover code from a removed feature. I've also suggested a minor refactoring for conciseness. Overall, great work on this enhancement.
- Create separate tsconfig.build.json that excludes test files from build - Update build script to use build-specific TypeScript configuration - Add CSS handling configuration to vitest.config.ts - Fix ES module __dirname issues in Playwright configs - Update e2e test script to use correct Playwright config path - Add test-results/ directory to gitignore This resolves the syntax error when running 'pnpm test:e2e' that was caused by the build process trying to compile CSS files as JavaScript.
When Mermaid rendering fails, the error message is displayed in the diagram pane. Previously, if the user had selected 'code' view, they wouldn't see the error message. Now the view is always switched to 'diagram' on rendering errors to ensure users are notified of failures, improving the user experience.
- Rename updateCollapsedState() to updatePaneVisibility() - Remove unused collapse logic and isCollapsed checks - Simplify pane visibility logic to only handle diagram/code toggle - Improve code maintainability by removing dead code paths The collapse functionality was removed, making the collapse-related logic unnecessary. This cleanup makes the code more readable and focused on its actual purpose.
🤖 I have created a release *beep* *boop* --- ## [1.1.0](v1.0.0...v1.1.0) (2025-09-29) ### Features * Add copy-to-clipboard fix prompt to Mermaid error notice ([#2](#2)) ([7fb5785](7fb5785)) * add diagram/code toggles for Mermaid blocks ([#7](#7)) ([90c460f](90c460f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
Testing
pnpm testpnpm test:e2e(fails: Playwright build step hits existing CSS/module resolution issues)https://chatgpt.com/codex/tasks/task_b_68da27a8233c832bb3261ec43683ad71