remarkjs / remark-gfm

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

TypeError: self.parser.lazy is undefined #21

Closed sunknudsen closed 3 years ago

sunknudsen commented 3 years ago

Initial checklist

Affected packages and versions

remark-gfm@2.0.0

Link to runnable example

No response

Steps to reproduce

Simplified snippet:

import ReactMarkdown from "react-markdown"
import remarkGfm from "remark-gfm"

<ReactMarkdown
  children="# Foo\nbar\n"
  // @ts-expect-error # See https://github.com/rehypejs/rehype/discussions/63
  remarkPlugins={[remarkGfm]}
/>

Not sure why, but the \n characters appear to be throwing error.

Expected behavior

No error

Actual behavior

TypeError: self.parser.lazy is undefined lineStart node_modules/@sunknudsen/react-cms/node_modules/micromark-extension-gfm-table/lib/syntax.js:563

561 | 562 | function lineStart(code) { 563 | return self.parser.lazy[self.now().line] ? nok(code) : ok(code) > 564 | } 565 | } 566 | } // Based on micromark, but that won’t work as we’re in a table, and that expects 567 | // content.

Runtime

Node v14

Package manager

npm v6

OS

macOS

Build and bundle tools

Webpack

wooorm commented 3 years ago

the new version of this plugin uses an API not yet exposed in remark-markdown. A solution for now is to downgrade remark-gfm for a bit, and wait for remark-markdown to update!

ChristianMurphy commented 3 years ago

tracked upstream as https://github.com/remarkjs/react-markdown/issues/626

sunknudsen commented 3 years ago

Thanks for the heads-up guys!

manunamz commented 1 year ago

For posterity: Upgrading remark-parse from ^9 to ^10 solved this issue for me.