fix(app): stop remark-directive from eating colons in assistant messages#869
Open
bhuvansingla wants to merge 1 commit into
Open
fix(app): stop remark-directive from eating colons in assistant messages#869bhuvansingla wants to merge 1 commit into
bhuvansingla wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
remark-directive (enabled for plugin directives like
::inline-vis{...}) also parses inline:nameand block:::namedirectives. 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: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
9:30,a:b,:Drenders verbatim in a single<p>, no injected block element (fails before the fix, passes after).:::notecontainer renders as literal source text.reconstructDirectiveSourceuses the right marker per kind (:/:::).