diff --git a/package.json b/package.json index 8b4d45fb..0de13cf2 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "build": "tsdown", "prepare": "npm run build", "test": "node --experimental-default-config-file --test --experimental-test-coverage", - "test:update": "npm test -- --experimental-test-snapshots", + "test:update": "npm test -- --test-update-snapshots", "lint": "npm run lint:biome && npm run lint:tsc", "lint:biome": "biome check .", "lint:tsc": "tsc -p ./tsconfig.lint.json", diff --git a/src/block/node/index.ts b/src/block/node/index.ts index 47375494..bc4fe954 100644 --- a/src/block/node/index.ts +++ b/src/block/node/index.ts @@ -54,9 +54,9 @@ export const convertToNodes: ReturnType = NumberListNodeParser, CodeNodeParser, CommandLineNodeParser, - FormulaNodeParser, BlankNodeParser, DecorationNodeParser, + FormulaNodeParser, StrongImageNodeParser, StrongIconNodeParser, StrongNodeParser, diff --git a/test/line/formula.test.ts b/test/line/formula.test.ts index b7842e9d..52b70d89 100644 --- a/test/line/formula.test.ts +++ b/test/line/formula.test.ts @@ -17,4 +17,11 @@ describe("formula", () => { it("Formula includes [] without tail half-space", ({ assert }) => { assert.snapshot(parse("[$ [x]]", { hasTitle: false })); }); + + // ref. https://github.com/progfay/scrapbox-parser/issues/1892 + it("Formula followed immediately by a decoration notation with trailing spaces", ({ + assert, + }) => { + assert.snapshot(parse("[$ 1+1=2][. [link] ]", { hasTitle: false })); + }); }); diff --git a/test/line/formula.test.ts.snapshot b/test/line/formula.test.ts.snapshot index b20ba612..5c9ed84f 100644 --- a/test/line/formula.test.ts.snapshot +++ b/test/line/formula.test.ts.snapshot @@ -1,3 +1,41 @@ +exports[`formula > Formula followed immediately by a decoration notation with trailing spaces 1`] = ` +[ + { + "indent": 0, + "type": "line", + "nodes": [ + { + "type": "formula", + "raw": "[$ 1+1=2]", + "formula": "1+1=2" + }, + { + "type": "decoration", + "raw": "[. [link] ]", + "rawDecos": ".", + "decos": [ + "." + ], + "nodes": [ + { + "type": "link", + "raw": "[link]", + "pathType": "relative", + "href": "link", + "content": "" + }, + { + "type": "plain", + "raw": " ", + "text": " " + } + ] + } + ] + } +] +`; + exports[`formula > Formula includes [] with tail half-space 1`] = ` [ {