Support Pandoc-style attributes for diagram code blocks - #50
Merged
Conversation
Add support for ```{.mermaid width=700} syntax and apply width/height
attributes as CSS max-width/max-height on the rendered container element.
Applies to mermaid, svg, and plantuml blocks.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Closes #49
Summary
{.lang}and{.lang key=value ...}(Pandoc-style) in addition to the plain```langformwidthandheightattributes and apply them asmax-width/max-heightinline CSS on the rendered container (<pre class="mermaid">,<div class="svg-container">,<div class="plantuml-container">)width=abc) are silently ignoredmermaid,svg,plantumlTest plan
{.mermaid width=700}renders withmax-width: 700px{.mermaid width=50%}renders withmax-width: 50%{.mermaid height=400}renders withmax-height: 400px{.mermaid width=700 height=400}renders both constraints{.mermaid width=abc}produces no style attribute{.mermaid}(no attrs) produces no style attribute{.svg width=300}applies style to svg-container{.plantuml width=600}applies style to plantuml-container```mermaidstill works unchanged🤖 Generated with Claude Code