From bdfd2404ef87133aeeeff1e62a3d9bb58b1616e8 Mon Sep 17 00:00:00 2001 From: Frederic Cabassut Date: Sat, 21 Mar 2026 23:26:18 +0100 Subject: [PATCH] feat: NoteCard and public share page support nested checklist items Update checklist preview parsers to detect 2-space child prefix and render indented items with extra left padding. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/components/NoteCard.svelte | 16 +++++++++++----- src/routes/(share)/s/[token]/+page.svelte | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/lib/components/NoteCard.svelte b/src/lib/components/NoteCard.svelte index db4b19b..809bafd 100644 --- a/src/lib/components/NoteCard.svelte +++ b/src/lib/components/NoteCard.svelte @@ -16,6 +16,7 @@ interface ChecklistItem { text: string; checked: boolean; + indented: boolean; } interface Props { @@ -38,10 +39,14 @@ const checklistItems = $derived( note.checklistMode - ? note.content.split('\n').filter(l => l.trim()).map(line => ({ - text: line.replace(/^- \[[ x]\] /, ''), - checked: line.startsWith('- [x] ') - })) + ? note.content.split('\n').filter(l => l.trim()).map(line => { + const indented = line.startsWith(' - ['); + return { + text: line.replace(/^ {0,2}- \[[ x]\] /, ''), + checked: line.includes('[x]'), + indented + }; + }) : [] ); @@ -127,7 +132,8 @@ {#if note.checklistMode && checklistItems.length > 0}
    {#each sortedChecklistItems.slice(0, 8) as item} -
  • +
  • l.trim()) - .map((line: string) => ({ - text: line.replace(/^- \[[ x]\] /, ''), - checked: line.startsWith('- [x] ') - })) + .map((line: string) => { + const indented = line.startsWith(' - ['); + return { + text: line.replace(/^ {0,2}- \[[ x]\] /, ''), + checked: line.includes('[x]'), + indented + }; + }) : []; const activeChecklistItems = checklistItems.filter((i) => !i.checked); @@ -64,9 +69,10 @@
      {#each sortedChecklistItems as item}