aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Maldonado Ventura <jorgesumle@freakspot.net>2017-12-23 00:00:07 +0100
committerWaylan Limberg <waylan.limberg@icloud.com>2017-12-22 18:00:07 -0500
commitbc5a9bb02ae5d171d42978078344050034edc106 (patch)
tree6423e07613b253f126fc4acfdfd6d197d24eb862
parent1edbb9dcb998966e43e02f5e345fe3d08c0307dc (diff)
downloadmarkdown-bc5a9bb02ae5d171d42978078344050034edc106.tar.gz
markdown-bc5a9bb02ae5d171d42978078344050034edc106.tar.bz2
markdown-bc5a9bb02ae5d171d42978078344050034edc106.zip
[Footnote extension] Add a way to customize the backlink title (#616)
Fixes #610.
-rw-r--r--docs/extensions/footnotes.md6
-rw-r--r--markdown/extensions/footnotes.py9
2 files changed, 13 insertions, 2 deletions
diff --git a/docs/extensions/footnotes.md b/docs/extensions/footnotes.md
index c94c2c4..aaff184 100644
--- a/docs/extensions/footnotes.md
+++ b/docs/extensions/footnotes.md
@@ -85,3 +85,9 @@ The following options are provided to configure the output:
* **`BACKLINK_TEXT`**:
The text string that links from the footnote definition back to the position
in the document. Defaults to `&#8617;`.
+
+* **`BACKLINK_TITLE`**:
+ The text string for the `title` HTML attribute of the footnote definition link.
+ `%d` will be replaced by the footnote number. Defaults to `Jump back to
+ footnote %d in the text`
+
diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py
index 7edf813..620cf0b 100644
--- a/markdown/extensions/footnotes.py
+++ b/markdown/extensions/footnotes.py
@@ -49,7 +49,12 @@ class FootnoteExtension(Extension):
"BACKLINK_TEXT":
["&#8617;",
"The text string that links from the footnote "
- "to the reader's place."]
+ "to the reader's place."],
+ "BACKLINK_TITLE":
+ ["Jump back to footnote %d in the text",
+ "The text string used for the title HTML attribute "
+ "of the backlink. %d will be replaced by the "
+ "footnote number."]
}
super(FootnoteExtension, self).__init__(*args, **kwargs)
@@ -192,7 +197,7 @@ class FootnoteExtension(Extension):
backlink.set("class", "footnote-backref")
backlink.set(
"title",
- "Jump back to footnote %d in the text" %
+ self.getConfig("BACKLINK_TITLE") %
(self.footnotes.index(id)+1)
)
backlink.text = FN_BACKLINK_TEXT