Skip to content

fix(questions): plain-bullet choices keep their wrapped lines - #1699

Merged
backnotprop merged 5 commits into
mainfrom
fix/question-plain-bullet-continuation
Oct 5, 2026
Merged

backnotprop merged 5 commits into
mainfrom
fix/question-plain-bullet-continuation

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Target: 0.28.2. Two owner reports from a live pando-ops review, one commit each. No version bump.

1. Plain-bullet choices keep their wrapped lines

A :::question whose choices are plain bullets that wrap onto indented lines was cut at the first line, and the rest of each choice was pushed into the context above the options:

  • Before: option 1 was One per session: "ramos · cloud-3", "ramos · cloud-4". Each agent shows. Its continuation (as its own machine …) was in the context.
  • After: option 1 is One per session (label) followed by the full description. The context holds only the prose.

Cause: parseQuestionBlock attached indented continuation lines to task-list choices (- [ ]) but not to plain bullets. This was present since #1637.

  • Plain bullets now continue as CommonMark reads a list item: indented lines, lazy unindented lines (a line that starts another block ends the item), and an indented paragraph after a blank line. When the bullets become the choices, those lines leave the context. When they do not (a question-text block, or a block that already has task-list choices), they stay in the context.
  • A plain bullet with a bold name set off by punctuation (- **One per session:** …, - **a. It stops.** …) uses the name as the label and the rest as the description. **Fast** mode and **Name** (detail) stay one label.
  • A label longer than the 200-char answer cap is cut at its first sentence, and the rest goes into the description. Before, such a label could never show as picked, because the stored answer is capped. No text is lost.
  • The Recommended: line now wraps like a paragraph. Before, its second and later lines were dumped into the context (Q1, Q2, Q3, Q6 and Q8 of the same file ended their context with a fragment of the recommendation). A recommendation whose first sentence names a choice (one per session. Answer: per session / per person.) marks that choice.
  • Task-list choices split exactly as before. QUESTION_AUTHORING_GUIDE is unchanged.

2. Question context renders full block markdown

A table in a question's context rendered as one paragraph of pipes. The card used the small callout prose renderer, which handles only paragraphs and flat lists.

  • The new QuestionContext component runs the context through the document's own parseMarkdownToBlocks and BlockRenderer. Tables, lists, code fences, quotes, headings and images look as they do in the document, at the card's 13px muted scale. This adds no new renderer and makes no @plannotator/ui API change.
  • The context blocks carry no data-block-id. A selection or pinpoint inside them still resolves to the card and its data-question-part="context" part.
  • blockTargeting now checks the question card before the code, math and table branches. Without this, a card whose context holds a table or code fence would be taken for a table or code block.
  • The parser keeps each context line's indentation, less the indentation all lines share. Wrapped list items, nested lists and code fences survive.

Checked in Chromium with the built app: a comment on a table cell inside a question's context saves on the card's block id, and its highlight restores after a reload.

Screenshots

Headless Chromium, built app, plannotator annotate on the owner's QUESTIONS.md. Saved locally in ~/plannotator-shots/question-cards-0.28.2/:

  • before-q{1,2,4,5}.png / after-q{1,2,4,5}.png: Q1 and Q4 show full choices, Q2 and Q5 show real tables, and the Q2 suggested answer is complete.
  • after-q-table-annotated.png, after-q-table-restored.png: a comment on a context table cell, before and after a reload.

Tests

  • packages/core/question-block.test.ts: the reported block (both options in full, context free of continuation lines), a wrapped recommendation, recommendation matching by label and by the whole joined text, lazy continuation and its end at a new block, multi-paragraph bullets, the bold-name rule, the over-long label, plain bullets that stay in the context (text question, and a question with task-list choices), task-list behavior unchanged, and context markdown fidelity (table, code indentation, nested list, shared indent removed).
  • packages/ui/components/blocks/QuestionBlock.test.tsx (DOM): the context renders a real table, bold text, list items with their wrapped line, a code fence and a blockquote, with no inner data-block-id.
  • packages/ui/utils/blockTargeting.blocks.test.tsx (DOM): a card with a table and code in its context is still one card of parts, and a table cell or code line resolves to the context part.

bun run typecheck is clean. DOM_TESTS=1 bun test packages/core packages/ui packages/editor passes except for failures that are unrelated to this change: DocBadges fails only in the full run (it passes alone and also failed with only the core change), and the live paste-service E2E tests need the network.

Not changed and out of scope: plain bullets that are information rather than options (Q1 and Q7 of the file) still become choices under the existing plain-bullet rule. The Questions panel shows a bold prompt with literal **.

A plain-bullet choice that wrapped onto indented lines was cut at its first
line, and the rest of it was pushed into the context above the options.
Plain bullets now continue the way CommonMark reads a list item (indented
lines, lazy unindented lines, an indented paragraph after a blank line), and
those lines leave the context when the bullets become the choices. Bullets
that stay prose (a text question, or a question with task-list choices) are
unchanged.

A plain bullet with a bold name set off by punctuation (- **Name:** prose)
takes the name as its label and the rest as its description. A label over
the 200-char answer cap is cut at its first sentence so it can still show
as picked. The Recommended: line now wraps like a paragraph too, and a
recommendation whose first sentence names a choice marks it.

Task-list choices split exactly as before.
… renderers

A table in a question card's context rendered as one paragraph of pipes:
the card ran its context through the small callout prose renderer, which
knows paragraphs and flat lists only. The context now goes through the
document's own parser and BlockRenderer (new QuestionContext), so tables,
lists, code fences, quotes, headings and images look as they do in the
document, at the card's scale.

- The context blocks carry no data-block-id, so a selection or pinpoint
  inside them still resolves to the card and its context part, and an
  annotation anchors to the card's block id (checked: a comment on a
  context table cell saves on the card's block and restores after reload).
- blockTargeting checks the question card before the code / math / table
  branches, which would otherwise take the whole card for a table or code
  block now that its context can contain one.
- The parser keeps each context line's indentation (less what every line
  shares), so wrapped list items, nested lists and code fences survive.

Also, from the plain-bullet fix: a parenthesis after a bold choice name
stays in the label (**Name** (detail) is one label).
… renderer

- Recommended: a reason on its own line after the recommendation stays
  context, as on main. Only a genuine wrap (the line ends without sentence
  punctuation and the next starts in lower case, and starts no other block)
  continues it. A choice is matched on the Recommended: line first, then on
  the wrapped text; only an unmatched recommendation becomes the suggested
  answer.
- Task-list labels are never cut. Plain-bullet labels never collide: a cut
  label, then a bold-name label, falls back to the uncut, then the plain
  split when two bullets would share it. A recommendation may name a cut
  label's full form.
- A bold name is ** only, so __init__: constructor stays one label.
- Bullet continuation compares indentation with the bullet's content
  column, so an indented body (a question inside a list item) still ends a
  bullet at a quote, table or heading.
- Shared context indentation is removed in columns (tabs included).
- useActiveSection observes headings that have a block id only, so a
  heading in a question's context cannot freeze the TOC's active section.
@backnotprop

Copy link
Copy Markdown
Owner Author

Review fixes pushed (70a1616):

  1. Recommended: a reason on its own line stays context, as on main. Only a genuine wrap continues the recommendation: the line ends without sentence punctuation, the next line starts in lower case, and it does not start another block. A choice is matched on the Recommended: line first, then on the wrapped text. Only an unmatched recommendation becomes the suggested answer. I compared old and new parsers on 51 task-list, multi, bold, arrow, text and indented-body blocks. Only the 5 lower-case-wrap bodies differ: the marked choice is the same, and the wrapped line moves from the context into the recommendation.
  2. Task-list labels are never cut. Plain-bullet labels never collide: a cut label, and then a bold-name label, falls back to the next option when two bullets would share it. A recommendation may name a cut label's full form.
  3. Bullet continuation now compares indentation with the bullet's own content column, so an indented body still ends at a quote, table or heading.
  4. A bold name is ** only, so __init__: constructor stays one label. A shared bold name falls back to the full text.
  5. useActiveSection observes only headings that have a block id.
  6. Shared indentation is removed in columns, tabs included.

New tests cover each item. Typecheck is clean. DOM_TESTS=1 bun test packages/core packages/ui packages/editor gives 2724 pass and 7 fail, all unrelated: 3 live paste-service tests need the network, and 4 DocBadges tests fail only in the full run (they pass alone). The question-focused suites pass, 71 of 71.

Known limit of the conservative rule: a wrapped recommendation whose next line starts with a capital (Q1 …Kimi only / then Claude only / …, Q8 …with then Think …) still leaves that line in the context. Main put those lines in the context too.

… drop a replaced recommendation's wrap

- A recommendation may name a plain bullet by its first line or that
  line's dash-split label, as main matched it, even after wrapped or lazy
  lines join the bullet's text.
- A recommendation's wrapped lines stay in the context until the end; when
  a later Recommended: line replaces it, they remain there instead of
  vanishing.
…new DOM test in CI

- QuestionContext styled its renderers with Tailwind arbitrary variants,
  which every bundle scanning packages/ui/components generated, so the
  guides.show viewer CSS (and its pinned manifest) changed though the viewer
  never renders a question card. The same rules now ship as one stylesheet
  React hoists once (<style href precedence>). Rendering is pixel-identical
  (Q1-Q8 screenshots byte-identical) and the viewer manifest is in sync.
- Add packages/ui/hooks/useActiveSection.test.tsx to the DOM_TESTS step.
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