-
Notifications
You must be signed in to change notification settings - Fork 82
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
FR: Add Rules from markdownlint #32
Comments
Looks like the following are the rules tat would be able to be fixable: MD004 ul-style - Unordered list style |
Thanks for compiling this. It would be great if we could leverage rules from existing linters instead of rewriting them. Would you be interested in looking into that? |
I can definitely take a look, but I am not sure to what extent the linters would be used the same way as this plugin works. For example, markdownlint is not necessarily going to fix the issues for you. I can look into how the extension to VS Code works and get the rules implemented which is what I was hoping to do initially before I stumbled across this plugin. |
Yeah, a while ago I was looking into remark which seemed promising. I believe its already installed in this project, but I never got around to using its plugins. |
I like the idea of using something like remark to supply most of the rules or even get the linting framework setup to allow extensions as well. It looks like there is an example of it for remark-lint here. I will have to test it locally and see what happens. But it would help to not have to reinvent the wheel. |
I got a simple example working, but I am not entirely sure how well it will work out since it may require dynamically building a couple of objects. I will try replacing an existing rule with the remark-lint plugin and see how well it works out. Hopefully it will not be too cumbersome, but if we did go this route we would probably need to go all in to make sure we had a consistent rule setup. |
Here seems to be the current mapping:
|
Looks like to convert over to remark would leave us with only a few existing rules and a conversion or setup for the others. |
I'd like to have a mixture of remark rules and custom rules. It should still be easy to add a new rule by writing a little regex. We can use remark when we can. |
Good to know. That should be allow for an interesting way of setting things up. Are we also allowing markdownlint rules assuming they can be used to fix issues rather than just warn about them? |
Sure, I'm open to most things as custom rules. |
If we wanted to implement the fixable aliases here is what that looks like when using remark rules:
@platers , do we want to implement MD018? Also, are there any of these we would not like to include? And would you like them added one at a time or all at once (I am guessing the former, but want to make sure since it is more testable)? |
Lets skip MD018. Yeah lets add them one at a time, in order of convenience/utility. |
Sounds good, feel free to send PRs for new rules, no need to create issues for these. |
Looks like we will not be able to use remark-lint as it seems to run things all at once. I am still checking, but it seems to run more than 1 rule at a time. |
These are the rules that would try to run by default if my understanding is correct: |
Oh does remark only give warnings? I thought it could fix errors too :( |
It can fix errors, but it does so using presets which include more than 1 rule at a time. We would need to build the whole set of remark rules at once from what I am gathering unless there is a good way to get the rule sets in use. |
If I am understanding correctly how remark-lint does things, it uses remark-stringify to update the markdown. remark-stringify seems to be an all or nothing thing where you configure how you want all the rules run, then you run the update for all the rules. It does not seem that it is feasible to use remark-lint with how we currently run the rules. They only allow disabling certain plugins, but you have to specify how you want certain things done or else the default will be used (default is NOT to do nothing). |
For this issue, it is my understanding that the following rules would need to be added to obsidian-linter or rule modifications may be needed:
It looks like we have a good bit of work cut out for us if we want to get this completed, but it should be feasible to do so. |
It may be easier to break this into several feature requests to make it seem less daunting and not have it sit in the swim lanes for the roadmap for the Linter for so long. I will think about whether to do that. |
I may have been wrong about my initial assessment of whether or not we could use remark plugins that already exist to do some of the work for us. I am testing out whether they can actually be used. I think that if we dynamically add and remove plugins to use, we can probably use the plugins. I initially thought this was not allowed, but realized that it may very well be possible. |
Well, it seems my initial assessment was correct. It is not possible to use remark rules to just update some of these values without accepting that some styling that may be disabled in the settings might have its equivalent run in |
Just wanted to chime in and say that I'm very glad to see markdownlint having played a role in this linter's design. I have markdownlint configured to my liking in VS Code and hope to translate it 1:1, if possible, over to Obsidian. I'm using these markdownlint rules: Implemented:
Partially implemented:
Unimplemented:
Some rules may not be relevant to obsidian-linter, or may controlled via Obsidian itself. The categories above are just based off your list above, I haven't tested them. As a side note, Obsidian looks very broken in editing view when trying to handle somewhat complex lists, but renders them fine in reading view. Strange and unexpected. Maybe it's not ready for me to switch to yet... |
Hi! First: thanks a lot for this great plugin! regarding MD007 ul-indent, I wanted to ask if there are any chances to get it done anytime soon 😅 I just now converted some text to markdown and was left with a lot of unordered lists having two spaces instead of 4. not a problem for the reading-mode, but in live-preview and source-mode it didn't look too well :D. I tried to use search-and-replace as possible, but a quick lint would have been much quicker 👍 |
I am not sure where this falls on things. I am all over the place with when things get merged. I am currently working more on documenting things and some bug fixes, but I plan to shift focus a little once the documentation gets updated. |
I would like to take another stab at remark lint and see if it is viable, but that will have to wait for now. |
Any chance we could get a new push for MD007
Ideally this would be fixed at Obsidian's level but until then I'm fine using 4 spaces iff I can do it automatically without extra effort |
I am not sure when |
https://github.com/DavidAnson/markdownlint
Add rules that are automatically fixable.
The text was updated successfully, but these errors were encountered: