Support markdown in extension mappings#23218
Merged
Conversation
- Adds `Language::Markdown` with the `"md"` language name - Moves the `From<Language>` impl from `PySourceType` to `SourceType` - Adds new `mapped_path()` and `mapped_extension()` methods to `ExtensionMapping` - Updated all usess of `ExtensionMapping` use these methods - Refactored uses to work with `SourceType`, which combined with the above, generally resulted in greatly simplified code/matching. Issue #23204
Member
Author
|
Not sold on the new methods name, so happy to get suggestions for more idiomatic names. |
|
ntBre
approved these changes
Feb 11, 2026
Contributor
ntBre
left a comment
There was a problem hiding this comment.
Thanks, this makes sense to me.
| } | ||
|
|
||
| /// Return a mapped [`SourceType`] for a given path. | ||
| pub fn mapped_path(&self, path: &Path) -> SourceType { |
Contributor
There was a problem hiding this comment.
Not sure about the best name either. I would probably call this get_source_type, but that leaves the pretty unwieldy get_source_type_by_extension or similar for the other variant.
Member
Author
There was a problem hiding this comment.
I'd considered that and hesitated, but on today's brain I like that better than "mapped_X".
amyreese
added a commit
that referenced
this pull request
Feb 25, 2026
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.
Language::Markdownwith the"md"language nameFrom<Language>impl fromPySourceTypetoSourceTypemapped_path()andmapped_extension()methods toExtensionMappingExtensionMappinguse these methodsSourceType, which combined with theabove, generally resulted in greatly simplified code/matching.
Issue #23204