github/cmark-gfm

GFM Tables vs List precedence

rlidwka opened this issue · 0 comments

See discussion in laurent22/joplin#7858, markdown-it/markdown-it#767.

There is a parsing ambiguity in the following code:

a | b
- | -
1 | 2

It can be interpreted as a table or a list. As of now, github parses it as a list:

a | b

  • | -
    1 | 2

But GFM spec doesn't currently mention anything about list vs table precedence. I believe it should be defined in the spec, as a few people ran into this already.

Three choices here:

  1. The snippet above is a table. In this case, test should be added to spec, and cmark-gfm should be fixed.
  2. The snippet above is a list. In this case, test should be added to spec.
  3. Or this is actual undefined behavior up to implementors, so it should be clearly written in spec as such (I personally would prefer to keep those at a minimum).