why-jay / remark-lint-sentence-newline

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

Better detection mechanism #12

Closed wooorm closed 8 years ago

wooorm commented 8 years ago

P.S. Also: I’ve done quite some work on disambiguating regular dots from sentence stops with retext, maybe investigate using mdast-util-to-nlcst here in order to disambiguate between the two.

In NLCST, check for the children of each SentenceNode (starting from back to front), and if you find a PunctuationNode, check whether it contains (with nlcst-to-string) just terminal-punctuation (?, !, and .). If that’s the case, the sentence ends in a terminal marker, which should be followed by a WhiteSpaceNode containing a newline.

P.P.S. I just though of the fact that with the current set-up, it’s impossible to add a break after a . (markdown needs two spaces, then a newline, for that).

why-jay commented 8 years ago

I've updated mast to remark, and renamed the project/repo.

As for the detection algorithm, I'll have to spend some time on this :) So I'll repurpose this issue. Thanks for the input.

why-jay commented 8 years ago

Trying to make sense of your comments....

So basically, in your PPS you're saying that mdast-util-to-nlcst as is now cannot really be used towards this lint rule, right?

why-jay commented 8 years ago

I went ahead and merged #15 which gives pretty good behavior. What do you think of that PR?

Since that PR shows pretty satisfactory behavior (at least for my uses), I'm going to close this issue, but please feel free to provide any feedback :) As always, thanks for all the great work @wooorm

wooorm commented 8 years ago

I no longer know what I was referring to in my P.P.S. Weird.

Anyway, thanks @chcokr for upgrading to remark!