Skip to content

Commit 35ed3d0

Browse files
committed
Use configured extension mapping to select code block language
1 parent 89b88c5 commit 35ed3d0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • crates/ruff_markdown/src

crates/ruff_markdown/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ pub fn format_code_blocks(
4545
for capture in MARKDOWN_CODE_BLOCK.captures_iter(source) {
4646
let (_, [before, code_indent, language, code, after]) = capture.extract();
4747

48-
let py_source_type = PySourceType::from_extension(language);
48+
let py_source_type = PySourceType::from(
49+
settings
50+
.extension
51+
.get(&Path::new("foo.py").with_extension(language))
52+
.unwrap_or_default(),
53+
);
4954
let unformatted_code = dedent(code);
5055
let options = settings.to_format_options(py_source_type, &unformatted_code, path);
5156

0 commit comments

Comments
 (0)