Skip to content

fix(frontend): preserve unhandled text directives - #3011

Open
morincl wants to merge 1 commit into
Chainlit:mainfrom
morincl:fix/preserve-unhandled-text-directives
Open

fix(frontend): preserve unhandled text directives#3011
morincl wants to merge 1 commit into
Chainlit:mainfrom
morincl:fix/preserve-unhandled-text-directives

Conversation

@morincl

@morincl morincl commented Aug 7, 2026

Copy link
Copy Markdown

Restore literal directive syntax when remark-directive parses ordinary text and no plugin maps the node to HAST.

Background

Fixes #1930.

remark-directive parses colon-prefixed alphabetic text as a textDirective, but unhandled text directives lose their original source during conversion to HAST. This adds a default handler that preserves the source text while retaining the Markdown alert support introduced in #1791.


Summary by cubic

Preserves literal text when remark-directive parses colon-prefixed words as textDirective, so unhandled directives render as-is instead of being lost. Keeps existing Markdown alerts behavior.

  • Bug Fixes
    • Add default textDirective handler in remarkRehypeOptions to emit original source when no HAST mapping is provided.
    • Wire remarkRehypeOptions into react-markdown.
    • Add tests for natural-language colons and full unhandled directive syntax.

Written for commit 3fbe32d. Summary will update on new commits.

Review in cubic

Restore literal directive syntax when remark-directive parses ordinary text and
no plugin maps the node to HAST.

Fixes Chainlit#1930.

`remark-directive` parses colon-prefixed alphabetic text as a
`textDirective`, but unhandled text directives lose their original source
during conversion to HAST. This adds a default handler that preserves the
source text while retaining the Markdown alert support introduced in Chainlit#1791.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working frontend Pertains to the frontend. labels Aug 7, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend Pertains to the frontend. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text After Colon Disappears in Chat UI, presumably Markdown preprocessing

1 participant