jupyter-book / jupyter-book

Create beautiful, publication-quality books and documents from computational content.
http://jupyterbook.org
BSD 3-Clause "New" or "Revised" License
3.84k stars 659 forks source link

Save Comment to Browser Storage #1459

Open psychemedia opened 3 years ago

psychemedia commented 3 years ago

Description / Summary

Adding comments to books is currently supported using external comment or annotation servers such as hypothesis.

Looking at my institution's Moodle VLE recently, I noticed a block type that provides an editable free text comment box within which users can make and save their own notes:

image

In the above example, the text entry box is also linked to a hidden discussion reveal block that is enabled once text has been entered into the comment form.

It would be useful to support a Jupyter Book admonition that allowed:

Value / benefit

Users who use the same browser would be able to make and save notes in a book without a network connection or an account on a third party comment or annotation server.

Browser storage support might also be reusable for saving and reload edited executable code blocks.

Implementation details

Possibly related:

Tasks to complete

choldgraf commented 3 years ago

This is a cool idea! My main question would be whether there are any pre-existing JS libraries that support this already, as it seems like it might be a complex thing to implement from scratch. Perhaps there's something we could build a light wrapper around, similar to what we do with Hypothesis etc?

psychemedia commented 3 years ago

Agreed. There seem to be a few jquery packages in the ballpark (eg Get And Restore Form Data Using Local Storage - jQuery Save My Form) and related packages although I've never used any of them before.

More generally, I don't know of anything offhand, or whether there is something that could be pulled out of jupyter-offlinenotebook or maybe even jupyterlite on the storage front? store.js also looks pretty robust from the repo stats at least.