lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.85k stars 85 forks source link

Markdown-it rules in _config.ts cause TypeError #259

Closed kari closed 2 years ago

kari commented 2 years ago

I was trying to overwrite markdown-it-footnote template rules in _config.ts:

const markdown = {
  plugins: [markdown_footnote],
  rules: {
    "footnote_block_open": () => (
    '<footer class="footnotes">\n' +
    '<ol class="footnotes-list">\n'
    )
  },
};

However, this caused a TypeError: Cannot set properties of undefined (setting 'footnote_block_open') at (https://deno.land/x/lume@v1.11.1/plugins/markdown.ts:91:25) when building the site.

Looking at markdown-it documentation, it seems that in markdown.ts:91 instead of engine.rules[name] = rule;, should it be engine.renderer.rules[name] = rule;? After doing this change, my site built successfully and used the customized footnote_block_open. However, I'm not too familiar with lume or markdown-it to say if this is a correct fix?

oscarotero commented 2 years ago

Hi! Yes, definitely this is a Lume bug, thanks for reporting. I'm going to fix it now.

oscarotero commented 2 years ago

Hi again @kari It's fixed in Lume v1.11.4.

kari commented 2 years ago

Thanks for the fix!