aepfli / markdownlint-rule-max-one-sentence-per-line

A custom markdownlint rule to enforce maximum one sentence per line
MIT License
4 stars 0 forks source link

[Bug] Detect sentence ending with "etc." #50

Open mschoettle opened 4 months ago

mschoettle commented 4 months ago

Describe the bug

When there is a sentence ending in "etc." followed by another sentence it is not detected.

Markdownlint input

This is a sentence, foo, bar etc. This is a second sentence.

Expected behavior

It would be nice if the max-one-sentence-per-line would be detected for this case.

Additional context

n/a

aepfli commented 4 months ago

This is a challenging problem, and my solution is far from ideal, especially for this detection.

First, etc. can be in a sentence's middle or the end. If it is in the middle of a sentence, we can't rely on capitalization to detect if this marks a new sentence or just another capitalized word.

We're not detecting sentences; we just try to detect patterns at the end of a sentence. Currently, etc. is on the list of words to be ignored. The question is whether it would be better just to have two lines with an etc., rather than ignoring it.

Anyway, I am having a hard time with this bug. I'll try to challenge this with somebody, but it seems like we hit a roadblock with the possibilities available for this kind of approach.

mschoettle commented 4 months ago

Thanks for looking into it. I suspected that it is tricky.

I was thinking about converting "etc." to "et cetera" internally to do the check. However, I think that still would not work for all cases since someone might wriite just "etc" and then there is still the potential of it showing up in the middle or the end of a sentence.