why-jay / remark-lint-sentence-newline

Enforce a newline after an end of sentence in Markdown
7 stars 0 forks source link

Update for changes in remark, remark-lint #25

Open wooorm opened 7 years ago

wooorm commented 7 years ago

Hi! đź‘‹

remark-lint recently changed (and so did remark). Each rule is now a separate package published to npm, for example, take the final-newline rule, which is now remark-lint-final-newline.

You can find more info on what changed on the release pages for remark and remark-lint, but they may be lacking as I’m working hard on upgrading the ecosystem first.

There’s a package, unified-lint-rule, that you can (should!) depend on to make rules though. remark-lint-strong-marker, also a good example, uses it to accept options.

To use “rules”, you must install all rules you want to use, for example:

npm install --save remark-lint remark-lint-final-newline remark-lint-strong-marker

And then specify them in your config file like so:

// ...
{
  "plugins": [
    "lint",
    "lint-final-newline",
    ["lint-strong-marker", "*"]
  ]
}
// ...

...on the API you can do the following:

var remark = require('remark');
var lint = require('remark-lint');
var finalNewline = require('remark-lint-final-newline');
var strongMarker = require('remark-lint-strong-marker');

remark()
  .use(lint)
  .use(finalNewline)
  .use(strongMarker, '*')
  // ...

Finally, feel free to drop by in Gitter room, or reply below, to ask any questions you may have!

P.S. When done, could you create a PR for remark-lint to include this in the list of external rules?

P.P.S. If you want, I can do the updates, if you add me as a collab on this repo and on npm!

ThomDietrich commented 7 years ago

@wooorm as there was no reaction by the original author are you considering to fork this rule into being one of the official ones? I would really appreciate to use it.

wooorm commented 7 years ago

@ThomDietrich Hi! :wave:

I don’t feel this should be part of the core of remark-lint: sentence-detection is just too hard a problem.

  1. I made the whole system quite pluggable so it should be relatively simple to create and maintain an external rule, feel free to fork and maintain your own version
  2. Alternatively, check out the retext ecosystem, and in particular remark-retext and retext-sentence-spacing

Does that help?

ThomDietrich commented 7 years ago

Hey @wooorm :wave:

I already thought that this is the issue. I could look into this project but it will probably take me a few minutes. Hoped to benefit from your offer "If you want, I can do the updates" - maybe @why-jay wants to have another look?

I will also look into remark-retext, thanks for the hint!

Thanks for your prompt and informative answer!

wooorm commented 7 years ago

I can help convert and maintain a bit, but I’m already owning too many repo’s to take the lead on a fork!