Repository: platers/obsidian-linter (ts)

Issue:
Bug: Move Tags to Yaml incorrectly identifies titles with # in the hyperlink as labels
## Describe the Bug

`Move Tags to Yaml` incorrectly identifies titles with # in the hyperlink as labels

## How to Reproduce

Paste the following text into Obsidian

``` markdown
Hyperlink example: 
[Travis Linux builds failing: can't find FFTW · Issue #152 · SHTOOLS/SHTOOLS · GitHub](https://github.com/SHTOOLS/SHTOOLS/issues/152)
```

with rules setting like this:

![1673245016572](https://user-images.githubusercontent.com/30110832/211250218-8c11bbd3-6e12-499a-a22c-2f0ecc8e22eb.png)

After Linter, the tags field in the yaml section will have an additional tag named 152, due to the text `Issue #152` in the link title being recognized as a note tag

```yaml
---
tags: [152]
---
```

DEBUG logs as follows:
```
Running linter
Running Move Tags to Yaml
Running YAML Title
Running Headings Start Line
Running Remove Trailing Punctuation in Heading
Running Remove Consecutive List Markers
Running Remove Empty List Markers
Running Remove Hyphenated Line Breaks
Running Remove Multiple Spaces
Running Empty Line Around Blockquotes
Running Empty Line Around Code Fences
Running Empty Line Around Math Blocks
Running Empty Line Around Tables
Running Heading blank lines
Running Remove link spacing
Running Space between Chinese Japanese or Korean and English or numbers
Running Trailing spaces
Running Custom Regex
Running YAML Timestamp
Running Custom Lint Commands
```

## Expected Behavior

Ignore `#` content in the note text (images, web links, etc.) as these are not tagging the note

## Device

- [x] Desktop
- [ ] Mobile



Pull request description:
Make Sure Tag Like Values in Markdown Links and Wiki Links are Ignored
Fixes #579 

Changes Made:
- Ignored wiki links and markdown links in order to prevent them from being affected by moving tag info

Patch:
diff --git a/src/rules/move-tags-to-yaml.ts b/src/rules/move-tags-to-yaml.ts
index 9905b26..4572537 100644
--- a/src/rules/move-tags-to-yaml.ts
+++ b/src/rules/move-tags-to-yaml.ts
@@ -42,7 +42,7 @@ export default class MoveTagsToYaml extends RuleBuilder<MoveTagsToYamlOptions> {
     return RuleType.YAML;
   }
   apply(text: string, options: MoveTagsToYamlOptions): string {
-    return ignoreListOfTypes([IgnoreTypes.code, IgnoreTypes.inlineCode, IgnoreTypes.math, IgnoreTypes.html], text, (text) => {
+    return ignoreListOfTypes([IgnoreTypes.code, IgnoreTypes.inlineCode, IgnoreTypes.math, IgnoreTypes.html, IgnoreTypes.wikiLink, IgnoreTypes.link], text, (text) => {
       const tags = matchTagRegex(text);
       if (tags.length === 0) {
         return text;


Test patch:
diff --git a/__tests__/move-tags-to-yaml.test.ts b/__tests__/move-tags-to-yaml.test.ts
index 6461b24..49728fe 100644
--- a/__tests__/move-tags-to-yaml.test.ts
+++ b/__tests__/move-tags-to-yaml.test.ts
@@ -183,5 +183,19 @@ ruleTest({
         tagsToIgnore: ['ignored-tag', 'ignored-tag/nested-tag'],
       },
     },
+    { // accounts for https://github.com/platers/obsidian-linter/issues/579
+      testName: 'Make sure wiki link and markdown link text is ignored for this',
+      before: dedent`
+        [Issue #152 on Github](some_link.md)
+        [[some_link|Issue #152 on Github]]]
+      `,
+      after: dedent`
+        [Issue #152 on Github](some_link.md)
+        [[some_link|Issue #152 on Github]]]
+      `,
+      options: {
+        tagArrayStyle: TagSpecificArrayFormats.SingleStringSpaceDelimited,
+      },
+    },
   ],
 });