BumbrT / obsidian-reading-comments

Reading comments, for consuming books or large articles in markdown with https://obsidian.md/.
MIT License
45 stars 1 forks source link

Comments are automatically displayed in live-preview #61

Open ZeaseTech opened 6 months ago

ZeaseTech commented 6 months ago

Comments are automatically displayed in live-preview, As shown in the figure below: 屏幕截图 2024-04-06 185341 Can you optimize it to solve this problem?

BumbrT commented 6 months ago

How to access this live-preview mode? Currently I use only edit and view mode. Can you please elaborate on how to reproduce this issue

ZeaseTech commented 6 months ago

What I mean is that if you add a comment to a text first, and then refer to that text with an internal link, when doing a live preview of that internal link (with the cursor hovering over that internal link and holding down the CTRL key), the comment is automatically displayed to the left of the text, and is not in a hidden state. See the video below for the exact reproduction process:

https://github.com/BumbrT/obsidian-reading-comments/assets/95735348/e7dbf132-4882-46b9-b8ab-fc60b053b899

BumbrT commented 6 months ago

Got it. With which plugin you create this internal links ? Found that it works through obsidian code blocks, and Obsidian parses the whole text inside the block, it's internal mechanics (which I unable to change). Possibly need more collaboration with the plugin developer to find out cheap way to implement compatibility.

BumbrT commented 6 months ago

Also, if you will use “Extract original note...” option, everything will work flawlessly, because it also transforms to plain code blocks, without HTML, and moves comment to separate note. But if you need to proceed with comments creation on the fly, then this approach isn’t best. So, drop to me the plugin which you use for these links, and we will look at what could be done.

ZeaseTech commented 6 months ago

Thank you for your answer, as you said, it's too much trouble to export comments as a note, that's why I used the "Reading comments" plugin. I used "Copy Block Link" to create that internal link, but it creates a link in the same form as the official Obsidian link, so if I create the link manually, Obsidian will still parse out the content of the comment when I do the live preview.

BumbrT commented 6 months ago

I found out, that if you will use native obsidian comment: %%Comment body%%, it works fine with the code block link. Also my plugin support exposing these comments to comments panel (but hierarchy doesn't work). In case you will have idea how to implement better flow from my side, I open for considerations.

Also my plugin support auto comment note creation from reading comments. It will export two extra notes, but once you add new comments, you will have to re-export.

ZeaseTech commented 6 months ago

Using %%Comment body%% with Reading comments can indeed not display the content of the comments, but when you want to preview the content of the comments again from the live-preview window, you will see a flashing window, that is to say, you can not see the content of the comments, which also affects the experience. I'm sorry, I'm not a professional programmer and I don't know how to write code, so I can't help you solve the problem. The latter feature you mentioned about automatically creating two additional comment notes leaves a lot of room for improvement, just like you said. I can use the Note Refactor plugin to automatically convert a comment into another note, as well as automatically leave a linkback and put it in a custom folder with a custom naming, but it's not without its drawbacks, such as the fact that it can't add the content of the comment to the previous one, and I can only recreate a new note to save the content of the comment, which would make my Obsidian library more and more bloated. It would be nice if could combine the advantages of these two plugins.

BumbrT commented 6 months ago

@ZeaseTech My plugin already can export commets to seprate note, you can look at "Extract original note with links to comments note" command. Meanwhile, I'm looking what can be done, but there is no quick fixes, it's internal obsidian logic, to which plugin developers has no access.

ZeaseTech commented 6 months ago

Okay, now I've tried this feature, I think it's still good, especially you can add more than one comment in the same note, but there are more steps, you need to insert the comment first, and then you can generate the "xxx Comments" file and "xxx Original" file. I think it only takes one step to leave a link back to the original text without generating the "xxx Original" file, and the generated "xxx Comments" file can be placed in a folder with a specified path, and at the same time, you can name the comment file in a certain format, which is a much faster way of processing. This is a much faster way to deal with comments, just like in the original text using the command "Add inline reading comment for selection" to create comments directly, one step can be completed. For how to deal with the alias of the comment, I have two suggestions can be provided, the first is to select the text as a comment inserted into the comment file, while leaving a link back in place, back to the chain of aliases need to be their own, if you can be automated to complete the same, such as: "...comment...|alias", select this text can be directly in the original text to leave a link back to the alias named, preview this link to see the content of the comment. Secondly, is to select the original content, press the shortcut key can be directly generated by this original content named back to the link, and then jump to this comment file in the sidebar, write your own comments in this comment file. Perhaps there are better ways to create aliases, I can only give some of my ideas here. As for the problem of the annotations not being easy to preview in real time, as you said, it's really not very easy to solve, it should have something to do with the parsing method of Obsidian software. So, I think you can spend more effort on optimizing the operation steps of "Extract original note with links to comments note" and the location of the generated file.

BumbrT commented 6 months ago

Yes, this is the cleanest way, but it will require tremendous effort to implement. It could be done through replicatioin functionality of this plugin for editing comments in separate note on the fly

ZeaseTech commented 6 months ago

You just do it according to your own situation, after all, I'm not a professional programmer, so I don't have a clear handle on the overall difficulty of implementing the above features.

BumbrT commented 6 months ago

I’m writing here also for anyone who will have the intention to contribute. For now, I have no time for this feature implementation, but can assist if someone, after reading our conversation, will have a desire to collaborate.