Repository: platers/obsidian-linter (ts)

Issue:
Capitalize Headings rule is applied to lines that start with a tag
With the option enabled, this text
```
# title

This note is #incomplete because I was distracted

#incomplete because I was distracted
```
turns into this
```
# Title

This note is #incomplete because I was distracted

#incomplete Because I Was Distracted
```

The rule shouldn't have applied it to the last line, which starts with a tag. (No space after #)


Pull request description:
fix capitalize headings applying to tags
fixes #117 

Patch:
diff --git a/src/utils.ts b/src/utils.ts
index b7d67db..358f3de 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -4,7 +4,7 @@ import type {Position} from 'unist';
 
 // Useful regexes
 
-export const headerRegex = /^(\s*)(#+)(\s*)(.*)$/;
+export const headerRegex = /^(\s*)(#+)(\s+)(.*)$/;
 export const fencedRegexTemplate = '^XXX\\.*?\n(?:((?:.|\n)*?)\n)?XXX(?=\\s|$)$';
 export const yamlRegex = /^---\n(?:((?:.|\n)*?)\n)?---(?=\n|$)/;
 export const backtickBlockRegexTemplate = fencedRegexTemplate.replaceAll('X', '`');


Test patch:
diff --git a/src/test.ts b/src/test.ts
index 97c3e71..0f6fe52 100644
--- a/src/test.ts
+++ b/src/test.ts
@@ -172,6 +172,15 @@ describe('Rules tests', () => {
         `;
       expect(rulesDict['capitalize-headings'].apply(before, {'Style': 'Title Case'})).toBe(after);
     });
+    it('Ignores tags', () => {
+      const before = dedent`
+        #tag not line
+        `;
+      const after = dedent`
+        #tag not line
+        `;
+      expect(rulesDict['capitalize-headings'].apply(before, {'Style': 'Title Case'})).toBe(after);
+    });
   });
   describe('File Name Heading', () => {
     it('Handles stray dashes', () => {