From ee575c0dbdce638e0d759bee905c02ea4e713f81 Mon Sep 17 00:00:00 2001 From: 7w1 Date: Tue, 26 May 2026 23:42:24 -0500 Subject: [PATCH] fix: nested list indentation --- .changeset/fix-nested-lists-behavior.md | 5 ++++ .../plugins/markdown/bidirectional.test.ts | 20 +++++++++++++ .../markdown/expandBlockNewlines.test.ts | 18 +++++++++++ .../plugins/markdown/expandBlockNewlines.ts | 30 +++++++++++++++++++ .../plugins/markdown/htmlToMarkdown.test.ts | 17 +++++++++++ src/app/plugins/markdown/htmlToMarkdown.ts | 7 +++-- 6 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 .changeset/fix-nested-lists-behavior.md diff --git a/.changeset/fix-nested-lists-behavior.md b/.changeset/fix-nested-lists-behavior.md new file mode 100644 index 000000000..f5b3113e4 --- /dev/null +++ b/.changeset/fix-nested-lists-behavior.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +Fixed nested lists having wrong indentation levels when editing. diff --git a/src/app/plugins/markdown/bidirectional.test.ts b/src/app/plugins/markdown/bidirectional.test.ts index 31ab6dd53..b5102798f 100644 --- a/src/app/plugins/markdown/bidirectional.test.ts +++ b/src/app/plugins/markdown/bidirectional.test.ts @@ -103,6 +103,26 @@ describe('bidirectional round-trip', () => { expect(result).toContain('2. Second'); }); + it('round-trips nested sublists with four-space indent', () => { + const markdown = '1. parent\n - child'; + const html = markdownToHtml(markdown); + expect(html).toMatch(/
  • [\s\S]*