diff --git a/Michelf/MarkdownExtra.php b/Michelf/MarkdownExtra.php index 87d0308..af079c4 100644 --- a/Michelf/MarkdownExtra.php +++ b/Michelf/MarkdownExtra.php @@ -32,6 +32,11 @@ class MarkdownExtra extends \Michelf\Markdown { public $fn_link_class = "footnote-ref"; public $fn_backlink_class = "footnote-backref"; + # 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' # If empty, the align attribute is used instead of a class name. @@ -1475,6 +1480,7 @@ class MarkdownExtra extends \Michelf\Markdown { $title = $this->encodeAttribute($title); $attr .= " title=\"$title\""; } + $backlink_text = $this->fn_backlink_html; $num = 0; while (!empty($this->footnotes_ordered)) { @@ -1494,9 +1500,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)) { 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)