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

Prevent "MD009 Trailing spaces" for double-spaced newline #7

Open
matbun opened this issue Nov 19, 2021 · 5 comments
Open

Prevent "MD009 Trailing spaces" for double-spaced newline #7

matbun opened this issue Nov 19, 2021 · 5 comments

Comments

@matbun
Copy link

matbun commented Nov 19, 2021

Hi! It is really common in .md files to force the newline by putting a double space at the end of the line.
Unfortunately this gets a warning by this linter. In VS Code it is possible to fix by setting the parameter br_spaces to 2.

How can I set this parameter for this linter?
I tried going in Preferences -> Package Settings -> SublimeLinter -> Settings and add something like

"linters": {
    "mdl": {
         "br_spaces": 2
    }
}

But this did not work...

Reference: markdownlint/markdownlint#165

@kaste
Copy link
Contributor

kaste commented Nov 19, 2021

Na, that's not possible with just a setting. You need a mlrc file or use the -u arg pointing to a style file. The issue you're referring here has some instructions actually. Also the main repo over there has an mlrc file at the root.

@kaste
Copy link
Contributor

kaste commented Nov 19, 2021

As you might have to change the arguments passed to the linter, this is done using the 'args' key.

Sorry, I'm on mobile so can't type it out completely. Feel free to ask again.

@matbun
Copy link
Author

matbun commented Nov 20, 2021

Thank you for your answers!
I have also tried something like:

"linters": {
    "mdl": {
         args=["--br_spaces=2"]
    }
}

But it did not work. Is this what you are mentioning? Or should I use a mlrc file as well?
Unfortunately I found no documentation on this.

@kaste
Copy link
Contributor

kaste commented Nov 21, 2021

         "args": ["--br_spaces=2"]

would be nice but mdl doesn't support such ad-hoc rules. You need to make a style file like https://github.com/markdownlint/markdownlint/blob/master/.mdl_style.rb

then if I remember correctly

         "args": ["--style", "path/to/above file"]

Or you also define a ".mdlrc" file https://github.com/markdownlint/markdownlint/blob/master/.mdlrc which basically points to the style file.

@kaste
Copy link
Contributor

kaste commented Nov 21, 2021

.mdlrc files are looked up automatically so you don't have to set "args": {...}. You can use a file located at the home directoy ~/.mdlrc for all you projects or as a personal fallback style. https://github.com/markdownlint/markdownlint/blob/master/docs/configuration.md#mdl-configuration

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

No branches or pull requests

2 participants