Skip to content

fix(picker): render plain choice names without MarkdownRenderer - #2252

Draft
chhoumann wants to merge 2 commits into
masterfrom
issue-2251
Draft

chhoumann wants to merge 2 commits into
masterfrom
issue-2251

Conversation

@chhoumann

@chhoumann chhoumann commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Fixes #2251.

Why

With Iconic enabled, Run QuickAdd took about a second to open on a large vault. The picker rendered every choice name with MarkdownRenderer.render. That call runs every plugin's Markdown post processors. Iconic's post processor reads metadataCache.getTags(), a scan of the whole vault, on every call before it looks for a tag. So 27 rows meant 27 vault scans per open, and more on each keystroke. The settings list had the same cost.

What changed

  • renderChoiceName now writes a plain name straight into <p dir="auto">, which is the output Obsidian's renderer gives for such a name. Names that use Markdown or HTML still go through the renderer.
  • The picker and the settings list now share renderChoiceName.
  • A name counts as plain when it uses only letters, digits, spaces, non-ASCII characters (except the line and paragraph separators), and ,.'"?;()-, and it does not open a list, an indented code block, or a www. autolink.

Scope

Blast Radius

Every picker row and settings row with a plain name skips the Markdown renderer. If the gate accepted a name that Obsidian renders differently, that name would show as literal text. The fuzz and e2e checks below found no such name.

Verification

  • Picker open time in an Obsidian 1.13.7 vault with 28k tagged notes and Iconic 1.1.11: about 905 ms → 2-8 ms. getTags() calls per open: 27 → 0. Settings tab: about 950 ms → 27-51 ms.
  • I rendered 4,730 names that the gate accepts through Obsidian's real renderer. All 4,730 matched the plain output byte for byte. The new tests/e2e/choice-name-render.test.ts checks the real picker against the renderer, and it fails if dir="auto" is removed.
  • Screenshots of the picker and of the settings list are byte-identical before and after the change.

Note

Render plain picker choice names as text without MarkdownRenderer

Adds an isPlainName classifier to renderChoiceName so ordinary names render as an automatic-direction text paragraph, while names with Markdown or HTML constructs still go through the async Markdown renderer. Routes ChoiceSuggester.renderSuggestion through the shared helper, keeping the existing rejection fallback. Adds unit and end-to-end tests covering plain names, Markdown-sensitive names, and HTML comparison against Obsidian's renderer.

Macroscope summarized 7573699.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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.

[BUG] QuickAdd: Run QuickAdd" picker takes ~1 s to open when Iconic is enabled (~8 ms without it)

1 participant