Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable lowercasing of Reference links #273

Closed
clee-ai opened this issue Oct 5, 2021 · 6 comments
Closed

Add option to disable lowercasing of Reference links #273

clee-ai opened this issue Oct 5, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@clee-ai
Copy link

clee-ai commented Oct 5, 2021

Describe the problem

Some scripts that operate on MD files directly depend on the capitalization of the file contents. Right now, mdformat automatically lowercases reference link definitions, for example:

## [Unreleased]
[Unreleased]: https://github.com

mdformat would change to:

## [Unreleased]
[unreleased]: https://github.com

It would be nice to have an option to disable this lowercasing, so that doing text find/replaces within the file don't have to worry about capitalization.

Link to your repository or website

No response

Steps to reproduce

somefile.MD

## [Unreleased]
[Unreleased]: https://github.com

run mdformat to get:

## [Unreleased]
[unreleased]: https://github.com

The version of Python you're using

No response

Your operating system

No response

Versions of your packages

No response

Additional context

No response

@clee-ai clee-ai added the bug Something isn't working label Oct 5, 2021
@welcome
Copy link

welcome bot commented Oct 5, 2021

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

clee-ai added a commit to RockRobotic/copc-lib that referenced this issue Oct 5, 2021
@hukkin hukkin added enhancement New feature or request and removed bug Something isn't working labels Oct 5, 2021
@hukkin
Copy link
Owner

hukkin commented Oct 5, 2021

Thanks for the issue!

I'm not sure I want this as link labels are case insensitive. Lower casing makes this obvious and the link labels consistent.

What would be your expected formatting for the following Markdown?

[unreleased]

[Unreleased]

[Unreleased]: https://github.com

@clee-ai
Copy link
Author

clee-ai commented Oct 5, 2021

In the case of running mdformat with the default settings, I would expect to lowercase them and keep the current behavior.

In the case of disabling case sensitivity, the formatter won't touch the casing, instead leaving it the same.

[unreleased]

[Unreleased]

[Unreleased]: https://github.com

I know with this setting, the formatter wouldn't be as opinionated; however, from a user perspective I would prefer the default behavior to be strongly opinionated, with the ability to disable certain rules. However, if this goes against the design philosophy of the library, I understand, and instead I can try to fix the offending scripts 😄

@hukkin
Copy link
Owner

hukkin commented Oct 5, 2021

Yeah, I do think it's probably better if you fix the offending scripts. If lowercasing link labels breaks your scripts, then I assume the mixed case example also does so, no matter how we format it. Fixing your scripts should be the more resilient solution.

@clee-ai
Copy link
Author

clee-ai commented Oct 5, 2021

Understandable, my perspective is coming from adhering to specifications that define (perhaps improperly) how the file should be formatted. For example, my usecase was from https://keepachangelog.com/en/1.0.0, where the [Unreleased] tag is uppercased. In addition, the order of the link labels is intentional. My thoughts are, it would be nice to disable some features of mdformat (link label ordering/capitalization) while maintaining a consistent formatting on the rest of the file.

@hukkin
Copy link
Owner

hukkin commented Oct 5, 2021

I see your point. But I don't currently feel like this is a strong enough case to justify adding configuration. I don't want to maintain a configurable formatter, but if you or anyone else wants to make a fork adding all sorts of switches, I think that'd actually be pretty great.

@hukkin hukkin closed this as completed Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants