diff --git a/apps/app/src/components/ui/markdown-message-directives.test.ts b/apps/app/src/components/ui/markdown-message-directives.test.ts index 27dad6b4c..358873b04 100644 --- a/apps/app/src/components/ui/markdown-message-directives.test.ts +++ b/apps/app/src/components/ui/markdown-message-directives.test.ts @@ -81,4 +81,9 @@ describe("normalizeDirectiveAttributes / reconstructDirectiveSource", () => { reconstructDirectiveSource("inline-vis", { file: 'demo"x".html' }), ).toBe('::inline-vis{file="demo\\"x\\".html"}'); }); + + it("uses the supplied marker for non-leaf directive kinds", () => { + expect(reconstructDirectiveSource("30", {}, ":")).toBe(":30"); + expect(reconstructDirectiveSource("note", {}, ":::")).toBe(":::note"); + }); }); diff --git a/apps/app/src/components/ui/markdown-message-directives.test.tsx b/apps/app/src/components/ui/markdown-message-directives.test.tsx index 3fe9a6700..9a2eda2f3 100644 --- a/apps/app/src/components/ui/markdown-message-directives.test.tsx +++ b/apps/app/src/components/ui/markdown-message-directives.test.tsx @@ -215,6 +215,56 @@ describe("MarkdownPreview message directives", () => { expect(screen.getByText('::inline-vis{file="still-streaming')).toBeTruthy(); }); + it("renders incidental prose colons literally without dropping text", () => { + // Regression: `remark-directive` parses `13:30`, `a:b`, and `:D` as text + // directives. Before the fix these fell through to mdast-util-to-hast as + // empty block `