Skip to content

fix(questions): a Recommended: line names a markdown label by its plain words - #2251

Merged
backnotprop merged 3 commits into
mainfrom
fix/recommended-line-plain-label
Oct 27, 2026
Merged

backnotprop merged 3 commits into
mainfrom
fix/recommended-line-plain-label

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

A Recommended: line now names a choice whose label is written as markdown, such as a link: - [ ] [Pagefind](x.html) with Recommended: Pagefind. Before this, nothing was marked recommended, and the line showed as a suggested answer instead.

  • Exact matching still runs first.
  • When nothing matches exactly, the line is compared with the label's plain words: link and wiki-link labels kept, images and HTML tags removed, emphasis and code marks dropped. The match counts only when exactly one choice has those words. If two do, nothing is named, as today.
  • The plain-text helper is local to packages/core/question-block.ts. It doesn't use cleanInline (packages/core/inbox-folding.ts) because that module imports question-block, so using it would create a circular import. Inbox: show a markdown choice label's words, not its markdown, in folded lines and answer rows #2219 (plainLabel) has not merged yet.

Tests (packages/core/question-block.recommended-plain.test.ts):

  • a link label;
  • a link label with a (Recommended) marker;
  • a code-span label;
  • a bold label;
  • two choices with the same plain words (nothing named, the line stays a suggested answer);
  • an exact match still wins.

Typecheck is clean. The core, inbox and MCP tests pass (1,288 pass, 0 fail). The UI QuestionBlock DOM tests pass (107 pass, 0 fail).

…in words

- [ ] [Pagefind](x.html) with 'Recommended: Pagefind' named nothing (the
raw label is the link), so the card showed no recommendation and the line
became a suggested answer. After the exact matches, the label's plain words
(link and wiki-link labels kept, images and tags out, emphasis and code
marks dropped) name the one choice that has them; two such choices name
none, as before.
…up patterns shared in core/inline-markdown

- fallbackHit tries a part's plain words too, so 'Recommended: Pagefind
  and Algolia' names both link labels on :::question-multi.
- stripInlineMarkup (packages/core/inline-markdown.ts, imports nothing):
  the image, link, wiki-link and tag patterns stop at the next opener, so
  a run of [, [[, ![ or <a is read in linear time (was ~0.9 s at 19k).
  question-block's plainWords and inbox-folding's cleanInline both use it;
  Pi vendors it beside question-block.
- Tests: pick any (two links; a link and a plain label), timing guards for
  the parse and for stripInlineMarkup / cleanInline.
…d parentheses

[Foo](https://en.wikipedia.org/wiki/Foo_(bar)), [page](code:app/(shop)/[id]/page.tsx#L4)
and ![x](a_(1).png) stayed raw markdown: the bounded destination stopped at
the first (. It now takes one balanced pair and still stops at any other (,
so runs of brackets stay linear (timing guards extended to ( runs).
@backnotprop
backnotprop merged commit 12fbf5f into main Oct 27, 2026
32 checks passed
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.

1 participant