@@ -43,43 +43,27 @@ function hasYellow(s: string): boolean {
4343 // ---------------------------------------------------------------------------
4444
4545 describe("renderMarkdown – headings", () => {
46- test("h1 renders the heading text without the # prefix", () => {
47- const out = renderMarkdown("# Hello World");
48- expect(strip(out)).toBe("Hello World");
49- });
50-
51- test("h1 is bold and cyan", () => {
52- const out = renderMarkdown("# Hello");
53- expect(hasBold(out)).toBe(true);
54- expect(hasCyan(out)).toBe(true);
55- });
56-
57- test("h2 renders the heading text without the ## prefix", () => {
58- const out = renderMarkdown("## Section");
59- expect(strip(out)).toBe("Section");
60- });
61-
62- test("h2 is bold and cyan", () => {
63- const out = renderMarkdown("## Section");
64- expect(hasBold(out)).toBe(true);
65- expect(hasCyan(out)).toBe(true);
66- });
67-
68- test("h3 renders the heading text without the ### prefix", () => {
69- const out = renderMarkdown("### Sub");
70- expect(strip(out)).toBe("Sub");
71- });
72-
73- test("h3 is bold but NOT cyan (only bold)", () => {
74- const out = renderMarkdown("### Sub");
75- expect(hasBold(out)).toBe(true);
76- expect(hasCyan(out)).toBe(false);
77- });
78-
79- test("h4+ is treated the same as h3 (#{3,} pattern)", () => {
80- const h4 = strip(renderMarkdown("#### Deep"));
81- const h3 = strip(renderMarkdown("### Deep"));
82- expect(h4).toBe(h3);
46+ for (const [input, visible] of [
47+ ["# Hello World", "Hello World"],
48+ ["## Section", "Section"],
49+ ] as const) {
50+ test(`${input.slice(0, input.indexOf(" "))} strips its marker and keeps bold cyan styling`, () => {
51+ const out = renderMarkdown(input);
52+ expect(strip(out)).toBe(visible);
53+ expect(hasBold(out)).toBe(true);
54+ expect(hasCyan(out)).toBe(true);
55+ });
56+ }
57+
58+ test("h3+ strips markers, stays bold, and drops cyan", () => {
59+ const h3 = renderMarkdown("### Sub");
60+ const h4 = renderMarkdown("#### Deep");
61+ expect(strip(h3)).toBe("Sub");
62+ expect(hasBold(h3)).toBe(true);
63+ expect(hasCyan(h3)).toBe(false);
64+ expect(strip(h4)).toBe("Deep");
65+ expect(hasBold(h4)).toBe(true);
66+ expect(hasCyan(h4)).toBe(false);
8367 });
8468
8569 test("multiple headings each rendered on own line", () => {
@@ -89,30 +73,15 @@ describe("renderMarkdown – headings", () => {
8973 });
9074
9175 describe("renderMarkdown – horizontal rules", () => {
92- test("--- renders as a dim rule", () => {
93- const out = renderMarkdown("---");
94- expect(hasDim(out)).toBe(true);
95- expect(strip(out)).toMatch(/^─+$/);
76+ test("supported rule markers render a dim divider", () => {
77+ for (const input of ["---", "===", "***", "----"]) {
78+ const out = renderMarkdown(input);
79+ expect(hasDim(out)).toBe(true);
80+ expect(strip(out)).toMatch(/^─+$/);
81+ }
9682 });
9783
98- test("=== renders as a dim rule", () => {
99- const out = renderMarkdown("===");
100- expect(hasDim(out)).toBe(true);
101- expect(strip(out)).toMatch(/^─+$/);
102- });
103-
104- test("*** renders as a dim rule", () => {
105- const out = renderMarkdown("***");
106- expect(hasDim(out)).toBe(true);
107- expect(strip(out)).toMatch(/^─+$/);
108- });
109-
110- test("---- (4 dashes) is also a horizontal rule", () => {
111- const out = strip(renderMarkdown("----"));
112- expect(out).toMatch(/^─+$/);
113- });
114-
115- test("-- (2 dashes) is NOT a horizontal rule — passed through as plain text", () => {
84+ test("too-short markers are passed through as plain text", () => {
11685 const out = strip(renderMarkdown("--"));
11786 expect(out).toBe("--");
11887 });
@@ -183,45 +152,36 @@ describe("renderMarkdown – blockquotes", () => {
183152 });
184153
185154 describe("renderMarkdown – unordered lists", () => {
186- test("- item renders with · bullet", () => {
187- const out = strip(renderMarkdown("- item"));
188- expect(out).toBe("· item");
155+ test("all supported unordered markers render the same bullet", () => {
156+ for (const input of ["- item", "* item", "+ item"]) {
157+ expect(strip(renderMarkdown(input))).toBe("· item");
158+ }
189159 });
190160
191- test("* item renders with · bullet", () => {
192- const out = strip(renderMarkdown("* item"));
193- expect(out).toBe("· item");
194- });
195-
196- test("+ item renders with · bullet", () => {
197- const out = strip(renderMarkdown("+ item"));
198- expect(out).toBe("· item");
199- });
200-
201- test("indented - item preserves leading whitespace", () => {
161+ test("indented items preserve leading whitespace", () => {
202162 const out = strip(renderMarkdown(" - nested"));
203163 expect(out).toBe(" · nested");
204164 });
205165
206- test("list item content goes through inline processing", () => {
166+ test("list item content still goes through inline processing", () => {
207167 const out = strip(renderMarkdown("- **bold** item"));
208- // bold markers stripped in plain text, content preserved
209168 expect(out).toBe("· bold item");
210169 });
211170 });
212171
213172 describe("renderMarkdown – ordered lists", () => {
214- test("1. item renders number with dim styling", () => {
215- const out = strip(renderMarkdown("1. first"));
216- expect(out).toBe("1. first");
173+ test("ordered list numbers stay visible while the marker is dimmed", () => {
174+ const out = renderMarkdown("1. first");
175+ expect(strip(out)).toBe("1. first");
176+ expect(hasDim(out)).toBe(true);
217177 });
218178
219- test("multi-item ordered list", () => {
179+ test("multi-item ordered lists preserve numbering across lines", () => {
220180 const out = strip(renderMarkdown("1. alpha\n2. beta\n3. gamma"));
221181 expect(out).toBe("1. alpha\n2. beta\n3. gamma");
222182 });
223183
224- test("ordered list item content goes through inline processing", () => {
184+ test("ordered list item content still goes through inline processing", () => {
225185 const out = strip(renderMarkdown("1. **bold** text"));
226186 expect(out).toBe("1. bold text");
227187 });
@@ -335,12 +295,4 @@ describe("renderMarkdown – inline combinations", () => {
335295 const out = strip(renderMarkdown("**foo *bar*"));
336296 expect(out).toBe("**foo bar");
337297 });
338-
339- test("***text*** does not corrupt surrounding text — stray * passed through as plain", () => {
340- // Triple-star is ambiguous; the parser should not silently eat content.
341- // Current behaviour: outer * passed through as plain, inner text bolded.
342- const out = strip(renderMarkdown("***text***"));
343- expect(out).toContain("text");
344- expect(out).not.toContain("**");
345- });
346298 });