We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ce5f7b6 commit 4a6e940Copy full SHA for 4a6e940
1 file changed
crates/ruff_markdown/src/lib.rs
@@ -21,7 +21,7 @@ static MARKDOWN_CODE_FENCE: LazyLock<Regex> = LazyLock::new(|| {
21
^
22
(?<indent>\s*)
23
(?<fence>(?:```+|~~~+))\s*
24
- (?<language>(?:\w+)?)\s*
+ \{?(?<language>(?:\w+)?)\}?\s*
25
(?<info>(?:.*))\s*
26
$
27
",
@@ -384,4 +384,30 @@ print( 'hello' )
384
&FormatterSettings::default()
385
), @"Unchanged");
386
}
387
+
388
+ #[test]
389
+ fn format_code_blocks_quarto() {
390
+ let code = r#"
391
+```{py}
392
+print( 'hello' )
393
+```
394
395
+~~~{pyi}
396
+def foo(): ...
397
398
399
+def bar(): ...
400
+~~~
401
+ "#;
402
+ assert_snapshot!(format_code_blocks(code, None, &FormatterSettings::default()), @r#"
403
+ ```{py}
404
+ print("hello")
405
+ ```
406
407
+ ~~~{pyi}
408
+ def foo(): ...
409
+ def bar(): ...
410
+ ~~~
411
+ "#);
412
+ }
413
0 commit comments