remarkjs / remark-gfm

remark plugin to support GFM (autolink literals, footnotes, strikethrough, tables, tasklists)
https://remark.js.org
MIT License
713 stars 24 forks source link

Table parse error when using vite #39

Closed Saul-Mirone closed 2 years ago

Saul-Mirone commented 2 years ago

Initial checklist

Affected packages and versions

remark@14.0.2, remark-gfm@3.0.1

Link to runnable example

https://stackblitz.com/edit/typescript-3aqowy?file=index.ts,index.html

Steps to reproduce

https://stackblitz.com/edit/typescript-3aqowy?file=index.ts,index.html

One interesting thing is that in codesandbox, everything works fine. Maybe it's related to bundle strategy for different types of modules?

Expected behavior

The table should be parsed as

| a  | b  | c  |
| :- | :- | :- |
| -- | -- | -- |
| 1  | -- | 3  |

Just one node in AST.

Actual behavior

\| a | b | c |

| :- | :- | :- |
| -- | -- | -- |
| 1 | -- | 3 |

There're two nodes, one paragraph, one table.

Runtime

Other (please specify in steps to reproduce)

Package manager

pnpm

OS

macOS

Build and bundle tools

Vite

wooorm commented 2 years ago

Thanks, I can reproduce this. Seems to be something about the second “delimiter row” that messes with the first. It’s a problem in micromark-extension-gfm-table, if anyone is interested in diving in.

4-1-1 commented 2 years ago

Thanks, I can reproduce this. Seems to be something about the second “delimiter row” that messes with the first. It’s a problem in micromark-extension-gfm-table, if anyone is interested in diving in.

Try a lot, read the code again and again . seems some thing wrong before tokenize

wooorm commented 2 years ago

I checked a smaller reproduction today, and found the root cause of it: micromark-extension-gfm-table.

Closing this here in favor of an issue in the correct repo: https://github.com/micromark/micromark-extension-gfm-table/issues/7.

github-actions[bot] commented 2 years ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.