-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RichText: Add (foot)notes #15267
RichText: Add (foot)notes #15267
Conversation
I wonder if this could be a property of the block that shows the footnotes at the bottom. |
This is a great start!
I tend to agree. Though it does leave the question of "how would this be represented on an email / RSS context?".
Bidirectional editing would interesting to have, but agree with keeping it simple at first. Just focusing and opening the relevant footnote in the main content block seems like a good start.
Was there any issue with using RichText there? |
I've inserted inline CSS styles in the footer, so it should still work. :) Needs to be tested of course.
Yes. |
@ellatrix can offer variations for the notes? Can we allow the author to select the preference? Maybe not for version one, but worth keeping in mind for a future iteration. I particularly like displaying them at the bottom of the page to start.
It would be great to see the list appear in the post content at the bottom and be editable. This would be a block that is fixed to the bottom maybe and doesn't allow anything to be added after it? I'm not entirely sure. Some design help is needed here.
I like this. Often times notes should be allowed to link off to the source. |
I discussed this PR quite a bit with @mcsf. We didn't really reach any definite conclusion, but here are some thoughts:
I don't think we should. I think it should be a theme thing.
I think the footnotes should be dynamical generated in PHP, defaulting to accumulating before any "next page" tags, and the end of the content. We could allow filtering, e.g. you could accumulate them before each h2 or something like that. The dynamic generation means that we need to do some HTML matching for the notes, similar to how WordPress core currently replaces static images with dynamic sources etc. I think I now know enough to be able to finish the PR. |
@ellatrix I'd love to give some design feedback once you've iterated a bit, as that sounds like your next step. |
@karmatosed It's welcome at any point. :) |
This is really great to interact with, huge props for all the work so far. In walking through I do have a few bits of feedback:
|
@karmatosed Thanks for the feedback.
|
Sorry for the confusion. When I hover over the footnote link in text it has a different cursor to the one in the footer going to the source. It's hard to get a screenshot of but I can take a video if that doesn't explain.
Oh! This could totally be me but I didn't even think that would work. I'd be curious to see if that was just my mental model. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@ellatrix Is there anything we can do to help with development or testing? Would like to use the feature; am loath to use a different footnote plugin if the facility may shortly be available in Gutenberg. |
Any news on this 🙂 |
@ellatrix It would be nice to get this Foot notes PR added to WP 5.6. I went ahead and added it to the project board: https://github.com/WordPress/gutenberg/projects/48#card-45875045 |
I'll rework this PR. Have some alternative ideas. |
@ellatrix |
Hello @ellatrix do you have any estimate on when this feature will be released? |
Probably WP 5.7 |
Closing this in favour of #28261. |
Description
Fixes #1890.
Blocked by #16428.
Front end:
Notes are not a trivial thing to implement, but they are commonly used, even customary in a lot of fields. I think it’s important that core adds support for them. Adding support for footnotes will also the door for adding comments. They are basically the same thing, just styled differently and only displayed in the editor.
Positioning
There are three possible ways to position footnotes:
“Footnotes” don’t really make sense in the context of a web page, so let's call them "notes".
The first is probably the most common way in print, but the latter seems to become more popular on the web.
It’s worth noting that even though the author may not want to display the notes at the end of the page, the markup should still be there so it can be printed and indexed correctly.
Markup
There is no standard way to create notes in HTML. Ideally they should have as little markup as possible, so it’s clear, compact and sensible when editing the HTML directly.
There are two parts:
The note anchor should obviously be an
a
element and link to the relevant list item. But what should be linked? What should the text be? Any other markup?A very common thing to do is to “hardcode” the numbering, but that seems too hard to maintain, both manually and programatically. In addition it may depend on the language, script, and convention. The numbering should be added in CSS. Numbering is just a stylistic choice when using endnotes.
Another common thing is to use
sup
, which seems to just be used for convenience. Again, notes might be styled differently depending on your taste, field of work, or language. We should not force a certain style. The markup should be flexible enough to work in a variety of cases.Notes were originally implemented for print. They where not explicitly linked. Linking is a thing of the web, and we should take it to our advantage as much as possible. E.g. the numbering matters less because of the bidirectional linking. We can also explicitly link the exact text the author wants to reference comment on. If you want to style it differently, fine. You could choose to add a number with CSS
:after
, in any style you like.This whole idea to only link text starts crumbling down for two reasons though:
So I made it so that you can both link selections of text or insert a reference mark if there is no selection. I do like linked text much more as it’s more explicit than a reference mark, but as said before, it has limitations.
Finally, an
ol
element for the note list makes sense to me to automate the numbering. Inside every list item, a back link should be added that can bring you back to the anchor. Here again, there are different styles: adding it before or after the note. It has never been a thing in print, and there is no standard. Also different characters are used for it. Common ones are ↵ and ↑. In any case, the anchor seems to be in need of anaria-label
, which should be translatable.I’m a bit torn on what to do here. We could either save the list in the post content, or dynamically add it to PHP.
I do see the list as derived data, so in that regard it doesn’t make sense to me to store it in the post content. In addition some parts need translation.
But I also see the list as a fallback mechanism if the theme doesn’t have any logic to position them elsewhere. I also don’t really see much of a problem with the list not being dynamically added. Once the post is written and published, it shouldn’t change anyway.
My suggestion is:
First Version
How has this been tested?
Screenshots
Types of changes
Checklist: