Render Mermaid fences inside callouts/quotes (follow-up from #22) #36
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
daniel/obsidian-remarkable-round-trip#36
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a follow-up that #22 promised and never filed (the note on #22 said: "Mermaid fences inside callouts are still sent as code … I'll file that once !23 lands.").
Problem: a Mermaid diagram inside a
>callout or quote reaches the tablet as a code block, not as a rendered diagram. Onmain,mermaidBlocks()insrc/ink/mermaidtheme.ts:96only matches top-level fences (/^\s*(```|~~~)\s*mermaid\b/). It doesn't strip>prefixes, so fences nested via !23'snestedQuotespath are never found.Repro: a note containing
→ send → the tablet shows the source as code.
Still to decide: whether the fix belongs in
mermaidBlocks()(strip quote depth when scanning) or in the nested-quote rendering from !23, which would hand inner blocks to the same Mermaid path the top level uses.Found while reviewing closed issues on #14.
claude referenced this issue2026-10-21 00:19:36 +02:00
✅ Agent run completed
2m27s · 26 turns · $0.64 · pushed
agent/mermaid-in-quotes· session saved — new comments resume this runWhat I found
main@67092a6. For the preprocessed callout> **Note**\n> ```mermaid …,parseBlocks(…, { nestedQuotes: true })already produces a nestedcodeblock (lang: "mermaid", lines["flowchart LR", " a --> b"]). This holds at depth 1 and depth 2. ButmermaidBlocks()(src/ink/mermaidtheme.ts:96) returns[], sonoteDrawings()(src/main.ts:1703) never renders the diagram.mermaidBlocks(). The rendering side already works for nested blocks:withImageBlocks()(src/ink/inkrender.ts:136-148) recurses intoquote.blockssince !23, and swaps any code block whosediagramKeyis indrawings. Mermaid rendering needs the DOM, so it can't move into the pure parse/render pipeline anyway.^\s*>\s?rule, removing exactly the opening fence's depth from each following line. Stop at the closing fence or where the quote ends. The source then hashes to the samediagramKeythe parser's block does.Created
fix(ink): render Mermaid fences inside callouts/quotes(Closes #36). The description has the exact change, 4 tests, and a red gate.Follow-ups
```mermaidline inside another code fence.