Footnotes broken with php-markdown

Created on 10 October 2023, over 1 year ago
Updated 11 October 2023, over 1 year ago

Problem/Motivation

When creating footnotes with the PHP Markdown Extra parser, the id attributes are first correctly generated (e.g. fnref:1 and fn:1) but then they are changed inside Xss:filter(), where fnref: and fn: are treated as unsafe URL protocols and stripped away.

Steps to reproduce

1. Configure to use Markdown with the PHP Markdown Extra parser
2. Create content with footnotes, e.g:

This is some text with a footnote.[^1]

[^1]: And that's the footnote.

3. Save and examine the HTML output.

Proposed resolution

Not sure. It looks like colons are not really recommended in id attributes to begin with, but that is up to the parser library. The treatment of colons in Xss::filter() doesn't seem to be configurable.

Would it be reasonable to change any colon preceded by fn(ref)?[0-9]* into underscores or so, before calling Xss:filter()?

Remaining tasks

User interface changes

API changes

We might change how some id attributes in the output HTML will look like.

Data model changes

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Parser: PHP Markdown/PHP Markdown Extra

Created by

πŸ‡ΈπŸ‡ͺSweden Arla

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024