Automattic / Automattic/jetpack

Enhancement: Dynamic title attribute on Markdown Footnote links

Open
#27,387 0 comments 0 reactions 0 assignees View on GitHub
[Feature] Markdown [Plugin] Jetpack Enhancement
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:

Screenshot of a pop up which says 'read the footnote'


I think it would be nice if JetPack showed users the *full* text of the footnote. For example:

The pop up now displays the full note



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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.