zmarkdown
zmarkdown copied to clipboard
remark-grid-table: incomplete multirow after correct row is not properly eaten
Sorry for the really long title, but this cas appears in only some weird circumstances :
- if you are creating a grid table
- when you start a multi-row line but do not properly write it
then zmarkdown fails with "improperly eaten" error
In real life, this happen when people tries to render tables with sub total.
Here is the minimal code to reproduce :
+---+---+---+
| A | B | C |
+===+===+===+
| D | E |F |
+---+---+---+
| G | H | I |
+ K : +---+
it renders the three first lines but fails to render the last one and whatever follows the table.
What is expected is that the two last rows (G H I and K) are rendered as plain text
Pandoc expects it not rendered at all, because no empty space between last row and extra row.
I don't really know what is the expected behaviour, but anyway it's a bug.
In fact not rendered at all or only two first rows rendered is ok for me. The advantage of the second is that we know where the problem is more easily
I guess it's the same bug, so I'm commenting here. With the following Markdown
+------------+-------+
| | Prix |
+============+=======+
| foo | 50 |
+------------+-------+
| bar | 50 |
+============+=======+
| zz | aff |
+------------+-------+
I have the following error and stack trace:
3:1: Incorrectly eaten value: please report this warning on https://git.io/vg5Ft
File "/opt/zds/app/zmd/node_modules/remark-parse/lib/tokenizer.js", line 151, col 11, in validateEat
new Error(
File "/opt/zds/app/zmd/node_modules/remark-parse/lib/tokenizer.js", line 236, col 7, in eat
validateEat(subvalue)
File "/opt/zds/app/zmd/node_modules/remark-grid-tables/src/index.js", line 507, col 10, in Of.gridTableTokenizer
return eat(merged)(wrapperBlock)
File "/opt/zds/app/zmd/node_modules/remark-parse/lib/tokenizer.js", line 62, col 18, in Of.tokenize [as tokenizeBlock]
method.apply(self, [eat, value])
File "/opt/zds/app/zmd/node_modules/remark-parse/lib/parse.js", line 33, col 20, in Of.parse
children: self.tokenizeBlock(value, content),
File "/opt/zds/app/zmd/node_modules/unified/index.js", line 268, col 45, in Function.parse
return new Parser(String(file), file).parse()
File "/opt/zds/app/zmd/node_modules/unified/index.js", line 23, col 16, in pipelineParse
ctx.tree = p.parse(ctx.file)
File "/opt/zds/app/zmd/node_modules/trough/wrap.js", line 25, col 19, in wrapped
result = fn.apply(null, params)
File "/opt/zds/app/zmd/node_modules/trough/index.js", line 57, col 24, in next
wrap(fn, next).apply(null, input)
File "/opt/zds/app/zmd/node_modules/trough/index.js", line 31, col 10, in Object.run
next.apply(null, [null].concat(input))
I saw the error on Sentry, and this is expected: a table must not have two headers.
The error should disappear if one of the lines with =
uses -
instead.