Support block and inline level comment syntax

With the release of 10.13, comments are supported by the use of %% This is a comment %%

This is a very welcome addition! :heart: However, in the original feature request thread for it, a discussion emerged (triggered by me) about matching compatibility with Ulysses’s comment syntax, which has two types of comments:

%% This is a block level comment, Markdown-style to match ## 
%% It does not require closing, only %% at the start.
%% 
%% It easily allows for multi-line comments with blank lines.

Currently in Obsidian, the above example would output this:

It does not require closing, only %% at the start.

It easily allows for blank lines within comments.

Ulysses supports comments exactly the way Obsidian currently does them, as wrapped with inline support, but using ++ as demarcator:

This paragraph has an ++inline comment++!

That would render as:

This paragraph has an !

This is a feature request to match that behavior, which would involve changing the demarcator for comments from %% to ++, and adding support for block level comments using %% at the start of a line. (It allows and ignores whitespace before it, which would get output but does not break the comment.)

3 Likes

Chiming in to broadly agree here. It also seems like it could be possible to use %% for inline comments as well, just by having comments close at either a newline or at %%. No need to copy Ulysses directly and use up more characters (like ++) to manage comments (although I’d be happy with it).

The only thing that would change would be that existing multi-line comments would need to have %% prepended to each line. This is both easy to do in Obsidian and makes the comment block easier to see in plain text. That seems to me to be the strongest argument for it: it should be easy to see whether any individual line is commented out, and it is currently not, unless you’re in Obsidian.

1 Like

Hit another thing relevant to this today: is there a reason that the comment syntax and the highlight syntax work differently? (Assuming this is not some theme quirk) image

From what I can tell: highlight syntax is treated as inline, and is ended automatically at a newline. Conversely, in Obsidian the comment syntax %% is treated as an opening tag, not a line-based comment the way e.g. // … works in JavaScript files.