diff --git a/package.json b/package.json index ea54cc5d..5ff632c8 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "release-it": "^17.0.0", "sentences-per-line": "^0.2.1", "should-semantic-release": "^0.2.1", - "tsup": "^8.0.0", + "tsup": "^8.0.1", "typescript": "^5.2.2", "vitest": "^1.0.0", "yaml-eslint-parser": "^1.2.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9efa9c78..1ca5067a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -113,7 +113,7 @@ devDependencies: specifier: ^0.2.1 version: 0.2.1 tsup: - specifier: ^8.0.0 + specifier: ^8.0.1 version: 8.0.1(typescript@5.2.2) typescript: specifier: ^5.2.2 diff --git a/src/sentences-per-line.test.ts b/src/sentences-per-line.test.ts index 92697ec4..57ef94b5 100644 --- a/src/sentences-per-line.test.ts +++ b/src/sentences-per-line.test.ts @@ -46,6 +46,78 @@ Abc. Def. "Abc. Def.", 6, ], + [ + ` +\`\`\`plaintext +Abc! Def! +\`\`\` +`, + undefined, + ], + [ + ` +\`\`\`plaintext +Abc? Def? +\`\`\` +`, + undefined, + ], + [ + ` +\`\`\`plaintext +Abc? Def! +\`\`\` +`, + undefined, + ], + [ + ` +\`\`\`plaintext +Abc! Def? +\`\`\` +`, + undefined, + ], + [ + ` +\`\`\`plaintext +Abc! Def. +\`\`\` +`, + undefined, + ], + [ + ` +\`\`\`plaintext +Abc? Def. +\`\`\` +`, + undefined, + ], + [ + ` +\`\`\`plaintext +Abc. Def! +\`\`\` +`, + undefined, + ], + [ + ` +\`\`\`plaintext +Abc. Def? +\`\`\` +`, + undefined, + ], + [ + ` +\`\`\`plaintext +Abc. Def. +\`\`\` +`, + undefined, + ], ])("%s", (input, errorContext, lineNumber = 1) => { const actual = markdownlint.sync({ config: { diff --git a/src/sentences-per-line.ts b/src/sentences-per-line.ts index 751fbe24..1ef0bc90 100644 --- a/src/sentences-per-line.ts +++ b/src/sentences-per-line.ts @@ -86,10 +86,12 @@ const visitLine = ( } if ( - line[i] === "." && - line[i + 1] === " " && - isCapitalizedAlphabetCharacter(line[i + 2]) && - !isAfterIgnoredWord(line, i) + line[i] === "." || + line[i] === "!" || + (line[i] === "?" && + line[i + 1] === " " && + isCapitalizedAlphabetCharacter(line[i + 2]) && + !isAfterIgnoredWord(line, i)) ) { helpers.addError( onError,