Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remark-grid-table: incomplete multirow after correct row is not properly eaten #403

Open
artragis opened this issue Jun 2, 2020 · 4 comments
Labels
semver/bugfix This is a minor backward-compatible fix status/verified This has been checked by a maintainer type/bug This is a problem

Comments

@artragis
Copy link
Member

artragis commented Jun 2, 2020

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

@StaloneLab
Copy link
Member

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.

@StaloneLab StaloneLab added semver/bugfix This is a minor backward-compatible fix status/verified This has been checked by a maintainer type/bug This is a problem labels Jun 3, 2020
@artragis
Copy link
Member Author

artragis commented Jun 4, 2020

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

@philippemilink
Copy link
Member

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))

@StaloneLab
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/bugfix This is a minor backward-compatible fix status/verified This has been checked by a maintainer type/bug This is a problem
Projects
None yet
Development

No branches or pull requests

3 participants