diff --git a/__tests__/consecutive-blank-lines.test.ts b/__tests__/consecutive-blank-lines.test.ts index 3caa9bcd..b9caf789 100644 --- a/__tests__/consecutive-blank-lines.test.ts +++ b/__tests__/consecutive-blank-lines.test.ts @@ -126,5 +126,59 @@ ruleTest({ Line 2 `, }, + { // accounts for https://github.com/platers/obsidian-linter/issues/538 + testName: 'Make sure that lists with a blank line between them are not affected since there are not 2 or more blank lines', + before: dedent` + - Item 1 + ${''} + - Subitem 1 + ${''} + - Subitem 2 + ${''} + - Sub sub item 1 + ${''} + - Sub sub item 2 + `, + after: dedent` + - Item 1 + ${''} + - Subitem 1 + ${''} + - Subitem 2 + ${''} + - Sub sub item 1 + ${''} + - Sub sub item 2 + `, + }, + { // accounts for https://github.com/platers/obsidian-linter/issues/543 + testName: 'Make sure that nested code blocks with a blank line between them are not affected since there are not 2 or more blank lines', + before: dedent` + 1. \`aaa\` bbbb, + 3. xxxxxxxxxxxxxxx + + \`\`\`csharp + private IProcessor[] GetProcessors() + { + return returnedProcessors.ToArray(); + } + \`\`\` + + 4. ccccccc, + `, + after: dedent` + 1. \`aaa\` bbbb, + 3. xxxxxxxxxxxxxxx + + \`\`\`csharp + private IProcessor[] GetProcessors() + { + return returnedProcessors.ToArray(); + } + \`\`\` + + 4. ccccccc, + `, + }, ], }); diff --git a/manifest.json b/manifest.json index d507b061..59fa417e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-linter", "name": "Linter", - "version": "1.9.0", + "version": "1.9.1", "minAppVersion": "0.15.6", "description": "Formats and styles your notes. It can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular markdown contents like list, italics, and bold styles; and more with the use of custom rule options as well.", "author": "Victor Tao", diff --git a/package.json b/package.json index 2e38411c..f73e9303 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-linter", - "version": "1.9.0", + "version": "1.9.1", "description": "Enforces consistent markdown styling for Obsidian (https://obsidian.md). It can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular markdown contents like list, italics, and bold styles; and more with the use of custom rule options as well.", "main": "main.js", "scripts": { diff --git a/src/rules/consecutive-blank-lines.ts b/src/rules/consecutive-blank-lines.ts index c7d68fc7..1e4160bb 100644 --- a/src/rules/consecutive-blank-lines.ts +++ b/src/rules/consecutive-blank-lines.ts @@ -23,7 +23,8 @@ export default class ConsecutiveBlankLines extends RuleBuilder { // make sure to account for lines that are purely whitespace as well https://stackoverflow.com/a/3873354/8353749 - return text.replace(/(\n([\t\v\f\r \u00a0\u2000-\u200b\u2028-\u2029\u3000]+)?){2,}/g, '\n\n'); + // make sure that the match ends in a newline + return text.replace(/(\n([\t\v\f\r \u00a0\u2000-\u200b\u2028-\u2029\u3000]+)?){2,}\n/g, '\n\n'); }); } get exampleBuilders(): ExampleBuilder[] { diff --git a/versions.json b/versions.json index 05cc33f1..4e6453cb 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ { + "1.9.1": "0.15.6", "1.9.0": "0.15.6", "1.8.0": "0.15.6", "1.7.1": "0.15.6",