Automattic / Automattic/jetpack
Enhancement: Dynamic title attribute on Markdown Footnote links
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Impacted plugin
Jetpack
### What
Footnote links' titles say "Read footnote." This 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 this tool tip:

I think it would be nice if JetPack showed users the *full* text of the footnote. For example:
This is controlled by :
https://github.com/Automattic/jetpack/blob/d7a656966df2ca3c78a3ac4b66b0bf0ea2e4047d/projects/plugins/jetpack/_inc/lib/markdown/extra.php#L3020
Specifically:
```php
if ($this->fn_link_title != "") {
$title = $this->fn_link_title;
$title = $this->encodeAttribute($title);
$attr .= " title=\"$title\"";
}
```
The change is relatively straightforward:
```php
if ($this->fn_link_title != "") {
$title = trim( wp_strip_all_tags($this->footnotes[$node_id], true) );
$title = $this->encodeAttribute($title);
$attr .= " title=\"$title\"";
}
```
That takes the text of the footnote, sanitises it, and adds it as the title element.
This builds on the work I did in #21371
Contributor guide
Research direction
Start in projects/plugins/jetpack/_inc/lib/markdown/extra.php around the fn_link_title handling at line 3020, and inspect how the footnote text is stored in $this->footnotes. Done means the generated footnote link title contains the trimmed, sanitized footnote content instead of the fixed “Read footnote” text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- content
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100