Repository navigation
Update Pele to 1.13.0; Mermaid stays as the fallback - #4113
Merged
Merged
Conversation
Pele 1.13.0 wraps Chinese and Japanese labels between characters, so the space we put between wrapped rows (and the comment label read from them) now skips row breaks inside such text, as Mermaid reads the same label. A class label like "Odd & <x>" is now drawn as written; the anchor test states that and checks a Mermaid-made comment still restores on it.
The inline fit scaled every diagram up to fill its box. Pele lays diagrams out at the page's text size and tighter than Mermaid, so a small one came out with words two to three times the page's, and a short one ran under the zoom controls. Fit now stops at 1 for an inline Pele diagram, and the box is sized for that. The popout and Mermaid's fit are unchanged.
Pele 1.13.0 names the flowchart-v2 diagram id in its own detect table, so that text no longer shows that Mermaid is in the engine. Look for registerExternalDiagrams, a name on Mermaid's API object, instead.
Pele 1.10 and later stop at a sankey row whose value is not a number, so a CSV header row (Source,Target,Value) made the diagram fall back to Mermaid. Read the first row as a header when its value is not a number, leaving its line empty so later errors keep their line numbers.
The plan page and the Inbox window pack Pele 1.13, which carries the flowchart-v2 id, so the checks that Mermaid is packed there passed without Mermaid. Look for registerExternalDiagrams instead. A first sankey row with an empty value is a flow missing its number, not a header: leave it as written.
A card held at the bottom edge of the diagram's box entered with its usual rise from 4 px below, so its first frames ran past the edge and were cut off. Inline Pele diagrams are now drawn at their own size, so their box is shorter and a card on a low part is held there more often.
When the fitted drawing would reach the zoom strip, the inline box grows by the strip's measured band (its height and margin), only as far as the drawing needs, and the drawing, at the same scale, is centred above the strip. A drawing already clear keeps its place and its box. Hosts that pass no reserve (the full-screen viewer) are unchanged.
backnotprop
marked this pull request as ready for review
November 27, 2026 02:49
backnotprop
added a commit
that referenced
this pull request
Nov 27, 2026
…n accept with remote loads off The check a host passes (accept) is never handed the final svg, and down the Mermaid fallback with diagramRemoteLoads off Mermaid's label pass has already removed a label's picture, so the check may see nothing to refuse: the notes say so, and the browser test now pins it with real Mermaid. Any Pele failure other than a refusal falls back, a failed load of Pele included. What loaded nothing is stated as observed for the sources tested, with the enforced CSP still required; a Report-Only policy does not block. The #4113 items are marked merged and not yet published. The Mermaid-path accept tests now pin only that the check runs before the clean-up and that a refusal is refused.
yermakoffivan
pushed a commit
to yermakoffivan/plannotator
that referenced
this pull request
Nov 27, 2026
…d Pele 1.13 core 0.25.35 carries what merged after 0.25.34 went to npm: exact-phrase search in inbox-search (words in double quotes, backnotprop#4117, backnotprop#4124) and the agent-gone event in external-annotation's ExternalAnnotationEvent (backnotprop#3698). No exports subpath changes. ui handles that agent-gone event, so its pin follows and core goes first. ui 0.67.0 is a minor: DiagramSourceAcceptContext lets a host refuse a fence by its source before any engine runs (backnotprop#4146), DIAGRAM_REFUSED_RESULT is exported, Pele 1.13.0 with the inline fit changes (backnotprop#4113), the agent-gone send failures (backnotprop#3698) and the plan header seams (backnotprop#3905). README and HANDOFF name the new pair and the order (core first), and the hook and Pele notes now name ui 0.67.0 instead of "the first ui after 0.66.0". bun.lock is bun install's own output: the two package version lines.
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.
Updates
pelefrom 1.3.0 to 1.13.0 inpackages/ui. Mermaid is unchanged and still draws any fence Pele cannot.Why 1.13.0 and not an older version
Pele issue obsidianmd/pele#148 reports that 1.9.1 and later corrupt emoji in WebKit (Safari, WKWebView). The cause is a
/uregex in Pele's SVG text escaping. The corruption depends on the WebKit version, not on the Pele version alone:renderDiagram→renderPele, with the app's theme tokens, sanitizer and label steps), Playwright WebKit 27.2 and Chromium 156 produce byte-identical label text on 1.3.0 and 1.13.0. The test labels hold a single emoji, a ZWJ family, flags, keycaps and emoji next to CJK. No lone surrogates appear in the SVG.apps/mobile/ios/PlannotatorInbox.xcodeproj/project.pbxproj), which is newer than the fix.Not checked: the Safari app itself and the iOS app on a device. Users on an older Safari (17.x, as in the issue) would see broken emoji in Pele diagrams after this update.
What changes in the drawings (16 diagrams, before and after, Chromium and WebKit)
Better:
style/classDef) in a dark theme. On 1.3.0, light-filled nodes had near-invisible light text. They now get dark text (Pele 1.12).List<T>,Map<K, V>andOption<String>in flowchart labels. 1.3.0 drew "List" and "Option" (Pele 1.9).titles,circles). On 1.3.0 both Pele and Mermaid gave a parse error. It now draws (Pele 1.10.1).Worse: nothing left (diagram 13 was, and is fixed by the fourth commit, below).
Same: sequence with
autonumber, class generics with~T~, a pie with slices under 1%, state, gantt, ER,%%comments, requirement, flowchart with subgraphs. A mindmap is laid out differently (branches on other sides), but no better or worse.Comment anchors on diagrams
With the app's own finder (
PELE_COMPAT_FINDER), the harness lists every part a comment can attach to, on both versions. In all 16 diagrams the ids, kinds and ends are the same on 1.3.0 and 1.13.0, and every target round-trips. Stored anchors keep restoring. Two label differences came from the update:peleRowSpaces.ts) and the anchor label reader (peleLabelText) put a space at every row break. That was right for word wrapping, but wrong for Chinese and Japanese, which Pele now breaks between characters. A row break inside CJK text now joins with no space, as Mermaid reads the label. New test inpeleRowSpaces.test.ts; it fails without the fix.class Odd["Odd & <x>"]is now drawn as written, where Mermaid drops<x>. A new comment there is labelled with the text the person sees. The class parity test indiagramAnchorPele.test.tsnow lists the labels explicitly and checks that a comment made under Mermaid still restores on that class (nodes match by id first).Other checks
detectType,loadandrenderAsyncfrompele/lazy, nevermount(), so the breakingmount()changes in 1.5 and 1.6 do not reach us. tsc forpackages/uiandpackages/ui/tsconfig.strict-consumer.jsonis clean.apps/hookVite build,index.html) grows by 78 KB, from 25.17 MB to 25.25 MB (gzip 7.45 MB to 7.48 MB). This is recorded inPELE.md.bun.lockwas changed bybun install, not by hand. It also syncs ui's@plannotator/coreentry to 0.25.34, whichpackages/ui/package.jsonalready pins on main.@plannotator/uikeeps its version: the next ui publish ships Pele 1.13.0.Inline size of a Pele diagram (second commit)
Inline, a diagram used to be fitted to fill its box, scaling it up as far as 8× (
useDiagramViewport.ts, Fit). Mermaid gets the same treatment, but Pele draws much tighter at the page's text size, so a small Pele diagram came out with text two to three times the body text. Through the realMermaidBlock→DiagramBlockpath in a 760 px document column, identical on Pele 1.3.0 and 1.13.0 and in both Chromium and WebKit:Fix: an inline Pele diagram is fitted at most at its own size (
inlineFitMaxScale,fitAtMostNaturalSize), and the box height is computed at that scale. The popout, zooming and Mermaid's fit are unchanged. New test inDiagramBlock.engine.test.tsx: a narrow Pele diagram fits at scale 1 (3.40 without the fix), and a Mermaid diagram still fills its box at 2×.Not changed here:
id@{ img: "...", label: "..." }) is drawn by Pele as its caption with no box, because we render withimages: false(utils/pele.ts:138). Our picture-only fallback to Mermaid (utils/pele-labels.ts:49) catches<img>tags in a label but not this shape. Same on 1.3.0.Engine test marker (third commit)
tests/entry-assets.test.tschecked that the diagram engine (diagram-engine/engine.js) carries no Mermaid by looking for the textflowchart-v2. Pele 1.13.0 names that diagram id in its own type-detect table (["flowchart","flowchart-v2",/^\s*(graph|flowchart)/], inpele/dist/esm/chunks/DKUZGKB3.js; Pele 1.3.0 has no such text), so the engine now has that text with no Mermaid in it. Mermaid is not bundled into the engine: on main,engine.jsis 920.6 kB; on this branch it is 996.9 kB (+76 kB, which is the Pele growth).mermaid.jsis 4813.9 kB on both.The test now uses
registerExternalDiagrams, a name on Mermaid's public API object, so minification keeps it. It is inmermaid.js, and it is not inengine.js, Pele 1.3.0 or 1.13.0, or any Plannotator source. The same test asserts the marker inmermaid.js(mermaidRuntime), so it still fails if Mermaid gets bundled into the engine. The same flaw was in the checks that Mermaid is packed into the plan page (apps/hook/dist/index.html), the Inbox window and the OpenCode page: all of these pack Pele 1.13, soflowchart-v2was there even without Mermaid. They now use the same marker (fifth commit). In the built plan page it occurs 3 times, all in Mermaid code;engine.js, which holds Pele and no Mermaid, hasflowchart-v2once and the new marker 0 times, so a page without Mermaid fails the check.flowchart-v2stays as an absent marker for the review page, which carries neither Pele nor Mermaid (0 hits): an absent check with a wider marker can only fail too often, never pass by mistake.Sankey with a header row (fourth commit)
Pele 1.13.0 stops at
Source,Target,Valuewith "Parse error on line 2 … Expecting a number". It is notsupports()and not our gate:detectTypesayssankeyandloadsucceeds. The parser needsparseFloat(value)to be finite. Pele 1.10.0 made this an error on purpose (release notes: "a value that doesn't start with a number, such asabc, is a syntax error instead of an empty flow", obsidianmd/pele#60). So every version from 1.10.0 on rejects the header row. 1.9.1 would accept it, but pinning it would lose the 1.10 to 1.13 fixes that this PR is for (1.12.0 dark-fill label contrast, diagram 11; 1.10.1 names that start with a keyword).Fix: before Pele draws a sankey, its first row is read as a header when its value is not a number by Pele's own test (
packages/ui/utils/peleSankeyHeader.ts, called inrenderPele). The row's line stays, empty, so an error further down still names its own line. Every later row is left as written, so a bad value there is still an error. A first row with an empty value (A,B,) is not a header either: it stays Pele's error, as before. The Mermaid fallback and the source the person sees and copies are unchanged. On 1.3.0, and in Mermaid, the header was drawn as a stray "Source 0 → Target 0" flow across the top. It is now gone.New test
packages/ui/utils/peleSankeyHeader.test.ts(DOM): the header sankey draws in Pele with the four real nodes and four flows; a first row that is a flow stays a flow; a first row with an empty value is an error at line 2; a bad value on line 4 is still an error at line 4. Without the fix, 2 of 4 fail; without the empty-value rule, the empty-value case fails.Pictures (before = main on 1.3.0, after = this branch), diagram 13 and contact sheets of all 16, Chromium 156 and WebKit 27.2, dark and light, are kept outside the repo. Only diagram 13 changed against the earlier 1.13.0 run.
Comment card at the bottom of a shorter box (sixth commit)
The phone e2e
inbox-thread-diagram-comments.spec.ts:308failed: the comment card on "Fix the build" ended 3.3 px below the diagram box. Cause, measured in a 390 px harness with that spec's diagram (Pele, drawn at 267 × 328): on main Fit scaled it 1.154× in a 546.6 px box, and the 108 px card sat 31.9 px clear of the bottom. With the fit cap it is drawn at 0.994× in a 374 px box, so the card is lifted to end exactly at the box's bottom. The card's entry animation (pn-cbox-in) rises from 4 px below, so its first frames run past that edge: 4.13 px at 48 ms and 3.25 px at 65 ms, settling at 0.13 px (the e2e read it mid-entry). No part of any diagram was outside its box in any case measured (tall, wide, small, phone and desktop).Fix: a card lifted to fit the canvas comes in from above (
data-above, the keyframes comment-card.css already has),DiagramComposer.tsx. The in-canvas card is at most the canvas less 16 px, so coming in from above stays inside. With it, the harness trace never passes the bottom (max +0.13 px). Tests:DiagramComposer.card.test.tsx, where a lifted card hasdata-aboveand one at its part does not (fails without the fix);DiagramBlock.engine.test.tsx, where a Pele diagram larger than its box in either direction is still scaled down to fit (a guard: Fit already did this).Zoom controls clear of the drawing (seventh commit)
With the fit cap, the inline box is the drawing's height plus 48 px, and the zoom strip (− ⤢ +) is taller than Fit's 24 px margin. On a 390 px phone the strip covered "Deploy" in the 4-node top-down flowchart; on main the box was taller, so the drawing was clear of it.
Fix: when the fitted drawing would reach the strip, the inline box grows by the strip's measured band (its height plus its margin, read from its rect, not a constant), only as far as the drawing needs. The drawing keeps the scale Fit gives it and is centred in the area above the strip. A drawing already clear keeps its place and its box. The strip does not move.
fitInHostinuseDiagramViewport.tsdecides;DiagramCanvasmeasures the strip;DiagramBlockadds the room to the box (controlsReserve, passed throughDiagramViewer). Hosts that pass no reserve, such as the full-screen viewer, are unchanged.Measured through the real
MermaidBlock/GraphvizBlockpath in a 760 px column, Chromium 156 and WebKit, 390 px and 1280 px wide:Tests:
fitInHost.test.ts(plain): at rest, the strip's rect and the drawing's rect do not intersect for the 4-node, two-node, wide and tall flowcharts at 390 px and at desktop width; the scale is never below Fit's; the box grows by at most the band; a drawing already clear gets no room. 2 of 5 fail without the fix.DiagramCanvas.controlsReserve.test.tsx(DOM, browser layout stood in): the canvas asks once for the 50 px band, and the Fit control on the grown box asks nothing new; a canvas without a reserve asks nothing. 1 of 2 fails without the fix.Tests run locally (one file per run)
DOM: DiagramBlock.engine 25/25 (with the new fit test), peleRowSpaces 3/3, diagramAnchorPele 18/18, pele-labels 26, pele-render 8, pele-hostile 16, diagramAnchor 26, diagramMathLabels 2, diagramLabelScrub 9, diagramRemoteLoads 10, DiagramBlock.anchor 7, DiagramBlock.askAI 5, DiagramBlock.lazyRetry 16, DiagramBlock.copySource 2, MermaidBlock.theme 3, DiagramViewer 28, Viewer.diagramLazyRestore 3, Viewer.diagramAnchorHostile 1, useAnnotationHighlighter.diagramSkip 2, Viewer.diagramClosure 9, Viewer.textComments 9, LazyBlockBoundary 4, guideChapterDiagram 6, guideOverviewMermaid 4, spaceFaceDiagram 3, overviewDiagram 4, App.diagramDocument 3, MarkdownFilePreview 15.
Plain: pele 8, peleTheme 120, peleAuthorTheme 9, diagramShadowSetting 4, parser.diagramDocument 4, review diagramEngine 7, annotate.diagram 8, entry-assets 31 (41 skipped: they need built output), published-package-floors 23.
Fourth commit: peleSankeyHeader 3/3 (2 fail without the fix), pele-render 8/8, pele-hostile 16/16, dom-test-allowlist 1/1, tsc ui and strict-consumer clean. All pass. Left to CI:
packages/server/diagram-engine-assets.test.ts, which needs generated Pi files a fresh worktree lacks, and the browser suites.Seventh commit: fitInHost 5/5, DiagramCanvas.controlsReserve 2/2, DiagramViewer 28/28, DiagramBlock.engine 26/26, DiagramComposer.card 4/4, DiagramBlock.anchor 7/7, guideChapterDiagram 6/6, dom-test-allowlist 1/1, tsc ui and strict-consumer clean.