remove-markdown
remove-markdown copied to clipboard
Horizontal rules are incorrectly matched
Hi,
The horizontal rule regex incorrectly matches result leaving some markdown unremoved.
The current regex: https://github.com/zuchka/remove-markdown/blob/c96417bbb16a9e89dfc0b3dfafd306ad30a08867/index.js#L15
matches 3 or more -, *, _ followed by whitespace
There are two issues:
- it matches mixed symbols so, -*- or --_ but the spec mentions that the symbols need to be matching
- it matches even if there are non whitespace characters at then end of the a line something like
-- -hey
matches the-- -
but it shouldnt according to the spec.
I came across this when having a list with a bold word in the beginning so:
- **Bold**
which wrongle matches the - **
and leaves it at Bold**
. This is both case 1 and 2 from above where it matched mixing characters and also where there are nonspace characters afterwards