Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Proposed resolution
Add support for the 3rd party "Footnotes" extension: https://github.com/rezozero/commonmark-ext-footnotes
Plugin ID | rezozero/commonmark-ext-footnotes |
Settings Schema | |
Settings Key | N/A |
Settings | N/A |
Remaining tasks
- Create
MarkdownExtension
plugin.
Comment | File | Size | Author |
---|---|---|---|
#5 | 3131224-5.patch | 934 bytes | mikejw |
Comments
Comment #3
markhalliwellComment #4
mikejw CreditAttribution: mikejw commentedCan't yet get this to work using the filter output strategy. The problem is due to https://www.drupal.org/project/drupal/issues/2544110 as inside the `sup` tag that the extension puts in, it puts in an `id` attribute with a colon e.g. "fnref:note1" and the Xss filtering strips out the `fnref` part.
One approach might be a PR / feature request on the extension to make the prefix configurable and then one could leave out the colon altogether.
Also, need to change the rest of the allowedHtmlTags since some of the bottom markup that is injected is filtered out, will post a patch in a minute.
Comment #5
mikejw CreditAttribution: mikejw commentedThis patch won't fix it, but the allowedHtmlTags will need to be extended either way.
Comment #6
markhalliwellI didn't run into this issue at all when implementing it. Are you sure you have the global "Markdown" allowed HTML plugin enabled? It should be supplying the base allowed HTML.
Comment #7
mikejw CreditAttribution: mikejw commentedInteresting - not sure I follow what you are saying around the global html plugin. I have it setup as follows:
- filter with only markdown enabled
- parser set to commonmark
- render strategy set to filter, with:
- markdown module enabled (is this what you are referring to?)
- footnotes parser extension enabled
- footnotes enabled
Comment #8
markhalliwellSo the
id
prefix stripping offn:
andfnref:
are indeed a core issue. Due to the lack of configurability with the extension, there's really not much I can do about this ATM.Temporary workaround for users is to implement a custom
hook_markdown_html_alter()
to remove any additional occurrances offn:
andfnref:
in the linkhref
.Comment #9
markhalliwellComment #10
markhalliwellExample of the temporary workaround mentioned in #8: