diff --git a/package.json b/package.json index cdcb7abc..0dcaf765 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "build:vite": "vite build", "prepare": "npm run build", "test": "vitest run --coverage", - "test:update": "vitest run --updateSnapshot --no-cache", + "test:update": "vitest run -u", "lint": "run-p lint:*", "lint:biome": "biome check .", "lint:tsc": "tsc -p ./tsconfig.lint.json", diff --git a/src/block/node/NumberListNode.ts b/src/block/node/NumberListNode.ts index 4030b5d8..f6455349 100644 --- a/src/block/node/NumberListNode.ts +++ b/src/block/node/NumberListNode.ts @@ -25,7 +25,7 @@ const createNumberListNode: NodeCreator = ( raw, rawNumber, number, - nodes: convertToNodes(text, { ...opts, nested: true }), + nodes: convertToNodes(text, { ...opts, nested: false }), }, ]; }; diff --git a/src/block/node/index.ts b/src/block/node/index.ts index ddd19e4e..47375494 100644 --- a/src/block/node/index.ts +++ b/src/block/node/index.ts @@ -51,6 +51,7 @@ export const convertToNodes: ReturnType = FalsyEliminator, QuoteNodeParser, HelpfeelNodeParser, + NumberListNodeParser, CodeNodeParser, CommandLineNodeParser, FormulaNodeParser, @@ -65,5 +66,4 @@ export const convertToNodes: ReturnType = GoogleMapNodeParser, InternalLinkNodeParser, HashTagNodeParser, - NumberListNodeParser, ); diff --git a/tests/line/__snapshots__/numberList.test.ts.snap b/tests/line/__snapshots__/numberList.test.ts.snap index eda5f08b..99553ea1 100644 --- a/tests/line/__snapshots__/numberList.test.ts.snap +++ b/tests/line/__snapshots__/numberList.test.ts.snap @@ -1,5 +1,63 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`numberList > 1. with code 1`] = ` +[ + { + "indent": 0, + "nodes": [ + { + "nodes": [ + { + "raw": "\`code\`", + "text": "code", + "type": "code", + }, + ], + "number": 1, + "raw": "1. \`code\`", + "rawNumber": "1", + "type": "numberList", + }, + ], + "type": "line", + }, +] +`; + +exports[`numberList > 1. with decoration 1`] = ` +[ + { + "indent": 0, + "nodes": [ + { + "nodes": [ + { + "decos": [ + "*-1", + ], + "nodes": [ + { + "raw": "deco", + "text": "deco", + "type": "plain", + }, + ], + "raw": "[* deco]", + "rawDecos": "*", + "type": "decoration", + }, + ], + "number": 1, + "raw": "1. [* deco]", + "rawNumber": "1", + "type": "numberList", + }, + ], + "type": "line", + }, +] +`; + exports[`numberList > 1. with no space is not numberList 1`] = ` [ { diff --git a/tests/line/numberList.test.ts b/tests/line/numberList.test.ts index 8f9aeaba..0eceace7 100644 --- a/tests/line/numberList.test.ts +++ b/tests/line/numberList.test.ts @@ -18,6 +18,14 @@ describe("numberList", () => { ).toMatchSnapshot(); }); + it("1. with decoration", () => { + expect(parse("1. [* deco]", { hasTitle: false })).toMatchSnapshot(); + }); + + it("1. with code", () => { + expect(parse("1. `code`", { hasTitle: false })).toMatchSnapshot(); + }); + it("1. with no space is not numberList", () => { expect( parse("1.not numberList", {