How to: adding comments in wiki text

491 views
Skip to first unread message

CJ Veniot

unread,
Aug 1, 2020, 10:29:40 PM8/1/20
to TiddlyWiki
Kind of a no-brainer for anybody who knows HTML, but just in case there are other folk at the same level I'm at :Comments in TiddlyWiki.png

JWHoneycutt

unread,
Aug 3, 2020, 10:05:20 AM8/3/20
to TiddlyWiki
Charlie, 

Your comments work great, and are visible only when you are in edit mode.

You can also place comments visible in "rendered" mode like this:

/* comment comment
comment second line */

What you CAN'T do (unlike vanilla JavaScript) is use // (double forward slashes), since this is used by tiddlywiki for toggling italicise on/off

JWHoneycutt

Skeeve Magick

unread,
Aug 3, 2020, 10:54:35 AM8/3/20
to TiddlyWiki
Do not forget to NOT use "--" inside a comment as that is strictly forbidden.

Mark S.

unread,
Aug 3, 2020, 11:27:59 AM8/3/20
to TiddlyWiki
For something different, you could also use the TW macro syntax:



''Have you ever had the feeling that your head is not quite big enough to hold everything you need to remember?''

<<MBS1 
Yes! I had that feeling just yesterday. I was trying to memorize the encyclopedia Britannica, but 
didn't get past "Aardvark".
>>

Welcome to TiddlyWiki,...


Where your comments reference a macro which doesn't exist.

TW Tones

unread,
Aug 3, 2020, 9:12:04 PM8/3/20
to TiddlyWiki
And when defining macros you can do something similar to Marks suggestion

\define tiddler-description() This macro describes this tiddler "in line", you may never use the macro
\define amacro() macro def here
\define comment() this is a comment macro
\define multiline-macro()
one
two
three
\end
\define comment() this is another comment macro
\define current-display() Current: $(currentTiddler)$

...

Regards
Tony

Charlie J Veniot

unread,
Aug 4, 2020, 11:47:31 AM8/4/20
to TiddlyWiki
Thank-you all !

Although I figiured my first post was kind of at best a somewhat bland "amuse-gueule", this thread has turned into a nice platter of little nibblets.

Good stuff !

Eric Shulman

unread,
Aug 4, 2020, 1:35:15 PM8/4/20
to TiddlyWiki
On Monday, August 3, 2020 at 6:12:04 PM UTC-7, TW Tones wrote:
And when defining macros you can do something similar to Marks suggestion

Rather than using
\define comment() your text here

I like to use
\define --------------------() your text here
(all dashes IS a valid macro name!)

It makes the comments much easier to spot.

-e

TW Tones

unread,
Aug 4, 2020, 8:26:43 PM8/4/20
to TiddlyWiki
Folks,

Since this thread is becoming somewhat a document on using comments in tiddlywiki, I want to share a method I discovered since covid-19 (unrelated).

Consider the following facts
  • After defining a set of macros in a tiddler tagged $:/tags/Macro the text below is not included in those macros
  • Although comments themselves are not visible they existing in the text field and are searchable.
So lets say you define a set of macros as follows;
\define macro1(p1 p2) blahblah
\define macro2(tiddlername)
blahblah $tiddlername$
\end
<!--
syntax
Macro: macro1 `<<macro1 p1 p2>>` used to react to p1 and p2
Macro: macro2 `<<macro2 [tiddleranme]>>` tiddlername optional defaules to currentTiddler
-->
Notice documenting their syntax in the comments below?

Then a simple list can extract lines beginning Macros:
<$list filter="[all[]tag[$:/tags/Macro]]" variable=macro-tiddler>
   <$list filter="[
<macro-tiddler>get[text]splitregexp[\n]prefix[Macro:]]" variable=line>
       <
<line>> in <$link to=<<macro-tiddler>>/> <br>
   </$list>
</$list>

Notice how the result ends up being rendered?

I plan to use this method through out as my own de facto standard, however I wonder if we should develop a de jure standard for this form of self documentation?

This following tiddler tagged $:/tags/ViewTemplate
<$list filter="[all[current]tag[$:/tags/Macro]]" variable=macro-tiddler>
   <$list filter="[
<macro-tiddler>get[text]splitregexp[\n]prefix[Macro:]]" variable=line>
       <
<line>> in <$link to=<<macro-tiddler>>/> <br>
   </$list>
</$list>
Will display any such macro definitions in the current tiddler

The above solutions could be improved further by removing the comment block first, say one beginning `<!-- syntax`

I am however also developing a method to extract and document tiddler lines containing "\define macroname(params)"

Regards
TW Tones

PMario

unread,
Aug 5, 2020, 4:04:40 AM8/5/20
to TiddlyWiki
Hi,
As Eric points out that "all dashes" is a valid macro name and I'd use this one. ..

 - It's easy to see
 - If the number of dashes is always the same, it only uses 1 global macro name
   - This is better for memory usage. (just a little, little bit ;)
   - There is only 1 macro which "pollutes" the macro namespace.

Parsing those macros needs some time at the tiddler startup. ... So use them with care!

just my thoughts
mario


Charlie Veniot

unread,
Aug 29, 2020, 12:15:03 PM8/29/20
to TiddlyWiki
Just a quick update.  I like adding a colorful unicode character (here I'm using a little bit obnoxious "🔴") to help make comments "pop".

ReducingCognitiveOverload_WikiTextHtmlAndComments.png

TW Tones

unread,
Aug 30, 2020, 9:28:38 AM8/30/20
to TiddlyWiki
Reply all
Reply to author
Forward
0 new messages