Find in the markdown preview and in any diff - #82
Merged
Merged
Conversation
Several of mermaid's bundled dependencies ship classic UMD wrappers whose
first branch is `typeof define === 'function' && define.amd`. Monaco's AMD
loader has already installed a global `define` by the time markdown.ts
lazy-loads renderer/mermaid.js, so those deps registered as anonymous
modules and the whole bundle died with "Can only have one anonymous define
call per script file" — every mermaid fence fell back to raw source, in the
shipped app as well as the UI test.
Wrap the bundle in `(function(define){ … })()` so `define` is undefined
inside it and the UMD wrappers take their CommonJS branch instead.
Mod+F (rebindable, in the Edit menu) dispatches on the active pane: the rendered markdown preview is the one view with no editor behind it, so it gets its own find bar — case-insensitive substring search painted with the CSS Custom Highlight API, which leaves the rendered document and its diff tinting untouched. Every editor view hands over to Monaco's own find widget instead; the global keydown handler swallows the key before Monaco sees it, so the handover has to be explicit. Also fixes three things in the UI test that kept it from running: - the navigator.platform pin (Mod = Ctrl semantics) was defined on the instance, where current Chromium makes it non-configurable — it threw and silently never applied. Define it on Navigator.prototype. - #diff-count renders "2 differences (+2 -2)"; two assertions still compared against the bare "2 differences". - the Chromium path fell back to a sandbox-only location, so the suite couldn't launch on a dev machine. Use Playwright's own browser when that path is absent.
afitzgerald
added a commit
that referenced
this pull request
Sep 30, 2026
Find in the markdown preview and in any diff
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.
What
⌘F/Ctrl+F(rebindable, in the Edit menu) dispatches on whatever the diff pane is showing:n/mcounter,Enter/⇧Enterto cycle with wrap,Escto close. Matches are painted with the CSS Custom Highlight API (Ranges, no DOM mutation), so the rendered document and its diff tinting stay exactly as rendered, and clearing is onedelete()per highlight. Re-runs whenever the pane re-renders (mode switch, file switch, live edit) since the old Ranges point at nodes that are gone.Mermaid fix (separate commit)
Several of mermaid's bundled deps ship classic UMD wrappers that test
typeof define === 'function' && define.amdfirst. Monaco's AMD loader already owns a globaldefineby the timemarkdown.tslazy-loadsrenderer/mermaid.js, so they registered as anonymous modules and the bundle died withCan only have one anonymous define call per script file— every mermaid fence fell back to raw source in the shipped app, not just in tests. The bundle is now wrapped in(function(define){ … })().UI test harness
Three things kept
node test/ui.test.jsfrom running at all:navigator.platformpin (which gives the suiteMod = Ctrlsemantics) was defined on the instance, where current Chromium makes it non-configurable — it threwCannot redefine propertyand silently never applied. Now onNavigator.prototype.#diff-countrenders"2 differences (+2 −2)", but two assertions still compared against the bare"2 differences".DIFFIER_CHROMIUMstill overrides).Known limitation
Markdown matches don't span inline element boundaries — a query crossing
**bold**won't hit. Flagged in aponytail:comment; needs a concatenated-text offset map if it ever matters.Testing
yarn typecheck,yarn test, andnode test/ui.test.jsall pass (7 new UI assertions cover the Monaco handover, the bar opening + focus, the counter, Enter/⇧Enter wrap, the no-match state, and Esc clearing the highlights).