fix(ui): preserve user ordered-list markers (closes #5013)

This commit is contained in:
Armin Ronacher
2026-05-27 01:02:04 +02:00
parent 59ec8003db
commit 2531fc130d
6 changed files with 59 additions and 5 deletions

View File

@@ -104,6 +104,31 @@ describe("Markdown component", () => {
assert.ok(plainLines.some((line) => line.includes("2. Second")));
});
it("should normalize ordered list markers by default", () => {
const markdown = new Markdown("1. alpha\n1. beta\n1. gamma", 0, 0, defaultMarkdownTheme);
const lines = markdown.render(80).map((line) => stripAnsi(line).trimEnd());
assert.deepStrictEqual(lines, ["1. alpha", "2. beta", "3. gamma"]);
});
it("should preserve source ordered list markers when configured", () => {
const markdown = new Markdown(
" 4. forth\n 3. third\n\n10) ten\n7) seven",
0,
0,
defaultMarkdownTheme,
undefined,
{
preserveOrderedListMarkers: true,
},
);
const lines = markdown.render(80).map((line) => stripAnsi(line).trimEnd());
assert.deepStrictEqual(lines, ["4. forth", "3. third", "", "10) ten", "7) seven"]);
});
it("should render mixed ordered and unordered nested lists", () => {
const markdown = new Markdown(
`1. Ordered item