mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
759 stars 140 forks source link

Strikethrough extension should be stricter #102

Closed mity closed 4 years ago

mity commented 4 years ago

With MD_FLAG_STRIKETHROUGH, we are too benevolent and we can see any sequence of tildes as a strike-trough mark (except when in a code span or something like that).

This followed some original behavior of cmark-gfm but it seems that cmark-gfm later became much stricter.

From my testing it seems that:

  1. Only marks of length 1 or 2 are accepted ~foo~ or ~~bar~~.
  2. The length of opener and closer mark must match (~foo~~ won't be strike-through).
  3. It now checks similarly as other emphasis marks whether it is followed/preceded with a white-space (e.g. in ~foo ~ the latter ~ is not recognized as a closer).

As all those changes seems very reasonable, we shall follow it.