xoofx / markdig

A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
BSD 2-Clause "Simplified" License
4.29k stars 444 forks source link

Using `Label` instead of `Order` in a `Footnote` #684

Open omer-iqbal opened 1 year ago

omer-iqbal commented 1 year ago

I am working with documents and Islamic commentaries. My goal is to preserve the original footnote numbers or labels so they can be searched and found by the users and so users can also cite the original footnote when needed. So I need to preserve the original footnote.

There are two issues: 1) For larger works, like books and commentaries, the original text is broken into multiple sections (which can be hundreds or even thousands for multi-volume works) and each section will be stored in its own markdown. 2) Some works have footnotes that use non-numeric labels. For example, this Quran commentary book (e.g. page 112) uses letters a, b etc. for footnotes.

Based on that, it looks like footnotes need a feature where Footnote.Label can be used in the markup instead of the Footnote.Order property.

Then, based on an option provided, HtmlFootnoteGroupRenderer will either use Order or Label (without the \^ prefix).

If this proposal seems acceptable, I can try to make a pull request (not sure though what the time frame might look like).

Comments/suggestions/feedback welcome.

I looked at this list of issues and didn't find a similar issue.

xoofx commented 1 year ago

Based on that, it looks like footnotes need a feature where Footnote.Label can be used in the markup instead of the [Footnote.Order] (https://github.com/xoofx/markdig/blob/master/src/Markdig/Extensions/Footnotes/Footnote.cs#L30) property.

I'm confused, because Footnote in markdig do support using label instead of order here in the specs, so why this is not working for your case?