diff --git a/html.go b/html.go
index f8eafbe..e8d1d2b 100644
--- a/html.go
+++ b/html.go
@@ -42,6 +42,7 @@ const (
HTML_SMARTYPANTS_FRACTIONS // enable smart fractions (with HTML_USE_SMARTYPANTS)
HTML_SMARTYPANTS_LATEX_DASHES // enable LaTeX-style dashes (with HTML_USE_SMARTYPANTS)
HTML_ABSOLUTE_LINKS // convert all links to absolute links, using AbsolutePrefix
+ HTML_FOOTNOTE_RETURN_LINKS // generate a link at the end of a footnote to return to the source
)
var (
@@ -56,8 +57,14 @@ var (
)
type HtmlRendererParameters struct {
+ // Prepend this text to each URL, if the HTML_ABSOLUTE_LINKS option is enabled.
AbsolutePrefix string
- FootnotePrefix string
+ // Add this text to ecah footnote anchor, to ensure uniqueness.
+ FootnoteAnchorPrefix string
+ // Show this text inside the tag for a footnote return link, if the
+ // HTML_FOOTNOTE_RETURN_LINKS flag is enabled. If blank, the string
+ // [return] is used.
+ FootnoteReturnLinkContents string
}
// Html is a type that implements the Renderer interface for HTML output.
@@ -104,6 +111,10 @@ func HtmlRendererWithParameters(flags int, title string,
closeTag = xhtmlClose
}
+ if renderParameters.FootnoteReturnLinkContents == "" {
+ renderParameters.FootnoteReturnLinkContents = `[return]`
+ }
+
return &Html{
flags: flags,
closeTag: closeTag,
@@ -363,12 +374,24 @@ func (options *Html) FootnoteItem(out *bytes.Buffer, name, text []byte, flags in
if flags&LIST_ITEM_CONTAINS_BLOCK != 0 || flags&LIST_ITEM_BEGINNING_OF_LIST != 0 {
doubleSpace(out)
}
+ slug := slugify(name)
out.WriteString(`\n")
}
@@ -583,11 +606,11 @@ func (options *Html) StrikeThrough(out *bytes.Buffer, text []byte) {
func (options *Html) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
slug := slugify(ref)
out.WriteString(`