Skip to content

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

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

fix(frontend): preserve unhandled text directives#3011
morincl wants to merge 5 commits 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. Previously unhandled directives were dropped during conversion; now they render exactly as written, and Markdown alerts continue to work.

  • Add a default textDirective handler in remarkRehypeOptions that emits the original source when no HAST mapping exists; wire it into react-markdown.
  • Respect nodes already mapped to HAST so existing alert components remain unchanged.
  • Add tests for natural-language colons and full unhandled directive syntax.

Written for commit fbd1f82. 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

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 14 days with no activity.

@github-actions github-actions Bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Aug 22, 2026
@morincl

morincl commented Aug 22, 2026

Copy link
Copy Markdown
Author

A little ping to keep this PR alive :)

@github-actions github-actions Bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Aug 23, 2026
@dokterbob

Copy link
Copy Markdown
Collaborator

@codex review

@dokterbob dokterbob added review-me Ready for review! unit-tests Has unit tests. labels Aug 26, 2026
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. review-me Ready for review! size:M This PR changes 30-99 lines, ignoring generated files. unit-tests Has unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text After Colon Disappears in Chat UI, presumably Markdown preprocessing

2 participants