Repository: platers/obsidian-linter (ts)

Issue:
FR: "ignore cased word" Should Affect First Letter Capitalization
## Describe the Bug

A clear and concise description of what the bug is.

## How to Reproduce

Steps to reproduce the behavior:

1. Go to "H1 heading" tab,
2. Check the "ignore cased word" option,
3. select the style to "First letter",
4. format

The word with upper case letters is still formatted as lower case letters.

## Expected Behavior

Only apply the "First letter" rule to the words with all lower case letters.

## Device

- [x] Desktop
- [ ] Mobile


Pull request:
Update Versions for Release and Add Ability to Ignore Cased Words for First Letter Capitalization
Fixes #526 

Changes Made:
- Updated the capitalization rule to ignore cased words for first letter and updated the UTs to reflect this
- Updated version info
- Generated documentation for the release as well

Patch:
diff --git a/README.md b/README.md
index 945a8f9..9998a92 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 333a7dd..aba42a9 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 &amp;
+``````
+
+After:
+
+``````markdown
+  #test
+# Heading &amp;
+``````
+
+### 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 &amp;
+``````
+
+After:
+
+``````markdown
+# Heading 1
+## Heading &amp;
+``````
+
 ## 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
 
diff --git a/manifest.json b/manifest.json
index 1b96783..d507b06 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 bc767f8..2e38411 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 2523add..276b256 100644
--- a/src/rules/capitalize-headings.ts
+++ b/src/rules/capitalize-headings.ts
@@ -86,7 +86,7 @@ export default class CapitalizeHeadings extends RuleBuilder<CapitalizeHeadingsOp
             continue;
           }
 
-          const ignoreCasedWord = (options.ignoreCasedWords && !capitalizeJustFirstLetter) && headerWords[j] !== headerWords[j].toLowerCase();
+          const ignoreCasedWord = options.ignoreCasedWords && headerWords[j] !== headerWords[j].toLowerCase();
           const keepWordCasing = ignoreCasedWord || keepCasing.includes(headerWords[j]);
           if (!keepWordCasing) {
             headerWords[j] = headerWords[j].toLowerCase();
@@ -97,6 +97,11 @@ export default class CapitalizeHeadings extends RuleBuilder<CapitalizeHeadingsOp
           }
 
           firstWord = false;
+
+          // if the user wants to keep casing and capitalize just the first letter then there is no need to lowercase any other word after the first word
+          if (options.ignoreCasedWords && capitalizeJustFirstLetter) {
+            break;
+          }
         }
 
         headerText = escapeDollarSigns(`${headerWords.join(' ')}`);
diff --git a/versions.json b/versions.json
index aaedcad..05cc33f 100644
--- a/versions.json
+++ b/versions.json
@@ -1,4 +1,5 @@
 {
+	"1.9.0": "0.15.6",
 	"1.8.0": "0.15.6",
 	"1.7.1": "0.15.6",
 	"1.7.0": "0.15.6",


Test patch:
diff --git a/__tests__/capitalize-headings.test.ts b/__tests__/capitalize-headings.test.ts
index 7f875ef..3710036 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',