Support Quarto Markdown language markers#22947
Conversation
92c2086 to
4a6e940
Compare
|
Rebuilt this PR on latest main using a simpler regex change, and updated the test cases. |
ntBre
left a comment
There was a problem hiding this comment.
Looks good to me, thank you!
|
Currently, no, ruff will still only trigger markdown formatting on file extensions matching exactly |
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLC2701 | 1965 | 987 | 978 | 0 | 0 |
| AIR321 | 462 | 0 | 462 | 0 | 0 |
Formatter (stable)
✅ ecosystem check detected no format changes.
Formatter (preview)
✅ ecosystem check detected no format changes.
|
Hmm, in that case I'm not sure it's worth landing the regex change on its own. Should we consider allowing the |
|
Is it worth making a documentation change for this? |
|
Yeah, I guess it's probably worth mentioning briefly somewhere. |
|
Added small example of quarto style, along with examples for the normal py/pyi styles. Any better example you would suggest, or changes to wording? |
- Regex to allow curly braces around language name - Test cases
5fbc4b3 to
730d4e0
Compare
|
For anyone who might be interested in this, I have created a auto-formatter for Pandoc markdown, including Quarto and RMarkdown: https://github.com/jolars/panache It allows delegating formatting of code blocks to external formatters, like ruff, or whatever else, by specifying a configuration setting (in [formatters.python]
preset = "ruff"It of course also formats the actual markdown content properly. |
See this comment from #22470. Also related to #6140.
Summary
Add support for formatting code blocks with curly brace syntax (e.g., ```{python}, ```{py}, ```{pyi}) in Markdown files. This syntax is commonly used in tools like Quarto and R Markdown.
The regex pattern now matches both the standard syntax (```python) and the curly brace variant (```{python}).
Test Plan
Added test cases.
Fix #22951