From e244a9e33a22d7651b665b93107ac6d89f00e05a Mon Sep 17 00:00:00 2001
From: dana
Date: Thu, 15 Oct 2015 22:01:42 -0500
Subject: [PATCH 1/3] Made fn_backlink_text user-configurable, added U+FE0E to
prevent iOS emoji display
---
Michelf/MarkdownExtra.php | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/Michelf/MarkdownExtra.php b/Michelf/MarkdownExtra.php
index 87d0308..1a3e161 100644
--- a/Michelf/MarkdownExtra.php
+++ b/Michelf/MarkdownExtra.php
@@ -32,6 +32,12 @@ class MarkdownExtra extends \Michelf\Markdown {
public $fn_link_class = "footnote-ref";
public $fn_backlink_class = "footnote-backref";
+ # Text to be displayed within footnote backlinks. The default is '↩'; the
+ # U+FE0E on the end is a Unicode variant selector used to prevent iOS from
+ # displaying the arrow character as an emoji. Note: This value is inserted
+ # as raw HTML, so dangerous/special characters must be pre-escaped!
+ public $fn_backlink_text = '↩︎';
+
# Class name for table cell alignment (%% replaced left/center/right)
# For instance: 'go-%%' becomes 'go-left' or 'go-right' or 'go-center'
# If empty, the align attribute is used instead of a class name.
@@ -1475,6 +1481,7 @@ class MarkdownExtra extends \Michelf\Markdown {
$title = $this->encodeAttribute($title);
$attr .= " title=\"$title\"";
}
+ $backlink_text = $this->fn_backlink_text;
$num = 0;
while (!empty($this->footnotes_ordered)) {
@@ -1494,9 +1501,9 @@ class MarkdownExtra extends \Michelf\Markdown {
$note_id = $this->encodeAttribute($note_id);
# Prepare backlink, multiple backlinks if multiple references
- $backlink = "↩";
+ $backlink = "$backlink_text";
for ($ref_num = 2; $ref_num <= $ref_count; ++$ref_num) {
- $backlink .= " ↩";
+ $backlink .= " $backlink_text";
}
# Add backlink to last paragraph; create new paragraph if needed.
if (preg_match('{
$}', $footnote)) {
From e1e3fc2a01db1d6b4347c63ea96cb72f99b30df4 Mon Sep 17 00:00:00 2001
From: Michel Fortin
Date: Fri, 16 Oct 2015 21:13:21 -0400
Subject: [PATCH 2/3] Renaming `fn_backlink_text` to `fn_backlink_html` to
clarify that this is HTML content.
---
Michelf/MarkdownExtra.php | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/Michelf/MarkdownExtra.php b/Michelf/MarkdownExtra.php
index 1a3e161..af079c4 100644
--- a/Michelf/MarkdownExtra.php
+++ b/Michelf/MarkdownExtra.php
@@ -32,11 +32,10 @@ class MarkdownExtra extends \Michelf\Markdown {
public $fn_link_class = "footnote-ref";
public $fn_backlink_class = "footnote-backref";
- # Text to be displayed within footnote backlinks. The default is '↩'; the
- # U+FE0E on the end is a Unicode variant selector used to prevent iOS from
- # displaying the arrow character as an emoji. Note: This value is inserted
- # as raw HTML, so dangerous/special characters must be pre-escaped!
- public $fn_backlink_text = '↩︎';
+ # Content to be displayed within footnote backlinks. The default is '↩';
+ # the U+FE0E on the end is a Unicode variant selector used to prevent iOS
+ # from displaying the arrow character as an emoji.
+ public $fn_backlink_html = '↩︎';
# Class name for table cell alignment (%% replaced left/center/right)
# For instance: 'go-%%' becomes 'go-left' or 'go-right' or 'go-center'
@@ -1481,7 +1480,7 @@ class MarkdownExtra extends \Michelf\Markdown {
$title = $this->encodeAttribute($title);
$attr .= " title=\"$title\"";
}
- $backlink_text = $this->fn_backlink_text;
+ $backlink_text = $this->fn_backlink_html;
$num = 0;
while (!empty($this->footnotes_ordered)) {
From 8c45ad58f412e506fadf1dbadf1a8d1c2c08e500 Mon Sep 17 00:00:00 2001
From: Michel Fortin
Date: Fri, 16 Oct 2015 21:18:28 -0400
Subject: [PATCH 3/3] Updating Readme file for footnote backlink changes.
---
Readme.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Readme.md b/Readme.md
index 4facd76..bc63c79 100644
--- a/Readme.md
+++ b/Readme.md
@@ -187,6 +187,16 @@ Current Version
of the special attribute block). Credits to Mario Konrad for providing the
implementation.
+* The curled arrow character for the backlink in footnotes is now followed
+ by a Unicode variant selector to prevent it from being displayed in emoji
+ form on iOS.
+
+ Note that in older browsers the variant selector is often interpreted as a
+ separate character, making it visible after the arrow. So there is now a
+ also a `fn_backlink_html` configuration variable that can be used to set
+ the link text to something else. Credits to Dana for providing the
+ implementation.
+
PHP Markdown Lib 1.5.0 (1 Mar 2015)