Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Blockquote Style removes code block indentation #1055

Closed
1 task done
mahtaran opened this issue Mar 22, 2024 · 8 comments · Fixed by #1059
Closed
1 task done

Bug: Blockquote Style removes code block indentation #1055

mahtaran opened this issue Mar 22, 2024 · 8 comments · Fixed by #1059
Assignees
Labels
bug Something isn't working markdown General Markdown or Markdown related issue or feature resolution/update-made A change has been made that should resolve this issue or request

Comments

@mahtaran
Copy link
Contributor

  • I have verified that I am on the latest version of the Linter

Describe the Bug

When blockquote style is turned on, it will remove indentation inside code blocks.

How to Reproduce

Given the following example:

> Example blockquote
>Wrongly indented line
> 
> ```javascript
> function greet() {
>     console.log("Hello mom!")
> }
> ```

Expected Behaviour

> Example blockquote
> Wrongly indented line
> 
> ```javascript
> function greet() {
>     console.log("Hello mom!")
> }
> ```

Actual Behaviour

> 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 which will skip any lines inside the code block.

@pjkaufman
Copy link
Collaborator

pjkaufman commented Mar 22, 2024

Hey @mahtaran . If we are saying saying that we are ignoring code blocks in blockquotes altogether, then we would add them to an ignore list. But if we are saying we still need to apply the blockqoute style to those lines then a flag would be needed.

It probably makes sense to just ignore code blocks in blockquotes because having no spaces would slowly remove all spaces inside the code block.

@mahtaran
Copy link
Contributor Author

Yeah, I feel like ignoring any content within code blocks might be the best solution.

@pjkaufman
Copy link
Collaborator

pjkaufman commented Mar 22, 2024

It will ignore the blockquote indicators as well. So that means it would end up being something like the following to the rule:

> Example blockquote
>Wrongly indented line
> 
> {CODE_BLOCK}

@pjkaufman
Copy link
Collaborator

Does that sound like the intended result? It will replace {CODE_BLOCK} with its original content.

@pjkaufman pjkaufman added the bug Something isn't working label Mar 22, 2024
@mahtaran
Copy link
Contributor Author

Yes! Perhaps it could still check the indentation before the opening backticks, but apart from that I'd leave it up to the user how they want to indent their code.

@pjkaufman
Copy link
Collaborator

I think it would still allow for the opening backticks, but the rest would be unaffected.

@pjkaufman pjkaufman self-assigned this Mar 22, 2024
@pjkaufman pjkaufman added the markdown General Markdown or Markdown related issue or feature label Mar 22, 2024
@pjkaufman
Copy link
Collaborator

I believe I have a fix. It just needs to finish running the CI and if that passes, I will go ahead and merge it.

@pjkaufman pjkaufman added the resolution/update-made A change has been made that should resolve this issue or request label Mar 22, 2024
@pjkaufman
Copy link
Collaborator

I have merged the change. So this issue should be fixed on master and in the next release. Please let us know if it is not working in either case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working markdown General Markdown or Markdown related issue or feature resolution/update-made A change has been made that should resolve this issue or request
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

2 participants