hexojs / hexo-renderer-markdown-it

Markdown-it is a Markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.
MIT License
343 stars 60 forks source link

How to Customize the plugin output such as footnote #108

Closed MakerGYT closed 3 years ago

MakerGYT commented 4 years ago

@oncletom As markdown-it-footnote doc,

md.renderer.rules.footnote_block_open = () => (
  '<h4 class="mt-3">Footnotes</h4>\n' +
  '<section class="footnotes">\n' +
  '<ol class="footnotes-list">\n'
);

That way, we can customize the output. So, how to customize the footnote output in hexo-renderer-markdown-it after plug-in integration

curbengh commented 3 years ago

Available in v5.0.0+

hexo.extend.filter.register('markdown-it:renderer', function(md) {
  md.renderer.rules.footnote_block_open = () => (
    '<h4 class="mt-3">Footnotes</h4>\n' +
    '<section class="footnotes">\n' +
    '<ol class="footnotes-list">\n'
  );
});

Save it in a .js file in scripts/ folder.

MakerGYT commented 3 years ago

Thanks