Feature Request: Comment Formatting

I got note embed working with <mark>
now preview in a note shows noramlly, but when wrapped in <mark> a highligh, </mark>
and on a note embed the highlight is hidden. This is exactly what I was looking for thanks @ryanjamurphy and @0x4A for all the help

thisis what I got on my obsidian.css

  .markdown-embed-content mark {
      display: none;

It doesn’t seem to show previews with [[links]] in order to fix this
what I’d love to be able to do is make it work with <span style=display:none> so that I don’t have to interfere with <mark> and solve [[links]]

I’d like to bump this if possible. Currently, as far as I can tell, there’s no formatting which will hide a comment both when previewed in Obsidian and when a vault is Published to the standard theme. Publish doesn’t have custom CSS yet.

I think this trick works without regard to CSS. But custom CSS in Publish is out: Obsidian Release v0.9.4 (Insider build)

+1 for adopting CriticMarkup. nvUltra and Marked.app render the markup it’s useful.

3 Likes

+1 for this. Licat asked me to add my usecase:

I am an author, so I’ll often want to write a note-to-self inside of a piece of prose. I want to see it on edit view, not on preview (preview is currently how I “export” to a publishable form for other people to see my prose), and have the links actually work, but not on preview.

In this example:

She couldn't back down now. In for a bolt, in for a blanket. <!-- they don't have coinage, see [[13.01b Coins and Commodity Money]]-->

the link to my note about the history of coinage is meant to explain why the idiom has been changed from “in for a penny, in for a pound” so I don’t forget later. The link shows up on “linked mentions” in the backlinks bar for 13.01b but it’s still a bit annoying that I can’t interact with the commented information.

It would be great if either html comments just outright had interlink functionality, or if /* comment */ was added in to function this way and html comments were left alone.

Unfortunately, I already use highlights and code blocks extensively throughout my vault to, well, highlight and demarcate code.

3 Likes

that’s a good explanation of a use case where a dedicated functionality for comments would be really useful.

In general even though !<-- html comments --> technically work for simple stuff (without [[links]] and #tags) I find html comments syntax a bit annoying.

Personally I use this format mentioned somewhere in this thread

[//]: # (comment goes here)

however it has the same limitation that @EleanorKonik explained.

Personally what I’d really like is a clean syntax.


Regarding @EleanorKonik 's request, it kind of goes beyond what normal commenting out does, so what we would need is something like a customizable plug in that has the functionality to still allow for certain elements to work such as [[double square links]] that could perhaps only show in edit mode, but not in preview mode.

yeah I really don’t care what the solution is – I’m not wedded to html comments they’re just the best I could come up with – as long as there is a way to have a “note to self” that works with interlinks and tags in edit view but have it hidden on preview.

It would also go a long way toward solving what some people are looking for out of non-plugin metadata, because then I could have a “commented out” header block at the top of a page that’s visible in edit view, and usable in edit view, but hidden in preview mode.

2 Likes

For those willing to sacrifice highlighting for commenting, you can add .markdown-preview-view mark {display:none;} to your stylesheet or snippet.

This keeps the highlight in edit, but removes it completely from preview. The link is accessible on CTRL/CMD+Click, and hover preview works, too.

This is a vault with no theme or css except the above snippet:

Similar could be done with code backticks, which might be more appropriate for many writers who still like to use highlighting!

1 Like

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