Repository: platers/obsidian-linter (ts)

Issue:
Bug: Smart quotes get applied in Markdown image links
- [x] I have verified that I am on the latest version of the Linter

## Describe the Bug

Markdown image links do not get ignored, even though regular Markdown links are.

## How to Reproduce

Example to reproduce issue with

``` markdown
![link](https://test.it 'Test title')
```

## Expected Behavior

It should ignore the quotes, as they exist within a Markdown style image link.

## Device

- [x] Desktop
- [ ] Mobile

## Additional Context

I have made [a failing test](https://github.com/platers/obsidian-linter/commit/5818d0582cd6b7d97c70de1d91fe55593e071107), but have not been able to find the cause.

It seems that [the correct exceptions are already applied](https://github.com/platers/obsidian-linter/blob/952bba9d7b6a4f084d68ffdd469bd89e785206b2/src/rules/quote-style.ts#L32) and that [the link exception](https://github.com/platers/obsidian-linter/blob/952bba9d7b6a4f084d68ffdd469bd89e785206b2/src/utils/ignore-types.ts#L33)’s [RegEx already properly checks for the optional `!`](https://github.com/platers/obsidian-linter/blob/952bba9d7b6a4f084d68ffdd469bd89e785206b2/src/utils/regex.ts#L15) which makes it an image link.

Yet it fails on image links, but not on regular links.

Pull request:
Fix: Ignore Images for `Quote Style`
Fixes #1109 

There was an issue where `Quote Style` could affect the link to an image if it contained quotes. To prevent this, we will ignore images.

Changes Made:
- Added a UT for the situation in question
- Added images to the ignore list for `Quote Style`

Patch:
diff --git a/src/rules/quote-style.ts b/src/rules/quote-style.ts
index e620d81..d9abcd2 100644
--- a/src/rules/quote-style.ts
+++ b/src/rules/quote-style.ts
@@ -29,7 +29,7 @@ export default class QuoteStyle extends RuleBuilder<QuoteStyleOptions> {
       nameKey: 'rules.quote-style.name',
       descriptionKey: 'rules.quote-style.description',
       type: RuleType.CONTENT,
-      ruleIgnoreTypes: [IgnoreTypes.code, IgnoreTypes.inlineCode, IgnoreTypes.math, IgnoreTypes.yaml, IgnoreTypes.math, IgnoreTypes.inlineMath, IgnoreTypes.html, IgnoreTypes.link, IgnoreTypes.wikiLink, IgnoreTypes.templaterCommand],
+      ruleIgnoreTypes: [IgnoreTypes.code, IgnoreTypes.inlineCode, IgnoreTypes.math, IgnoreTypes.yaml, IgnoreTypes.math, IgnoreTypes.inlineMath, IgnoreTypes.html, IgnoreTypes.link, IgnoreTypes.wikiLink, IgnoreTypes.templaterCommand, IgnoreTypes.image],
     });
   }
   get OptionsClass(): new () => QuoteStyleOptions {


Test patch:
diff --git a/__tests__/quote-style.test.ts b/__tests__/quote-style.test.ts
index 69ca87a..ace436a 100644
--- a/__tests__/quote-style.test.ts
+++ b/__tests__/quote-style.test.ts
@@ -123,5 +123,17 @@ ruleTest({
         singleQuoteStyle: SingleQuoteStyles.SmartQuote,
       },
     },
+    { // accounts for https://github.com/platers/obsidian-linter/issues/1109
+      testName: 'Make sure quotes in markdown image links get ignored',
+      before: dedent`
+        ![link](https://test.it 'Test title')
+      `,
+      after: dedent`
+        ![link](https://test.it 'Test title')
+      `,
+      options: {
+        singleQuoteStyle: SingleQuoteStyles.SmartQuote,
+      },
+    },
   ],
 });