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

Disable a specific search-replace rule in a file #114

Open
its-miroma opened this issue Dec 29, 2024 · 1 comment
Open

Disable a specific search-replace rule in a file #114

its-miroma opened this issue Dec 29, 2024 · 1 comment

Comments

@its-miroma
Copy link

Is it possible to use a markdownlint-disable-next-line comment to disable one of the search-replace rules?

Example: FabricMC/fabric-docs#237 (comment)

@OnkarRuikar
Copy link
Owner

OnkarRuikar commented Dec 30, 2024

It is not possible at the moment because the markdownlint doesn't pass marker (aka magic comment) information to the custom rules. So, the search-replace rule doesn't know about the disable markers.

I did request the change in the markdownlint framework, but they don't feel the case is strong enough. The same thread has discussed a possible workaround of programmatically splitting all the sub-rules as separate search-replace rules.


I think you don't have to go that far in this particular case. Just need to reduce the scope of the no-file-extension-in-links rule to cover only the internal links: (\[[^\]]*\])\(([.\/][^\)]*)\.(?:md|html)((?:#[a-z0-9-]+)?)\)

        name: no-file-extension-in-internal-links
        message: "Don't add the file extension to the internal links"
        information: https://vitepress.dev/guide/routing#linking-between-pages
        ...

Try at https://regex101.com/r/tGmVIO/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants