Repository: platers/obsidian-linter (ts)

Issue:
Bug: Blockquote Style removes code block indentation
- [x] I have verified that I am on the latest version of the Linter

## Describe the Bug

When [blockquote style](https://platers.github.io/obsidian-linter/settings/content-rules/#blockquote-style) is turned on, it will remove indentation inside code blocks.

## How to Reproduce

Given the following example:

```markdown
> Example blockquote
>Wrongly indented line
> 
> ```javascript
> function greet() {
>     console.log("Hello mom!")
> }
> ```
```

### Expected Behaviour

```markdown
> Example blockquote
> Wrongly indented line
> 
> ```javascript
> function greet() {
>     console.log("Hello mom!")
> }
> ```
```

### Actual Behaviour

```markdown
> Example blockquote
> Wrongly indented line
> 
> ```javascript
> function greet() {
> console.log("Hello mom!")
> }
> ```
```

## Additional Context

I believe this issue could be resolved by defining an `insideCodeBlock` flag in [updateBlockquoteLines](https://github.com/platers/obsidian-linter/blob/5e96e0ec59eba39acc352fd787adf400190aedff/src/rules/blockquote-style.ts#L58) which will skip any lines inside the code block.

Pull request:
Fix: `Blockquote Style` Removes Spaces in Code Blocks
Fixes #1055 

There was an issue where `Blockquote Style` was removing spaces in a code block if it was in a blockquote. This can mess up code formatting. So to fix this, we will ignore code blocks from the `Blockquote Style` rule.

Changes Made:
- Cleaned up tests to no longer have indentation based code blocks in it
- Added a UT for the scenario in question
- Added code blocks to the ignore list for blockquote style

Patch:
diff --git a/src/rules/blockquote-style.ts b/src/rules/blockquote-style.ts
index ab45e4a..355c07a 100644
--- a/src/rules/blockquote-style.ts
+++ b/src/rules/blockquote-style.ts
@@ -20,7 +20,7 @@ export default class BlockquoteStyle extends RuleBuilder<BlockquoteStyleOptions>
       descriptionKey: 'rules.blockquote-style.description',
       type: RuleType.CONTENT,
       hasSpecialExecutionOrder: true, // to make sure we run after the other rules to make sure all blockquotes are affected and follow the same style
-      ruleIgnoreTypes: [IgnoreTypes.html],
+      ruleIgnoreTypes: [IgnoreTypes.html, IgnoreTypes.code],
     });
   }
   get OptionsClass(): new () => BlockquoteStyleOptions {


Test patch:
diff --git a/__tests__/blockquote-style.test.ts b/__tests__/blockquote-style.test.ts
index 5841e3d..7ca1a79 100644
--- a/__tests__/blockquote-style.test.ts
+++ b/__tests__/blockquote-style.test.ts
@@ -34,7 +34,7 @@ ruleTest({
       before: dedent`
         >   Text here
         >     >           More Text Here
-        > \t > \t\t\t >Some More Text
+        > \t > \t >Some More Text
         >>>>\tJust a Tab
       `,
       after: dedent`
@@ -80,8 +80,8 @@ ruleTest({
         >   2) Ordered item 2
         >   - [ ] Checklist item
         >- List item 4
-        > >  >   \t > - List item 5
-        > >  >   \t > > - List item 6
+        > >  > \t > - List item 5
+        > >  > \t > > - List item 6
       `,
       after: dedent`
         >Text here
@@ -97,5 +97,29 @@ ruleTest({
       `,
       options: {style: 'no space'},
     },
+    { // accounts for https://github.com/platers/obsidian-linter/issues/1055
+      testName: 'Code blocks in a blockquote should not have their spacing affected since that can remove indentation for code',
+      before: dedent`
+        > Example blockquote
+        >Wrongly indented line
+        > 
+        >\`\`\`javascript
+        > function greet() {
+        >     console.log("Hello mom!")
+        > }
+        > \`\`\`
+      `,
+      after: dedent`
+        > Example blockquote
+        > Wrongly indented line
+        > 
+        > \`\`\`javascript
+        > function greet() {
+        >     console.log("Hello mom!")
+        > }
+        > \`\`\`
+      `,
+      options: {style: 'space'},
+    },
   ],
 });