Documentation: Use Remark as linter in text editors #159
Conversation
✅ Deploy Preview for decap-www ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
One question I had -- is there a way currently to redirect the old URL to this one? Normally I would do that, but I don't see that feature here. |
martinjagodic
left a comment
There was a problem hiding this comment.
LGTM, but let's wait for @yanthomasdev to give the final approval, he is the docs master.
Co-authored-by: Martin Jagodic <jagodicmartin1@gmail.com>
yanthomasdev
left a comment
There was a problem hiding this comment.
Thanks @caseywatts, appreciate the contribution! I added a few comments regarding wording and the recommendation.
| To set this up, you will need to install and set up both of these npm packages in your project: | ||
|
|
||
| - remark: https://remark.js.org/ | ||
| - remark-frontmatter: https://github.com/remarkjs/remark-frontmatter |
There was a problem hiding this comment.
I guess most of the time people will want to use remark-lint with remark-cli instead of the core remark? I know you can use it programatically through the remark API in a JS file, but we should focus on the easier path for people. What do you think about rewriting this part a bit so it leads users to using remark-lint instead? https://github.com/remarkjs/remark-lint#example-check-markdown-on-the-cli?
I think remark-lint will not mess with frontmatter, so maybe remark-frontmatter isn't even necessary? I haven't tested, if you could check this that would be great.
There was a problem hiding this comment.
I think you're right that people will likely use remark-cli instead of remark directly! That's what my team is doing, too. I can update that, no problem.
There was a problem hiding this comment.
On my project we did initially try to do it without remark-frontmatter and I wasn't able to get it working without that. The CLI interface scans each entire file, and it's not aware of the frontmatter enough to know how to skip it without that plugin.
In our Decap situation it behaves differently, because the markdown widget (which runs remark) is only manipulating the markdown body section of the markdown file. The Decap markdown widget is not aware of the frontmatter.
There was a problem hiding this comment.
One thing I noticed on the remark-lint page is that it suggests a bunch of plugins:
npm install remark-cli remark-preset-lint-consistent remark-preset-lint-recommended remark-lint-list-item-indent --save-dev
Since we want to make sure people are getting set up with the same configuration as the Decap markdown widget, maybe we could align these. Either:
- Update the markdown widget to use this set of plugins (more in line with their current guidance, but it's a change we'd have to understand better & communicate out next version release)
- Or suggest NOT using the plugins, and write a bit more configuration & notes here on this help page.
Which approach do you think would be better? (or do you have another idea?)
There was a problem hiding this comment.
I'll say 2 should be easier, if you could bring a bit of what you did in your project as quite of a quick set up for remark linting would be great!
There was a problem hiding this comment.
Great -- I added the setup from my project as an example here 👏
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
Add documentation for how to set up remark as a linter.
Addresses decaporg/decap-cms#7781