Feature Request: Comment Formatting

Also could instead be used with bold or italic markdown. I don’t think link behavior can be preserved in a code block, but it could indeed be hidden.

D’oh, you’re right. Forgot about the goal of preserving functional links.

1 Like

@EleanorKonik what @Erisred said about using ==highlights== to comment out, would be a good workaround for your situation. There’s more discussion about it above in this thread.

I’ve tried it in the past and it works nicely, but of course it removes the ability to highlight, which is a nice feature, specially considering amazing plugins like @akaalias ’ plugin extract-highlights-plugin which is a great tool for writers, but relies fully on the ability to use ==highlights==

Check out what @ryanjamurphy mentioned a few months back, here’s my reply to his suggestion. It might be an alternative that could work for now

Hope that helps!

2 Likes

Hello

A could of related feature additions.

  1. When writing, it’s useful to be able to quickly add comments around a few words or a block of text, (maybe this could be a plugin?)

  2. Option of having the commented text not counted in the wordcount

Thanks

4 Likes

Having a robust comment system would be nice (especially if doing any collaborative work).

In the mean time you could look at these two options:

Inline Comment structure:

You can use comment structure similar to html comment format to make inline comments. Anything in the comment isn’t rendered. They do count toward wordcount however.

Typing this:

Bob walked quickly <!-- find a better verb for this --> to the window

Will show this in preview:

Bob walked quickly to the window

Footnotes

You can use standard footnote syntax to make footnotes in your text. They also count toward word count.

2 Likes

Thanks.

Is there a shortcut or a method of quickly adding the html comment tags, rather than typing it all out?

Pity commented out text is counted in the word count - would be a nice feature to have an option not to be included.

Not through Obsidian I’m afraid, you can however use a text expander like espanso to do it.

Hi, I have a similar feature request. As a creator of a note I want to share it with a Reviewer, the reviewer should be able to comment the note in plain text (addition, deletion, subsitution, comment, highlighting). The commented note then needs to be rendered accordingly in preview to show the comments in a user friendly way (eg. strike-though when deletion, new text highlighted green in an addition etc.)
I think criticmarkup.com - http://criticmarkup.com/spec.php seems a viable Syntax, I think only rendering and templates would need to support that.

4 Likes

I wasn’t aware of critic markup. I’m checking it out, thanks for sharing it! Looks amazing

Was thinking about this today. Now that Obsidian has templates, you could create a template for a comment or footnote.

The other option depending on your use case is to use tags for comment types. Many people (myself included) will use tag to denote actions needed or current status. A tag of “TODO:” or “Expand” or “Rough Draft” allows you to use the tag pane and find all of your “todo” items.

Especially with how the search function supports the “path:” keyword you could also limit tags to within a certain folder or folders or exclude folders.

Hope this helps.

We will add %% this is a comment %% in 0.10.12.
I suggest you open a separate plugin request for criticmarkup.

9 Likes

May I ask why the comment syntax requires a closing %% and doesn’t auto-close on a newline? My notes contain comments like this:

%% The following section contains:
%% - a
%% - b
%% - c
%%
%% Note the odd number of comment lines. This whole comment block would break apart in Obsidian.

Both are quite standard comment syntax methods in code, but I know that Obsidian focuses on HTML & CSS output where it does not. Still, my main note taking app (Ulysses) supports this, matching that common behavior.

This also allows for easy toggling of comments on/off with the standard hotkey of Ctrl/Cmd+/, because it just means toggling the presence of %% (including a space) either at the start of the line, or at the start of the text (for indented text).

I reckon the engineering might be harder to implement now that the existing syntax has been launched, but I would love if it could be supported, maybe via a setting to toggle between the two styles? I don’t know if a plugin could handle this.

You like autoclose on new line, other people would like to have a syntax for multiline or subline comments.

There isn’t too much reasoning, @Licat tried to pick something that feels “markdowny”, **bold** %%comment%%

3 Likes

This makes sense, although I’m in the same boat as @KuraFire, used to Ulysses, where I can use %% for block comments and ++ for inline comments. Block comments are still markdowny, like using ## for headings, though I admit it’s mostly a matter of wanting consistency between the two main programs I write in, and I wouldn’t expect you to just match Ulysses wholesale.

So, consider this another vote in favor of auto-closing comments on a newline!

1 Like

@npseaver would you mind opening a request for that? We won’t track the FR in the archive.

2 Likes

@argentum & @npseaver I wrote up a new FR for it, as an evolution on the existing syntax:

1 Like

Just a reply here to the reasoning:

The comment syntax more closely follows the $$ math/LaTeX syntax, where you may want to write multi-line block comments without having to prepend the delimiter on each line.

This semantically is closer to markdown’s design where syntax can either work at a “block” level or an “inline” level, rather than on a per-line basis.

We’d also like to avoid having to reserve multiple different syntaxes %% and ++ if it could fit in one. Otherwise it becomes too easy to trip on a syntax unintentionally.

I understand that you wish for a more syntax-compatible version with Ulysses, but unfortunately I don’t believe that’s likely to happen. The syntax themselves work too differently to have any kind of “compatible” mode that can support both. We fundamentally don’t agree with their syntax proposal, and we also now have users who are already reliant on the current syntax for their notes. This means that even if we were convinced Ulysses’s syntax is the way to go, it’d be a painful process for current users to migrate.

9 Likes

Great to have a comments shortcut now! I would however like to change the format of my comments (personally prefer HTML <!-- --> over %%%% for consistency with other software I use). Is there a way to do that internally to Obsidian’s “Toggle comment” shortcut? I.e., rather than creating a new comment shortcut with espanso or something. Many thanks!

3 Likes

There is not—and you’d have to create a new feature request thread for this if you want the idea tracked!

1 Like