Repository navigation
feat(chat): render bounded Mermaid diagrams with source fallback - #786
Closed
kilhyeonjun wants to merge 1 commit into
Closed
kilhyeonjun wants to merge 1 commit into
kilhyeonjun wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Owner
|
Thanks for this. Mermaid diagrams in chat are already under review in #616, which the maintainer has reviewed, and as the description says, this PR is a focused alternative to it. Closing as a duplicate to keep the work in one place. If the bounded rendering here (size limits, source fallback, the refused config/HTML input) covers cases #616 misses, a comment on #616 with those cases would be very welcome. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Completed Mermaid fences in chat can show a diagram, with Source/Diagram tabs, original-source copy and a native expanded dialog with zoom and fit. Streaming, malformed, unsupported, oversized or unavailable diagrams retain the existing code view. Ordinary code fences keep their current behavior.
This is a focused Mermaid-only contribution for #782, alongside the broader Mermaid/images work in #616. No dependency on that branch. Opening as a draft for the maintainer's feature/dependency decision.
Mermaid 11.16.1 is pinned and lazy loaded; a scoped KaTeX override uses the app's existing 0.18.9. The application fixes strict configuration, refuses input configuration/HTML/custom CSS/resource directives, serializes initialize/render/owned cleanup, and validates bounded SVG before displaying a Blob image. Source, pending work and cache are bounded. Rendering still uses temporary DOM on the main thread; these guards do not guarantee interruption or complete execution isolation.
Includes ko/ja/zh labels, library and bundled runtime notices, documentation, changelog and registered browser regression with synthetic screenshots.
Validation
bun audit: no vulnerabilities found in 260 packages.Synthetic screenshots: mobile diagram, expanded dialog.