From 5b90061ca49336664e3bae6997cd09672926c842 Mon Sep 17 00:00:00 2001 From: Peter Kaufman Date: Mon, 5 Dec 2022 20:54:38 -0500 Subject: [PATCH 1/2] updated the version for release and went ahead and allowed ignoring case for capitalizing first letter --- __tests__/capitalize-headings.test.ts | 6 ++++-- manifest.json | 2 +- package.json | 2 +- src/rules/capitalize-headings.ts | 7 ++++++- versions.json | 1 + 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/__tests__/capitalize-headings.test.ts b/__tests__/capitalize-headings.test.ts index 7f875ef9..37100368 100644 --- a/__tests__/capitalize-headings.test.ts +++ b/__tests__/capitalize-headings.test.ts @@ -53,6 +53,7 @@ ruleTest({ `, options: { style: 'First letter', + ignoreCasedWords: false, }, }, { @@ -135,15 +136,16 @@ ruleTest({ `, options: { style: 'First letter', + ignoreCasedWords: false, }, }, { - testName: `Make sure that 'First Letter' doesn't ignore cased words just because they are cased when ignore cased words is enabled`, + testName: `Make sure that 'First Letter' ignores cased words just because they are cased when ignore cased words is enabled`, before: dedent` ### This Header is Cased `, after: dedent` - ### This header is cased + ### This Header is Cased `, options: { style: 'First letter', diff --git a/manifest.json b/manifest.json index 1b967835..d507b061 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-linter", "name": "Linter", - "version": "1.8.0", + "version": "1.9.0", "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 bc767f8e..2e38411c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-linter", - "version": "1.8.0", + "version": "1.9.0", "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/capitalize-headings.ts b/src/rules/capitalize-headings.ts index 2523add6..276b2569 100644 --- a/src/rules/capitalize-headings.ts +++ b/src/rules/capitalize-headings.ts @@ -86,7 +86,7 @@ export default class CapitalizeHeadings extends RuleBuilder Date: Mon, 5 Dec 2022 20:58:09 -0500 Subject: [PATCH 2/2] added documentation for the release --- README.md | 2 ++ docs/rules.md | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 945a8f92..9998a92c 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ Each rule is its own set of logic and is designed to be run independently. This - [capitalize-headings](https://github.com/platers/obsidian-linter/blob/master/docs/rules.md#capitalize-headings) - [file-name-heading](https://github.com/platers/obsidian-linter/blob/master/docs/rules.md#file-name-heading) - [header-increment](https://github.com/platers/obsidian-linter/blob/master/docs/rules.md#header-increment) +- [headings-start-line](https://github.com/platers/obsidian-linter/blob/master/docs/rules.md#headings-start-line) +- [remove-trailing-punctuation-in-heading](https://github.com/platers/obsidian-linter/blob/master/docs/rules.md#remove-trailing-punctuation-in-heading) ### Footnote rules diff --git a/docs/rules.md b/docs/rules.md index 333a7ddb..aba42a93 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -993,7 +993,7 @@ Options: - Ignore Cased Words: Only apply title case style to words that are all lowercase - Default: `true` - Ignore Words: A comma separated list of words to ignore when capitalizing - - Default: `macOS, iOS, iPhone, iPad, JavaScript, TypeScript, AppleScript` + - Default: `macOS, iOS, iPhone, iPad, JavaScript, TypeScript, AppleScript, I` - Lowercase Words: A comma separated list of words to keep lowercase - Default: `via, a, an, the, and, or, but, for, nor, so, yet, at, by, in, of, on, to, up, as, is, if, it, for, to, with, without, into, onto, per` @@ -1186,6 +1186,86 @@ This resets the decrement section so the H6 below is decremented to an H3 ### H6 `````` +### Headings Start Line + +Alias: `headings-start-line` + +Headings that do not start a line will have their preceding whitespace removed to make sure they get recognized as headers. + + + +Example: Removes spaces prior to a heading + +Before: + +``````markdown + ## Other heading preceded by 2 spaces ## +_Note that if the spacing is enough for the header to be considered to be part of a codeblock it will not be affected by this rule._ +`````` + +After: + +``````markdown +## Other heading preceded by 2 spaces ## +_Note that if the spacing is enough for the header to be considered to be part of a codeblock it will not be affected by this rule._ +`````` +Example: Tags are not affected by this + +Before: + +``````markdown + #test + # Heading & +`````` + +After: + +``````markdown + #test +# Heading & +`````` + +### Remove Trailing Punctuation in Heading + +Alias: `remove-trailing-punctuation-in-heading` + +Removes the specified punctuation from the end of headings making sure to ignore the semicolon at the end of [HTML entity references](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references). + +Options: +- Trailing Punctuation: The trailing punctuation to remove from the headings in the file. + - Default: `.,;:!。,;:!` + +Example: Removes punctuation from the end of a heading + +Before: + +``````markdown +# Heading ends in a period. +## Other heading ends in an exclamation mark! ## +`````` + +After: + +``````markdown +# Heading ends in a period +## Other heading ends in an exclamation mark ## +`````` +Example: HTML Entities at the end of a heading is ignored + +Before: + +``````markdown +# Heading 1 +## Heading & +`````` + +After: + +``````markdown +# Heading 1 +## Heading & +`````` + ## Footnote ### Footnote after Punctuation @@ -1208,6 +1288,23 @@ After: ``````markdown Lorem.[^1] Ipsum,[^2] doletes. `````` +Example: A footnote at the start of a task is not moved to after the punctuation + +Before: + +``````markdown +- [ ] [^1]: This is a footnote and a task. +- [ ] This is a footnote and a task that gets swapped with the punctuation[^2]! +[^2]: This footnote got modified +`````` + +After: + +``````markdown +- [ ] [^1]: This is a footnote and a task. +- [ ] This is a footnote and a task that gets swapped with the punctuation![^2] +[^2]: This footnote got modified +`````` ### Move Footnotes to the bottom