Skip to content

Support markdown in extension mappings#23218

Merged
amyreese merged 2 commits intomainfrom
amy/extension-mapping
Feb 11, 2026
Merged

Support markdown in extension mappings#23218
amyreese merged 2 commits intomainfrom
amy/extension-mapping

Conversation

@amyreese
Copy link
Member

  • 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

- 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
@amyreese amyreese requested review from dylwil3 and ntBre February 11, 2026 00:55
@amyreese
Copy link
Member Author

Not sold on the new methods name, so happy to get suggestions for more idiomatic names.

@amyreese amyreese added internal An internal refactor or improvement configuration Related to settings and configuration labels Feb 11, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 11, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this makes sense to me.

}

/// Return a mapped [`SourceType`] for a given path.
pub fn mapped_path(&self, path: &Path) -> SourceType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd considered that and hesitated, but on today's brain I like that better than "mapped_X".

@amyreese amyreese merged commit 8fc595a into main Feb 11, 2026
46 checks passed
@amyreese amyreese deleted the amy/extension-mapping branch February 11, 2026 18:36
amyreese added a commit that referenced this pull request Feb 25, 2026
Users can now map their preferred markdown extensions in configuration
via #23218 and #23384.

Issue #3792, #23204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration Related to settings and configuration internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants