⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
addressed review
Tymek8baa8ad5f68e
diff --git a/apps/web/src/lib/get-task-item-stats.test.ts b/apps/web/src/lib/get-task-item-stats.test.tsindex ec1a2530b..435a8344e 100644--- a/apps/web/src/lib/get-task-item-stats.test.ts+++ b/apps/web/src/lib/get-task-item-stats.test.ts@@ -1,7 +1,7 @@import { describe, expect, it } from "vitest";import { getTaskItemStats } from "./get-task-item-stats";-describe("getTaskItems", () => {+describe("getTaskItemStats", () => {it("returns zeroes for an empty description", () => {expect(getTaskItemStats(null)).toEqual({ total: 0, completed: 0 });expect(getTaskItemStats("")).toEqual({ total: 0, completed: 0 });@@ -29,6 +29,14 @@ describe("getTaskItems", () => {).toEqual({ total: 2, completed: 1 });});+ it("does not count task items in blockquoted fenced code blocks", () => {+ expect(+ getTaskItemStats(+ "> ```md\n> - [ ] Example\n> ```\n> - [x] Real item",+ ),+ ).toEqual({ total: 1, completed: 1 });+ });+it("supports blockquoted task-list items", () => {expect(getTaskItemStats("> - [x] Quoted item")).toEqual({total: 1,diff --git a/apps/web/src/lib/get-task-item-stats.ts b/apps/web/src/lib/get-task-item-stats.tsindex dc36406e9..317359c41 100644--- a/apps/web/src/lib/get-task-item-stats.ts+++ b/apps/web/src/lib/get-task-item-stats.ts@@ -5,13 +5,21 @@ type TaskItemsStats = {const TASK_ITEM_PATTERN =/^\s*(?:>\s*)*(?:[-+*]|\d{1,9}[.)])\s+\[([ xX])\](?:\s|$)/;-const FENCE_PATTERN = /^\s*(`{3,}|~{3,})/;+const FENCE_PATTERN = /^\s*(?:>\s*)*(`{3,}|~{3,})/;/**- * Get task items count from a task description.+ * Counts Markdown task-list items in a task description.*- * @param description - Task description- * @returns Object with completed and total items+ * A task item must start a line (after indentation and optional blockquote+ * prefixes), use a bullet or an ordered-list marker, and have a `[ ]` or+ * `[x]` checkbox. Other checkbox-like text is intentionally ignored.+ *+ * Lines inside fenced code blocks are excluded. Fences may be backticks or+ * tildes, including within blockquotes; a closing fence must use the same+ * character and be at least as long as its opening fence.+ *+ * @param description - Markdown task description, or null when absent.+ * @returns The total number of task items and the number marked complete.*/export function getTaskItemStats(description: string | null): TaskItemsStats {if (!description) return { total: 0, completed: 0 };diff --git a/apps/web/src/store/user-preferences.ts b/apps/web/src/store/user-preferences.tsindex 891fcf555..36a83c7ee 100644--- a/apps/web/src/store/user-preferences.ts+++ b/apps/web/src/store/user-preferences.ts@@ -115,6 +115,7 @@ export const useUserPreferencesStore = create<UserPreferencesStore>()(showLabels: true,showTaskNumbers: true,showPriority: true,+ showTaskItemCounts: true,}),sidebarDefaultOpen: true,