Skip to content

Commit 05684be

Browse files
committed
feat: support footnotes in markdown
1 parent 5c15902 commit 05684be

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

readme_renderer/markdown.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
from cmarkgfm.cmark import Options as cmarkgfmOptions
3535
variants: Dict[str, Callable[[str], str]] = {
3636
"GFM": lambda raw: cast(str, cmarkgfm.github_flavored_markdown_to_html(
37-
raw, options=cmarkgfmOptions.CMARK_OPT_UNSAFE
37+
raw, options=cmarkgfmOptions.CMARK_OPT_UNSAFE | cmarkgfmOptions.CMARK_OPT_FOOTNOTES
3838
)),
3939
"CommonMark": lambda raw: cast(str, cmarkgfm.markdown_to_html(
40-
raw, options=cmarkgfmOptions.CMARK_OPT_UNSAFE
40+
raw, options=cmarkgfmOptions.CMARK_OPT_UNSAFE | cmarkgfmOptions.CMARK_OPT_FOOTNOTES
4141
)),
4242
}
4343
except ImportError:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<p>a statement<sup class="footnote-ref"><a href="#fn-1" id="fnref-1" data-footnote-ref>1</a></sup></p>
2+
<section class="footnotes" data-footnotes>
3+
<ol>
4+
<li id="fn-1">
5+
<p>this is true <a href="#fnref-1" class="footnote-backref" data-footnote-backref data-footnote-backref-idx="1" aria-label="Back to reference 1"></a></p>
6+
</li>
7+
</ol>
8+
</section>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a statement[^1]
2+
3+
[^1]: this is true

0 commit comments

Comments
 (0)