-
Notifications
You must be signed in to change notification settings - Fork 527
Description
Footnote links' titles can only be set once by the library. This change would make the attribute display the content of the footnote.
How
At the moment, if a user hovers over a footnote, the title
attribute displays a tool tip.
For example, if
php-markdown/Michelf/MarkdownExtra.php
Line 28 in eb176f1
public string $fn_link_title = ""; |
is set to "Read the footnote." then all footnotes have this pop-up:
I think it would be nice if it showed users the full text of the footnote. For example:
This is controlled by :
php-markdown/Michelf/MarkdownExtra.php
Line 1764 in eb176f1
$title = $this->fn_link_title; |
The change is relatively straightforward:
if ($this->fn_link_title != "") {
$title = trim( strip_tags( $this->footnotes[$node_id] ) );
$title = $this->encodeAttribute( $title );
$attr .= " title=\"$title\"";
}
That takes the text of the footnote, sanitises it, and adds it as the title element.
Would you be interested in a PR for this?
(I have also raised this with WordPress's Jetpack which is running an older version of your library - Automattic/jetpack#27387)