Skip to content

fix(app): stop remark-directive from eating colons in assistant messages#869

Open
bhuvansingla wants to merge 1 commit into
ymichael:mainfrom
bhuvansingla:bb/thr_jhu6f4rtkm
Open

fix(app): stop remark-directive from eating colons in assistant messages#869
bhuvansingla wants to merge 1 commit into
ymichael:mainfrom
bhuvansingla:bb/thr_jhu6f4rtkm

Conversation

@bhuvansingla

@bhuvansingla bhuvansingla commented Jul 25, 2026

Copy link
Copy Markdown

Problem

remark-directive (enabled for plugin directives like ::inline-vis{...}) also parses inline :name and block :::name directives. So any colon before a letter or digit — 9:30, key:value, :D — became a directive node.

remarkMessageDirectives only handled leaf (::name) directives. Text and container directives fell through to mdast-util-to-hast, which renders an unknown directive as an empty <div>. Inside a paragraph, that block element split the line and dropped the directive's text:

source:   at 9:30 today

before:   at 9
          ⏎  today      ← :30 gone, paragraph broken

after:    at 9:30 today

Fix

Handle all three directive kinds. Leaf directives mount as before; text and container directives are rewritten back to their literal source (text inline, container as a paragraph).

Display-only change — the persisted message text was already correct.

Tests

  • Sentence with 9:30, a:b, :D renders verbatim in a single <p>, no injected block element (fails before the fix, passes after).
  • :::note container renders as literal source text.
  • reconstructDirectiveSource uses the right marker per kind (: / :::).

remark-directive (enabled for plugin directives like ::inline-vis{...})
also parses inline :name and block :::name directives, so any colon
before a letter or digit (9:30, key:value, :D) became a directive node.

remarkMessageDirectives only handled leaf (::name) directives; text and
container directives fell through to mdast-util-to-hast, which renders an
unknown directive as an empty <div>. Inside a paragraph that split the
line and dropped the directive's text.

Handle all three kinds: leaf directives mount as before; text and
container directives are rewritten back to their literal source (text
inline, container as a paragraph). Display-only change.
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