-
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
Add Footnotes Support #1890
Comments
Interesting suggestion, thanks! Have you had anything in mind how this could be resolved UI-wise? I mean, displaying footnotes is one thing. But you also need to add them to words/sentences/paragraphs somehow in the first place. |
It is a good question. It is an "insert inline at cursor" action which I do not believe we have modeled before. Under the current UX regime, I believe it would belong alongside link on the inline toolbar that pops up over each block... but it doesn't feel like a commonly enough used function to occupy such prime real estate. May be we keep it in the Insert drop-down but it behaves somewhat differently? Perhaps @annaephox has some thoughts? |
I really like this idea and think a lot of users would want this. I do wonder if it's a block or a plugin that goes with Gutenberg though. Worth exploring either way. |
The tricky bit with footnotes is that they need to be coordinated across block boundaries. In my mind footnotes need 3 things:
If the editor has control over the whole document then they are easy. Just allow users to insert a link with a "footnote" toggle button that applies a style or a data attribute. Then before save of the entire document, you process the document to find all of the link tags that have the appropriate style or data attribute. You move the links to the footnote block of the document and then replace them in the edited block with a link to the entry in the footnote. On edit you do the reverse, you find all the footnote locations and reinsert the original link. |
I'm pretty excited about footnotes. I think it should be supported in core, as it's something that really needs to be baked in and it's quite common for people to use. Adding
Editing
Deleting
At a state/reducer level, insertion and delete (or only post save if we don't want numbers/order in edit mode) will both have to look through all editable content to determine order. |
Actually, we don't even have to loop through all editable areas, only look at the editable area the current one is in and sort. We could add the footnotes as properties to each block, and the footnotes block could put these together based on the block order. |
Going to assign to look at in the near future. |
I love footnotes, but I think this might be something that belongs as a property to the post, rather than as a block. Two thoughts:
|
@iseulde I'd be happy to work with you on this. Check out https://wordpress.org/plugins/academic-bloggers-toolkit/. I've been working on a pretty good academic citations plugin over the last 3 years (although, I am biased!). There's quite a few hidden difficulties that come with managing references and footnotes that I'd imagine most people don't consider early on (I was one of those people). I'd be happy to discuss this in detail if this is something you'd be interested in pursuing. Related: https://github.com/dsifford/academic-bloggers-toolkit Pushing a rather large codebase update to wordpress.org in the next week or two which has quite a bit of refactors necessary for gutenberg. |
This is just a v1 but the basic design could look like this:
Perhaps people would want a title, but for now this shows the minimum I think footnotes would make sense. I'm very cautious we do not spiral this feature, it could easily spiral. |
Love those mockups, Tammie, I think they provide a solid basis and can help our minds grok the side effects and everything. The "deleting" thing is one issue that immediately pops up, but that seems solvable by looking at how other editors have done it — perhaps a "are you sure" prompt is sufficient. The icon also is almost there, with a popout label I'm sure people will get it. But one thing I keep coming back to is — it's very very clear that we need to be able to both add more buttons to the quick toolbar, and stay responsive. This is how Google Docs does it: This is how it could look for us: |
I've still neglected to update the docs for the new update, but the old ones should be close enough to get you on the right track.
This is one of, if not the, most important consideration I had when updating the plugin. Everything that I could possibly cache, I did. Also, the expensive functionality (notably, re-parsing out editor citations and footnotes for changes) only occurs after a user is done typing. You can see this by adding in a footnote/citation and simply using the backspace key to delete it out.. After you stop typing for a few seconds, or click somewhere else, the footnotes list/bibliography will update. There's still a few perf things that need to be added, but nothing too huge. |
Here is a test post containing a legacy footnote (MS WORD import, I believe) with a hyperlinked [1], and a footnote using your new plugin, showing as an asterix. https://bit.ly/2LRUZqI. Is there a way to make footnotes the same as the legacy example, i.e. its standard text size and with a hyperlink? Mobile users may find references easier to access and read that way. |
@nicopujol Sorry for the delay. It is possible to make it work in the way you describe, absolutely. There are some potential issues though that I should point out: The most salient issue is the strict differentiation of footnotes from in-text citations. Some (of the now well over 4000 available citation styles there are to choose from) are styled precisely in the way you have listed (e.g. The other issue with using the traditional anchor-style footnotes is with posts that are paged. Anchors just simply will not work in those instances. After checking out your example page though, it is clear that the tap targets need to be made bigger on mobile; especially so when footnotes are positioned right next to a link. That's something I will probably work on. Another thing (as I mentioned in my demo video): I do think there is some merit in allowing users to choose between symbols, numbers, and letters for their footnote format. That's something I'll likely look into after releasing the update. I think it should always default to the symbols though, just for safety with in-text citations. To comment on your question Re: automatically converting legacy footnotes to this format: I don't think that's worth the effort. Too many potential variations to account for and the return frankly isn't really worth it for the amount of work it would require. Hope that answers your questions. Good thoughts nevertheless. Again, I definitely think there is some progress to be made on tap targets. 👍 Edit: Also, I'm wondering why it is that you are even using footnotes in the first place? Both of your examples cite sources. Wouldn't it be better to use citations for that? |
Thanks @dsifford.
Agree, no need to convert legacy citations and footnotes. Only thing is the numbering overlaps, when using a citation.
Great to hear the test was helpful.
Footnote was the first popup which came on the editor. I see now that citations are located on the editor's sidebar. I replaced the example above on the same post with a citation (web page type, since book did not allow including a URL). |
Yeah, unfortunately in those situations, you'd just need to replace your old citations with new ones using the plugin in order for them to be tracked. Looking back at your test post I now also see that adding |
@nicopujol Did you try using the ISBN to insert your book citation? Assuming the book is indexed in google books, that is another alternative. If not, yeah, you'd have to add manually. I'll look into maybe adding a URL field to books. |
Hey sorry for the delay in testing the plugin. Unfortunately when I tried to activate the plugin I got this response:
Some additional thoughts: I know this is primarily an academic tool, but my biggest interest is in the footnotes functionality, and I'd love to see that expanded a bit more. Namely, I think it would be interesting to allow a wider diversity of content to be linked through footnotes. So right now it can only be used to display some text, but it could also be used hypothetically to show a video or image on mouseover. It seems to me that if one were to treat the individual footnotes as their own individual sub blocks you could possibly genericize the footnote content to the point where it could easily be adapted to almost any other kind of gutenberg child block type, even ones not created by you specifically. Just a thought. |
Whoops, sorry @jcklpe... I forgot to mention that I'm being super opinionated and am requiring PHP 7.2+ for the update since I work on this in my spare time and don't feel like supporting older PHP versions.
Interesting idea! Unfortunately, that's a bit outside the scope of the plugin I'm working on so I'll let others take the lead on pursuing something like that. |
Totally, yeah I prefer to use php also. This is on my host, so I'll have to see if I can upgrade stuff. |
Hey Ella @ellatrix It would be great with a status update to how the issue is coming along. |
Thanks for everyone's work here, it will be great to have this feature. |
Thanks for the great work! 🙏🏻 Will definitely use footnotes in Gutenberg on a daily basis as soon as they're available. |
I'm excited for this to come out too. :) |
Marking this as done! |
PR to introduce Footnotes to WordPress block editor: |
Implement a block for footnotes.
Prior pull requests: #2818
The text was updated successfully, but these errors were encountered: