nextcloud / text

๐Ÿ“‘ Collaborative document editing using Markdown
GNU Affero General Public License v3.0
555 stars 91 forks source link

Comments #185

Open monsieurhannes opened 5 years ago

monsieurhannes commented 5 years ago

This post summarizes the current state of the discussion in this ticket and the plans to implement (original report at the bottom):

Open tasks

Summary

grafik Initial sketch with available comments indicated in text and a button to create a new comment on the current active section.

Allow comments on block elements (paragraphs, headings, quotes, ...):

Motivation

Comments are useful in many situation. They allow adding information that directly relates to parts of the document without adding it directly to the document content.

Comments can be particularly helpful when drafting documents and during a review process.

Comments on block elements attach the comment to the relevant section on the document while avoiding the complexity of in line comments such as overlapping comment ranges.

Specification

Comments can be added to all block elements:

Alternatives

Inline comments

This draft mainly came out of the discussion of in line comments in #185. In line comments allow commenting on a precise range of text, which is hard to represent in markdown.

Footnotes

While footnotes could also be used to represent comments, they serve a different purpose.

2142 discusses footnotes.

User Interface Elements

Implementation

Out of scope for now (but maybe future)

Is your feature request related to a problem? Please describe. No, but it would be great to have the ability to comment text directly in the line.

Describe the solution you'd like Similar to gdocs and word, marking a text and writing a comment on the side.

Describe alternatives you've considered Linking a specific part of the text in the comment section in the panel on the right could also be a solution, maybe for the start, being able to link headlines #H2

Just an idea, might be too ambitious, but maybe sth. for the backlogs.

jancborchardt commented 5 years ago

@monsieurhannes yes, this would be very useful. Could you show screenshots from how Google Docs, Word and others do it as examples?

juliusknorr commented 5 years ago

Besides the frontend we of course need to think of a proper way how we represent the comments in markdown.

tiotrom commented 5 years ago

This would be such an awesome thing

juliusknorr commented 5 years ago

Please use the Github Reactions feature instead of commenting that also need a specific feature. That way we can see your support without notifying all users subscribed to a given issue.

joshp23 commented 5 years ago

Markdown footnotes would be a possibility to represent in MD

jtoloe commented 3 years ago

HackMD has this functionality. See https://hackmd.io/s/how-to-use-comments for examples. I do not think that the comments are stored in the markdown file.

juliusknorr commented 3 years ago

The issue with not storing it in the markdown file would be that we then loose the comments as soon as someone changes the file from outside (e.g. with a editor synced by the desktop client)

juliusknorr commented 3 years ago

Footnotes would be a possible way, but they limit comments to one cursor position in the text rather than having the possibility to mark a range of text and comment on that.

jnnkB commented 3 years ago

Maybe Critic Markup would be an option: http://criticmarkup.com/users-guide.php

monsieurhannes commented 2 years ago

Any development on this front? It seems like it gets mentioned more often recently. I guess Text is in a bit of competition with the big office suites which provide that feature already and maybe it's an overkill for Text. But at the same time Text is much more lightweight and accessible on all platforms. I'd be happy to help in any way - more in the UI than the programming part. ๐Ÿ˜†

juliusknorr commented 2 years ago

This would still be a nice to have feature, but is currently blocked by a proper approach to persist comments in markdown files, without impacting readability too much.

The only feasible option seems to be to use footnotes for this, but then you could only comment on cursor positions and not comment on a selected area.

susnux commented 1 year ago

I think range based comments are only possible with custom syntax. I would not use footnotes for this, as they might be added as a stand-alone feature in the future.

When talking about inline comments, how about HTML comment blocks? They are allowed as per markdown spec.

# Header
some text <!-- some comment --> text

But when talking about range comments, then I could not even find one already used syntax for that. So to stick with current style of markdown syntax this could be one option:

# Header
?[some text](with comment)
badrihippo commented 1 year ago

Comments as per CriticMarkup

Since many people have been mentioning CriticMarkup in this and duplicate threads, here's how it looks in practice.

Comment (sticks to a specific point in the text {>> like this <<}):

Lorem ipsum dolor sit amet.{>>This is a comment<<}

Highlight (highlights {==a specific passage==}{>>like this<<}):

Lorem ipsum dolor sit amet, consectetur adipiscing elit. {==Vestibulum at
orci magna. Phasellus augue justo, sodales eu pulvinar ac, vulputate eget
nulla.==}{>>confusing<<} Mauris massa sem, tempor sed cursus et, semper
tincidunt lacus.

To me this looks like an elegant solution, which will preserve the comments even when edited with an external editor.

One caveat is that the CriticMarkup parser doesn't currently support broken markdown tags: a highlight has to include both the opening and closing of the tag to work properly. They hope to fix this in the future and allow partial tags to be highlighted too.

First steps

I think even the first option (just inline comments at a specific point in the text, not necessarily tied to a specific highlighted passed) will be a great help for collaborative editing. Given that it also looks easier to implement, how about we start with that, and put highlights as a feature later down the line if needed?

Linking to the user

What remains to be standardised is how to link the comment to a NextCloud account. The simplest way is to prepend the commenter's name before adding the actual comment, like this:

NextCloud has a great collaborative editor {>>>badrihippo@domain.tld: and now we have comments!<<<}

If we're only saving these comments directly to the Markdown file, there is obviously no way to verify the identity: anyone can type my username into the text file to make it appear as if I wrote the comment. To prevent this, perhaps we could implement this in multiple stages:

  1. Start with identity-less comments: have them simply show up as speech bubbles without specifying who wrote the comment.
  2. Start specifying the comment author with the above syntax, but also save the comment information externally so that it can be cross-checked. If the comment doesn't match, we could either remove it (destructive) or display a warning saying that the identity of the commenter could not be verified. (I prefer the second option)
  3. (Not sure how feasible this is) scan the Markdown file everytime it is edited, so that if the user has manually inserted a comment with the given syntax, and under their username, then it gets added to the database as "their" comment. This goes hand-in-hand with the "could not be verified" comment handling behaviour

That's as far as I've thought so farโ€”is there anything I missed, any concerns, or anything that could be done better? (Tagging @juliushaertl for what you think of the markdown mechanics, and if you have any concerns about using CriticMarkup instead of vanilla markdown or whatever we use right now).

mejo- commented 1 year ago

Thanks a lot @badrihippo for the thorough reply. I like your approach. CriticMarkup doesn't look very active, but the syntax seems sensible nevertheless.

And there is a markdown-it plugin for CriticMarkup (that is very old but then it's only a few lines of code anyway). We would need that for serializing the markdown into HTML.

There's also vimtaai/critic-markup which might help as code inspiration (e.g. for parsing regexes).

pierreozoux commented 1 year ago

This discussion looks a lot like this one: https://github.com/hedgedoc/hedgedoc/issues/2879

I would love that nextcloud/text and hedgedoc agree on the same solution so that I could use hedgedoc and other people text, and this would be compatible :)

It is probably utopia, but this is the way I feel, a common internal standard to collaborate between different tools, and different UI according to preferences.

Sorry to open the scope of the discussion, don't hesitate to label it as offtopic.

Have a nice day!

codedust commented 1 year ago

To get a better feeling for this solution, here are some screenshots of popular text editors, as @jancborchardt suggested:

Google Docs

grafik

LibreOffice Text

grafik

HackMD

grafik

see https://hackmd.io/s/how-to-use-comments

OnlyOffice

grafik

max-nextcloud commented 6 months ago

I played with some plain commonmark markdown syntax. Actually it's quite difficult to come up with something that will work if multiple comments exist for overlapping ranges.

Using links with titles would be nice in terms of the rendering outside text - but it does not allow editing in other editors that do not allow editing the underlying markdown directly. Otoh I wonder which editors this would be.


## Try CommonMark

[You๐Ÿ’ฌ][1][ can ๐Ÿ’ฌ][2][ try๐Ÿ’ฌ][1] CommonMark here.  This dingus is powered by
[commonmark.js](https://github.com/commonmark/commonmark.js), the
JavaScript reference implementation.

[1]:  "Comments"

* @ali: My comment to this...
* @bob: I'd rather...

[2]: mention://cem "Comments:
@cem: actually you can't...
"
mejo- commented 5 months ago

@max-nextcloud and me discussed this briefly:

max-nextcloud commented 5 months ago

I've been pondering this some more. Haven't really made up my mind yet - so throwing some random thoughts out.

Using links to denote comments

We could use links to anchors in the file to denote comments like mentioned above.

[Text I want to comment on](#comment1)
... more text...
... end of the actual content

----
# Comments

<div id="comment1">

> Text I want to comment on

@max-nextcloud : my comment
@someone-else: their comment
</div>

Pros:

Cons:

CriticMarkup

Pros:

Cons:

Using our existing comments on files system

We do have comments in Nextcloud. It's not used so often I think - but we could improve that by embedding it in text.

Pros:

Cons:

manicmarvin commented 3 months ago

My two pence [disclaimer: not really contributing code to this repo].

Using links to denote comments

Cons:

  • Comments are separated from what they comment on.
  • We might be left with dangling comments after the original content has been removed.
  • We might be left with links pointing nowhere if the comment in question has been removed

Apart from the other cons, IMO these issues pose serious obstacles for large groups where not everyone is familiar with the comment protocol. Those editing files primarily in an external editor are almost sure to break others comments because it will be easy to miss that the comment even exists or how it works.

CriticMarkup

Pros:

  • Comments are inside the paragraph they refer to.
  • Clearly limits content of comments to inline content.

These address the issue I mentioned above, it's harder to miss new unique syntax and will probably ensure unfamiliar users pause and consider before making changes.

Cons:

  • Is any other tool actually using this? I saw discussions on hedgedoc, hackmd and cryptpad but none of them implemented it.

even if no one else chose this path, it seems to me to be the best path for NC, given how the files within it are edited by a different people using a plethora of different editors.

* If not parsed syntax can be somewhat confusing.

A pro, not a con, IMO.

Using our existing comments on files system

Cons:

  • Would need extension to support referring to specific text.
  • Would get out of sync if file content is updated outside of text.

These two issues make this path non-viable, IMO. I am constantly thinking of the way nextcloud is often used -- in large heterogenous groups or organisations where not everyone is familiar with all features of all tools.

juliusknorr commented 1 month ago

From the discussion with @marcoambrosini and @max-nextcloud:

We currently see 3 options

Stretch goals

susnux commented 1 month ago
  • footnotes to comment on positions

I would rather go with HTML comments as a syntax that way we would also solve the problem that text does not preserve HTML comments

juliusknorr commented 1 month ago

The benefit of footnotes would be that it does not impact readability of the plain markdown too much, with html comments that is probably getting quite messy if there are a couple of comments on the same line

marcoambrosini commented 1 month ago

@juliushaertl could we schedule a kickoff meeting with stakeholders to scope down this feature?

susnux commented 1 month ago

The benefit of footnotes would be that it does not impact readability of the plain markdown too much, with html comments that is probably getting quite messy if there are a couple of comments on the same line

Thats true, I was just hoping that text would now preserve my comments ๐Ÿ˜„

max-nextcloud commented 1 month ago

I started #6478 to discuss the approach we're currently pushing forward: Comments - but not in line but rather on a per block element basis.

juliusknorr commented 3 days ago

@max-nextcloud Let me close this in favor of https://github.com/nextcloud/text/issues/6478 then. Don't see a point in keeping two issues open if we're aiming for one implementation of comments ;)

juliusknorr commented 3 days ago

Or wait, since this probably has more detailed description. Let's use this one. I'll copy the current state of discussion over.

juliusknorr commented 3 days ago

Copying over design spec draft from @nimishavijay (https://github.com/nextcloud/text/issues/6478#issuecomment-2385154856)


References

Google docs ![42a0cdf3-4d18-8022-8005-0c92e4168cf5](https://github.com/user-attachments/assets/e3a79d32-d214-48e1-853d-588d23105906)
Notion ![2d265c62-6e48-80b8-8005-0c92ddf5fe3b](https://github.com/user-attachments/assets/fcc991f0-cb75-4761-a45d-0b383a0ebd07)
Confluence ![2d265c62-6e48-80b8-8005-0c954d7669cb](https://github.com/user-attachments/assets/1ce3fb23-5ed3-4ff7-bd61-a2184213a7d6)

Design specs

Existing comments

image

image

New comments

image

image

New comment element:

Mobile view

Mockups TBD

TBD:

What do you think? :)