livebook
livebook copied to clipboard
Allow users to comment on cells
Those comments will become a thread. The thread will be persisted to markdown with the user info who wrote them.
Hi @josevalim, I would like to work on this if its not picked up by anyone
Hi @sreecodeslayer, thanks for reaching out. I think we need to do a bit more work specifying the future before anyone can work on it, sorry. :( I should save some time to organize the issues tracker so we are a bit more welcome. In case you want to look at something immediate, #281 and #277 should be actionable issues. :)
I think we need to do a bit more work specifying the future before anyone can work on it, sorry. :(
Ah, makes sense, no worries 🙂 I was just playing around with this a bit, thought i'd reach out to see if you had more details
In case you want to look at something immediate, #281 and #277 should be actionable issues
sure, will check them 👌🏼
Any news on this? Livebook is already a first-class option for documentation and knowledge sharing, even introducing simple comments similar to google docs would be terrific; and dare I say we could do much better than google docs' comments.
Hey @LeartS :) We are yet to discuss details of this, but there are a couple other features we prioritize for now.
Hi @josevalim @jonatanklosko, I can start working on or drafting specs for this feature if you want
Hi @BasileNouvellet, that would be welcome. Note we do have a mockup of how it would look like:

We are also aware of some of the complexities in the implementation. In particular, we will need to tackle which selection of a text the comment applies to. If I remove a text inside or around the selection, we should still keep the comment, but remove the comment altogether if the text is removed. This is definitely doable. Google Docs does it. Any collaborative text editor with bold/italics/etc support has to solve a similar issue and I think the Delta libraries for Elixir solve it too. I don't know how many conveniences the Monaco editor provide around it though.
Then once the above is solved, we need to choose a form to serialize comments in the .livemd files. Then we can freshen up the UI. :)
Comments on selection are complicated, because for Markdown we show the rendered content most of the time. Also, recently we started to introduce new types of cells (smart cells), so we should support comments on those as well. Deepnote and Observable support comments per-cell, so we should be fine doing the same:
Per cell is too low granularity for me in markdown cells. I wonder if we can keep it per paragraph or split a Markdown cell once comments are added?
FTR one option is to handle comments on cell-level, but allow each comment to have an optional editor selection (so the selection is more of an additional info, and removing the selected text doesn't remove the comment). One thing to keep in mind is that smart cells may have two editors, so we would need to support it for the primary one, or persist editor names.
After discussing offline, we agreed that comments should apply to the whole cell, forming a "Discussion".
We may also add support for ephemeral, source-related comments, but this is a separate feature. Those comments would go as # TODO
in the source, we would parse them and show in the sidebar. This way they can be easily searched in version control, PRs, etc.
Could you point out the areas in the code to contribute to for this feature? Something like a little roadmap, but in term of code files & function names. Thanks!
Sure, here are the high-level parts
- add comments to the notebook data structure, specifically each cell type (
Notebook.Cell.*
) will need a list of comments - add operations for adding/removing/editing comments in
Session.Data
(and matching functions inSession
) - add UI for showing the comments and applying the above operations (mostly around
SessionLive
andCellComponent
) - extend export/import to persist the comments in Live Markdown (this is pretty separate and can be left to the end)
Hey guys,
I've made some progress on the feature. Here is a little demo: https://youtu.be/xZQT_LvH0i4
Left to do:
- Delete & edit comments
- Fix issue with autofocus not working on the comment text input
- Persist comments in
.livemd
/.exs
files
Let me know what you think. I'll open a (draft) PR shortly.
@BasileNouvellet awesome! Feel free to open a PR and we can iterate from there :)
Livebook is moving to an architecture where developers run notebooks on their machine. So while we will definitely want comments in the future, comments are not helpful unless we have a central architecture where comments and collaboration happen on the fly. So we are postponing the focus on comments for now. :)