@jypre
I find it counter intuitive to have comments inside a filter, because unlike inline procedures, macros and custom widgets they have a very specific syntax. It would be similar asking for comments inside a variable;
<$let name="value <!-- comment here will not work -->" 2ndname="yes">
where you can do this
<$let name="value" 2ndname="yes"> <!-- comment herewill work -->
or even this
<$let name="value" 2ndname="yes" note="The values set the operation of the next section"><!-- note here will work -->**strong text**
So I have also used comments like this;
\define note()
you can define the same "variable multiple times", only the last is valid, but if you never use `<<note>>` who cars.
\end
\function myfilter() [tag[TableOfContents]]
<!-- filter above contents top tiddlers -->
\procedure my-proc()
...
<!-- comments here work but may alter block or inline mode -->
\end my-proc
\define note() Anything else you want here
\define note() <!-- Anything else you want here is more obviouse in comments -->
\function myother.function() [tag[About]]
If we introduced a comment that is allowed inside a function, we need also to permit that being escaped.
Other options would include /* */
//
but honestly intuitivly I do not think functions should inculde comments. Although here is a work around.
\function .note(note) [match[neverhappens]then<note>else<currentTiddler>]
\function my.function(tag) [tag<tag>] +[format:titlelist[]join[ ]] ~[.note[Place a documentation note here]]
<$list filter="[my.function[TableOfContents]enlist-input[]] ~[[another note of no consequence if result never empty]]" >
</$list>
The above is just a proof of concept, here I use the short else ~
, it also trys and pass through titles if the result is title(s) (not in this example) but more research is needed.
This makes me ask what if we introduce a :note filter run prefix that does absolutely nothing?
\function my.function(tag) [tag<tag>] +[format:titlelist[]join[ ]] :note[[Place a documentation note here]]
Finaly if you do want to use <!-- comments -->
this provides an editor toolbar button to wrap and unwrap selected text with comment braces. editortoolbar-comments.json (1.4 KB)