POSTS / Support Footnotes in MDsveX with Remark-Plugins

Published: 2024-02-06

Just found that MDsveX doesn’t support the footnotes in #36, so I searched to find a proper plugin as #31 does.

Firstly I searched is:issue footnote in Github: MDsveX and found some issues discussing the footnote issue. I surprisingly noticed a plugin list someone mentioned: Remark: List of Plugins and found the plugin remark-gfm which supports autolink literals, footnotes, strikethrough, tables, tasklists (only footnotes needed here).

Then I tried the plugin but footnotes still remained un-rendered in the built targets. I checked the preview issues (pngwn/MDsveX#236, pngwn/MDsveX#374) in MDsveX repo, which instructed me to patch one legacy plugin remark-footnotes of older version.

Why Using an Older Version: (From @pngwn)

If a plugin you want to use isn’t working, check the readme of that plugin and it should mention whether or not it is compatible with the recent changes. For example remark-footnotes has this message:

This plugin is affected by the new parser in remark (micromark, see remarkjs/remark#536). Use version 2 while you’re still on remark 12. Use version 3 for remark 13+.

That really works, but still has one issue String10/Hakuba#10: multiple reference to the same footnotes will only generate one back reference from footnotes to the referring locations.