forked from farhoodlabs/paperclip
Fix markdown editor escaped list markers
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizeMarkdownArtifacts } from "./markdown";
|
||||
|
||||
describe("normalizeMarkdownArtifacts", () => {
|
||||
it("normalizes escaped unordered list markers and space entities", () => {
|
||||
const input = "Here is a list:\n\n\\* foo \n\\- bar ";
|
||||
const output = normalizeMarkdownArtifacts(input);
|
||||
expect(output).toBe("Here is a list:\n\n* foo \n- bar ");
|
||||
});
|
||||
|
||||
it("does not rewrite escaped markers inside fenced code blocks", () => {
|
||||
const input = "```md\n\\* keep literal \n\\- keep literal \n```";
|
||||
expect(normalizeMarkdownArtifacts(input)).toBe(input);
|
||||
});
|
||||
|
||||
it("keeps escaped non-list syntax intact", () => {
|
||||
const input = "\\*not-a-list";
|
||||
expect(normalizeMarkdownArtifacts(input)).toBe(input);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user