Nevenall / remark-containers

Remark plugin to add custom containers to markdown
MIT License
22 stars 2 forks source link

TypeError: Cannot read properties of undefined (reading 'prototype') #15

Closed Jinjiang closed 8 months ago

Jinjiang commented 9 months ago

Reproduction:

package.json:

{
  "dependencies": {
    "remark-containers": "^1.2.0",
    "remark-parse": "^11.0.0",
    "unified": "^11.0.4"
  }
}

test file:

import { unified } from 'unified'
import markdown from 'remark-parse'
import container from 'remark-containers'

unified()
  .use(markdown)
  .use(container)
  .parse(`Hello World!`)

Error log:

remark
TypeError: Cannot read properties of undefined (reading 'prototype')
 - /node_modules/.pnpm/remark-containers@1.2.0/node_modules/remark-containers/src/index.js:73:35
 - /node_modules/.pnpm/unified@11.0.4/node_modules/unified/lib/index.js:636:36
 - /node_modules/.pnpm/unified@11.0.4/node_modules/unified/lib/index.js:664:10

Thanks.

Nevenall commented 8 months ago

There was a rewrite of the markdown parser a few years ago and I haven't updated this plugin to support it. I think that's probably your issue here. I'd recommend using remark-directive as a replacement.