redbug312 / markdown-it-multimd-table

Multimarkdown table syntax plugin for markdown-it markdown parser
MIT License
144 stars 37 forks source link

[BUG] Consecutive tables missing table_group_close tag #41

Closed CalebJohn closed 2 years ago

CalebJohn commented 2 years ago

When two tables are consolidated into one (see #34) and the first table is multiline, a table_group_open state gets pushed, but the corresponding table_group_close is not.

Why is this an issue?

The closing tags restore the "level" of the state and in a project I'm working on, rendering is based on the level. If the closing tag is missing then the level for the remainder of the document will be off by one, which is an issue.

Test Case

|
| anything ||
| anything | anything \
| any         | thing |

| anything ||

Expect states

table_open
table_group_open
paragraph_open
paragraph_open
table_group_close
table_group_open
table_group_close

(Actually I'm not certain what exactly to expect here)

Actual

table_open
table_group_open
paragraph_open
paragraph_open
table_group_open
table_group_close