Skip to content

Mount message directive embeds glued to trailing prose - #4410

Merged
SawyerHood merged 4 commits into
get-bb:mainfrom
MacHatter1:fix/glued-directive-embeds
Sep 29, 2026
Merged

SawyerHood merged 4 commits into
get-bb:mainfrom
MacHatter1:fix/glued-directive-embeds

Conversation

@MacHatter1

@MacHatter1 MacHatter1 commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

remark-directive requires leaf directives to end their line. A registered embed followed by prose, such as ::inline-vis{file="demo.html"}Next **bold** tail, rendered as literal text. Parsing already-decoded paragraph text as a fallback also activated escaped examples, changed attribute values, and applied the mount limit out of source order.

What changed

Extend the existing micromark text-directive tokenizer to recognize the extra colon at the start of a paragraph for registered, non-colliding directives with a complete attribute block on the same line. Reuse the directive grammar for names, labels, attributes, entities, and quoting; preserve the original source and trailing Markdown nodes. Allocate standalone and glued mounts in one traversal so the first 32 directives in document order mount.

Escaped syntax, code, unknown or colliding names, incomplete attributes, and brace-less forms retain their literal behavior. Merge current main and retain its bundle budget; this change needs no budget increase. The new direct dependency was already present transitively through remark-directive. No wire or SDK contract changes.

How you verified

  • Turbo-backed focused tests for message directives, incremental pieces, Markdown preview, and incremental preview: 114 passed. Coverage includes literal syntax, attribute values and exact source, lists/quotes, collisions, source-order limits, and streaming DOM stability.
  • Against the original PR parser, 10 of the new regression cases fail for the intended reasons; they pass with this fix.
  • pnpm exec turbo run typecheck lint --filter=@bb/app passes; formatting and diff checks pass.
  • pnpm exec turbo run build --filter=@bb/app passes. The bundle-budget checker passes against main's unchanged limits: SplitWorkspaceRoute 2239.3 KiB raw / 601.4 KiB brotli, below 2284.3 / 615.8 KiB.
  • End-to-end in a fresh source dev instance using the offline echo provider through the real provider bridge and Browser Automation in headless Chromium: assistant embeds load actual HTML files, filenames with emphasis/backticks survive, trailing bold text renders, escaped/entity/code/unknown forms remain literal, iframe interaction works, parent DOM access is blocked, collapse/expand and the sidebar opener work, and reload preserves the result. The owned browser and dev instance were stopped afterward.

Fixes #4409

AGENT GENERATED

MacHatter1 and others added 4 commits September 26, 2026 13:38
remark-directive only emits a leafDirective when `::name{...}` ends its
line. Agents often continue with prose right after the closing brace,
so the line parses as a plain paragraph and the embed renders as
literal text. Split a leading registered `::name{...}` off the
paragraph into a mount node and keep the rest as a paragraph.
…beds

The fallback that mounts `::name{...}` directives followed by prose on
the same line adds 1.9 KB raw to the workspace route closure. Brotli
stays within its existing limit.
@SawyerHood
SawyerHood merged commit c78badf into get-bb:main Sep 29, 2026
18 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.

Message directive embeds render as literal text when prose follows ::name{…} on the same line

2 participants