Preserve whitespace for Quarto cell option comments - #25641
Merged
MichaReiser merged 3 commits intoJun 5, 2026
Conversation
Member
|
I have to think about this but I think i'm fine with this. Seems a popular feature justifying adding an exception. It also feels very unlikely that someone writes a comment starting with |
Contributor
Author
|
@MichaReiser thanks for giving it some consideration. I felt this could at least get some conversation going. I work with the Quarto team, so please let me know if you have any follow up questions! |
|
| to the list of allowed comment start characters
Member
|
Thanks for proposing and implementing this change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #6140, which is nicely summarized into 2 parts here #6140 (comment)
I saw that you all now support formatting markdown files (#22470) and can support
.qmdvia some user configuration (#23218, #23384, #23572).Since ruff can now directly format a
.qmd, I thought it would be nice if this bug was fixed:With
ruff.tomlof:test.qmd:A call to
ruff format test.qmd --previewresults inNote how the special quarto code cell directive
#|became# |.Note this would diverge from black's behavior. There was a request to change this in black, but it was closed psf/black#3557. But I'm hoping that the fact that ruff can support qmds directly may make this compelling enough for ruff to diverge?
Test Plan
Added a new snapshot test file.
Note the the black compatibility file
comments.pydoes exist already, but it did not feel appropriate to add this there.