Giter Site home page Giter Site logo

bumbrt / obsidian-reading-comments Goto Github PK

View Code? Open in Web Editor NEW
39.0 2.0 1.0 2 MB

Reading comments, for consuming books or large articles in markdown with https://obsidian.md/.

License: MIT License

JavaScript 2.53% TypeScript 89.66% CSS 0.49% Vue 7.23% Shell 0.09%
markdown-viewer obsidian-md obsidian-notes obsidian-plugin

obsidian-reading-comments's Introduction

Obsidian Reading Comments

Plugin allows to create inline html comments while reading markdown notes in Obsidian. Also native %%comments%% supported. Comments could be grouped hierarchically by tags. After commenting job done and finalized, original note with internal links to comments note (in plain obsidian markdown, clean from HTML formatting) could be extracted for integration with rest of the vault.

Obsidian forum thread

Readme на русском

Usage

Insert a comment

Select text in editor, which you want to comment. Open command panel and type Add reading comment for selection ,then press Enter .

It's recommended to assign hotkey for this command panel action.

You can use hierarchical Parent/Child tags in "data-tags" field.

Open comments panel

Open command panel and type Reading Comments Panel.

Extract original note with links to comments note

Open command panel and type Extract original note with links to comments note.

Features

  • Tag comments hierarchically: Parent/Child/Etc tags supported and grouped by parent in the panel
  • Search in comments
  • Navigate to particular comment by click. Native %%comments%% supported.
  • Extract original note with links to comments note
  • Remove selected comment by hotkey
  • Toggle selected comment to block/inline by hotkey
  • Hide comment until commented text body is hovered
  • Pick comment color from settings
  • Dark and light theme support

Showcase

Buy me a coffee (or just star this repo:)

If you enjoy this plugin, feel free to buy me a coffee.

Create comment showcase

Create comment

Search comments in the panel showcase

Search comments

Extract original note with links to comments note showcase

Extract original note

Installation

  • Install from obsidian community plugins store
  • Or use obsidian BRAT plugin with github link to this repo
  • Or download latest release file from Release page and put files to your vault/.obsidian/plugins folder. Community plugins should be enabled.

Customization How To

How to add icon next to commented text

  • Follow obsidian CSS snippets guide to add custom css for vault
  • Pick icon and copy svg from Lucide or any other source
  • Add following custom css:
.ob-html-comment:after {
    background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXN0aWNreS1ub3RlIj48cGF0aCBkPSJNMTUuNSAzSDVhMiAyIDAgMCAwLTIgMnYxNGMwIDEuMS45IDIgMiAyaDE0YTIgMiAwIDAgMCAyLTJWOC41TDE1LjUgM1oiLz48cGF0aCBkPSJNMTUgM3Y2aDYiLz48L3N2Zz4=");
    content: "";
    background-repeat: no-repeat;
    width: 16px;
    height: 16px;
    background-color: white;
    display: inline-block;
}
  • Play with width, height and background-color parameters

Implementation details for DIY plugin modifications and pull requests

Comments logic

Most important logic located in src/comments/ConstantsAndUtils.ts When Add reading comment for selection executed, editor selection replaced with the following code:

<div class="ob-html-comment" id="comment-${commentId}" data-tags="[comment,]"><span class="ob-html-comment-body">CommentPlaceholder</span>${htmlEscapedSelection}</div>

Plugin parses text for comments and organizes them in panel hierarchically by tags.

Display logic

All styles and display logic are located in styles.css and src/HtmlCommentsTemplate.vue files.

Thanks

Implementation has been based on the Obsidian Quiet Outline plugin. Basic idea has been taken from the Comments plugin.

Possible evolutioin directions

  • Multiline comments support (refactoring line by line parsing to multiline).
  • Tab for comments in whole vault/folder
  • Tags renaming in the tree, drag&drop, etc tags and comments management

To introduce "nice to have" features, create issue here or better donate with "buy me a coffee" website

"Nice to have" features

  • tags and comments ordering algo in settings
  • customize tags placeholder(for now "comment,")

obsidian-reading-comments's People

Contributors

bumbrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

coltallen

obsidian-reading-comments's Issues

[Feature Request] Support Obsidian Comment Syntax

Hi, thanks for such an amazing plugin!

Sometimes, I don't want to use heavy HTML syntax in my markdown, but really need the comments panel, extract, search... of your plugin.

I wonder if supporting Obsidian native comment syntax (%%...%%) will waste too much of your time?

Thanks and best wishes!

[Feature request]: Show comments in a hover window

Thanks to the author! I've been looking for a similar plugins for a long time, but I couldn't find a good one. Now, I've finally found this plugin.

Could you add this feature: show comments in a hover window, just like "Ctrl + 'hover the mouse cursor over the link'" in obsidian, I think it might be a better presentation.

I would be grateful if you could consider adding this feature in the future.

[Feature request]: optional icon next to commented text

Firstly, thanks for sharing. Really helpful.

I would like to suggest an optional icon such as a sticky note next to commented text to help differentiate commented text from highlighted text when also using the Highlightr plugin. One could say, well use a different colour for the Reading Comments highlighted text. This is fine except for those who use intricate systems to colour code information and use a lot of highlighter colours already (ahem, like me). A little in-line icon such as RiStickyNoteLine would be helpful here.

I hope I explained that sufficiently clearly.

Best,

Haydn

[Feature request]: Pin comments and Edit comments in the hover window

Thanks for your kind contribution! The plugin I've always longed for!
I wonder if you could consider adding a floating bar to pin the popup window of the comments and then edit it. I suppose that would be more friendly to users.
I would highly highly appreciate it if you could please take this feature into account!

Feature Request: Place Cursor at Placeholder

What a great plugin! I've been looking for a good way to add comments to markdown documents for forever.

One feature request, if you don't mind. Right now, on inserting a comment, the cursor appears at the end of the HTML tag. Would it be possible to make it so that the cursor instead jumps to where the "CommentPlaceholder" text now appears?

It would be a little easier if the cursor appeared here so that the user could begin typing immediately upon inserting a comment, rather than needing to mouseclick/arrow-over into the CommentPlaceholder portion of the tag.

Thanks again for making this! It works really well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.