File tree Expand file tree Collapse file tree 5 files changed +37
-1
lines changed Expand file tree Collapse file tree 5 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -314,9 +314,10 @@ def convert_footnote(el, _indent)
314
314
@footnotes << [ name , el . value , number , 0 ]
315
315
@footnotes_by_name [ name ] = @footnotes . last
316
316
end
317
+ formatted_link_text = sprintf ( @options [ :footnote_link_text ] , number )
317
318
"<sup id=\" fnref:#{ name } #{ repeat } \" >" \
318
319
"<a href=\" #fn:#{ name } \" class=\" footnote\" rel=\" footnote\" role=\" doc-noteref\" >" \
319
- "#{ number } </a></sup>"
320
+ "#{ formatted_link_text } </a></sup>"
320
321
end
321
322
322
323
def convert_raw ( el , _indent )
Original file line number Diff line number Diff line change @@ -596,6 +596,24 @@ def self.simple_hash_validator(val, name)
596
596
Used by: HTML
597
597
EOF
598
598
599
+ define ( :footnote_link_text , String , '%s' , <<~EOF ) do |val |
600
+ The text used for the footnote number in a footnote link
601
+
602
+ This option can be used to add additional text to the footnote
603
+ link. It should be a format string, and is passed the footnote
604
+ number as the only argument to the format string.
605
+ e.g. "[footnote %s]" would display as "[footnote 1]".
606
+
607
+ Default: '%s'
608
+ Used by: HTML
609
+ EOF
610
+ if !val . include? ( '%s' )
611
+ raise Kramdown ::Error , "option footnote_link_text needs to contain a '%s'"
612
+ end
613
+ val
614
+ end
615
+
616
+
599
617
define ( :remove_line_breaks_for_cjk , Boolean , false , <<~EOF )
600
618
Specifies whether line breaks should be removed between CJK characters
601
619
Original file line number Diff line number Diff line change
1
+ < p > This is a< sup id ="fnref:ab "> < a href ="#fn:ab " class ="footnote " rel ="footnote " role ="doc-noteref "> [footnote 1]</ a > </ sup > footnote< sup id ="fnref:ab:1 "> < a href ="#fn:ab " class ="footnote " rel ="footnote " role ="doc-noteref "> [footnote 1]</ a > </ sup > . And another< sup id ="fnref:bc "> < a href ="#fn:bc " class ="footnote " rel ="footnote " role ="doc-noteref "> [footnote 2]</ a > </ sup > .</ p >
2
+
3
+ < div class ="footnotes " role ="doc-endnotes ">
4
+ < ol >
5
+ < li id ="fn:ab " role ="doc-endnote ">
6
+ < p > Some text. < a href ="#fnref:ab " class ="reversefootnote " role ="doc-backlink "> ↩</ a > < a href ="#fnref:ab:1 " class ="reversefootnote " role ="doc-backlink "> ↩< sup > 2</ sup > </ a > </ p >
7
+ </ li >
8
+ < li id ="fn:bc " role ="doc-endnote ">
9
+ < p > Some other text. < a href ="#fnref:bc " class ="reversefootnote " role ="doc-backlink "> ↩</ a > </ p >
10
+ </ li >
11
+ </ ol >
12
+ </ div >
Original file line number Diff line number Diff line change
1
+ :footnote_link_text: "[footnote %s]"
Original file line number Diff line number Diff line change
1
+ This is a[^ab] footnote[^ab]. And another[^bc].
2
+
3
+ [^ab]: Some text.
4
+ [^bc]: Some other text.
You can’t perform that action at this time.
0 commit comments