Skip to content

Feat/mermaid rendering#29

Merged
tqbf merged 4 commits into
mainfrom
feat/mermaid-rendering
May 14, 2026
Merged

Feat/mermaid rendering#29
tqbf merged 4 commits into
mainfrom
feat/mermaid-rendering

Conversation

@tqbf

@tqbf tqbf commented May 14, 2026

Copy link
Copy Markdown
Owner

No description provided.

darvell and others added 3 commits May 13, 2026 15:35
Builds on Darvell's mermaid-rendering work. Three small fixes:

- Drop the fixed `diagramHeight()` formula and `minHeight: proxy.size.height`
  on the unzoomed branch. The image now flows at container-width × intrinsic
  aspect, eliminating the 60-150pt of dead space above and below each diagram.

- Skip the inner `ScrollView` when zoom is 1. Previously the wrapping ScrollView
  consumed wheel events even at the natural fit, so the document scroll would
  stall whenever the cursor passed over a diagram. The zoom > 1 branch still
  wraps in a ScrollView (with a pinned 540pt viewport) so panning works.

- Style picker: replace per-option `Toggle`+manual binding with a `Picker`,
  giving native radio semantics and a proper checkmark on the selected style.

Also swaps `foregroundColor` for `foregroundStyle` on the chrome icons.

Co-Authored-By: Darvell <1046915+darvell@users.noreply.github.com>
Two follow-ups on top of the sizing fix:

- Diagram view: drop the stacked-above chrome row and float the toolbar as
  a translucent capsule in the top-right of the diagram (Preview / Quick
  Look style). The diagram now occupies the full box. The capsule is hover-
  revealed, .thinMaterial background with a hairline border.

- Source view: when toggled to source, render with mdv's normal code-block
  chrome — `mermaid` language label top-left, hover-revealed
  wrap / show-diagram / copy buttons top-right, horizontal-scroll or wrap
  layout for the code. The view now feels like every other fenced block in
  the document instead of a one-off.

Context menu also splits by mode: source shows wrap; diagram shows style
picker and export.

Co-Authored-By: Darvell <1046915+darvell@users.noreply.github.com>
`@State` was wrong — it scoped the style to a single diagram instance, so
each block had its own palette and the picker felt useless. Move to
`@AppStorage("mdv.mermaid.style")` so picking a style updates every diagram
in the document at once and the choice survives restarts.

Co-Authored-By: Darvell <1046915+darvell@users.noreply.github.com>
@tqbf tqbf merged commit 3366971 into main May 14, 2026
3 checks passed
@tqbf

tqbf commented May 15, 2026

Copy link
Copy Markdown
Owner Author

THIS IS NOT MY WORK MUST CREDIT @darvell

But I (1) suck at git and (2) don't fully trust Claude to drive git so however I put this together I somehow stripped attribution.

Sorry. Wish I could say I was going to get better at this but I refuse to get better at git.

hazadus added a commit to hazadus/mdv that referenced this pull request May 15, 2026
PR tqbf#29 added Mermaid rendering but none of the user-facing docs were
updated. Our gantt follow-up made the gap more visible: gantt.md was
listed nowhere, and Help.md had no mention of diagrams at all.

- README.md: add Mermaid to the features bullet list, noting the
  native/WKWebView split.
- Help.md: new "Mermaid diagrams" section covering the style picker,
  source toggle, export, zoom, and the native-vs-bundled rendering split.
- test-docs/README.md: add gantt.md entry explaining what it tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants