zestedesavoir / zmarkdown

Live demo: https://zestedesavoir.github.io/zmarkdown/
MIT License
224 stars 52 forks source link

Getting `blockTokenizers is undefined` when using in my Gatsby app #486

Closed OddDev closed 1 year ago

OddDev commented 1 year ago

Input:

    const postContent = unified()
        .use(rehypeParse)
        .use(remarkCustomBlocks, {
            foo: {
                classes: "a-class another-class",
            },
        })
        .use(rehype2react, {
            createElement: React.createElement,
            components: {
                h1: TestHeadline,
                p: TestParagraph,
            },
            Fragment: React.Fragment,
        })
        .processSync(html).result as ReactElement;

Result:

Unhandled Runtime Error

One unhandled runtime error found in your files. See the list below to fix it:

Error in function blockPlugin in ./node_modules/remark-custom-blocks/dist/index.js:74

blockTokenizers is undefined
./node_modules/remark-custom-blocks/dist/index.js:74

  72 |   var blockTokenizers = Parser.prototype.blockTokenizers;
  73 |   var blockMethods = Parser.prototype.blockMethods;
> 74 |   blockTokenizers.custom_blocks = blockTokenizer;
  75 |   blockMethods.splice(blockMethods.indexOf('fencedCode') + 1, 0, 'custom_blocks');
  76 |
  77 |   // Inject into interrupt rules

I get an error when trying to use custom blocks in my project. I'm a bit lost on how to debug this issue. Can you point me in the right direction? :) Thank you!

StaloneLab commented 1 year ago

Hello, from what I see it might be linked to your version of remark being too recent for our plugins (more like our plugins being too old for the current version). Please see issue #416 , especially my latest message from yesterday. If you think it does not apply to your problem, please specify the version of remark you are using, we only support remark < 13.