Adding Programming Comments/Remarks

525 views
Skip to first unread message

pinkp8ther

unread,
Dec 28, 2011, 4:50:21 PM12/28/11
to TiddlyWiki
Is there an easy way to add Remarks or Comments inside the Tiddlers to
document what is going on, how stuff works, and what not to change?

TIA,
Larry

Yakov

unread,
Dec 28, 2011, 5:58:13 PM12/28/11
to TiddlyWiki
Hello Larry,

there are some ways, but it depends on a tiddler..

* if a tiddler contains JavaScript code, usual /* multiline comments
*/ and // singleline comments can be used
* CSS tiddlers can contain usual (for CSS) /* multiline comments */
* html tiddlers (like PageTemplate) can contains <!-- html comments --
>
* tiddlers with content can have /% comments of content %/ which are
not displayed in the view mode of tiddler

also,

* there are special "invisible" comment markup for JavaScript
tiddlers: one can write

/***
some comments with markup, like
* tables
* lists
* etc
***/
//{{{
here goes some code
//}}}

and in such a tiddler there will be represented wikified part

some comments with markup, like
* tables
* lists
* etc

and then -- the code in the "pre" element (by default - with monospace
font and kept indents and spaces).

Regards, Yakov.

pinkp8ther

unread,
Dec 28, 2011, 7:58:46 PM12/28/11
to TiddlyWiki
Thanks for the reply.

The problem with /% comments of content %/ is, that if it is the only
thing on the line it seems to leave a blank line in the text in view
mode. This is not a desirable effect. I was hoping for something
more.

Larry

Yakov

unread,
Dec 29, 2011, 2:41:54 AM12/29/11
to TiddlyWiki
I see. For this case, you can use some styling. There are three kinds:

* "common formatting": bold (''text'', in doubled single quotes),
italics (//text//), highlightning (@@text@@) or underlined (__text__)
* inline styling: @@CSS rules go here;text@@, like @@color:grey;font-
size:smaller;a tiny note@@
* class-styling: {{comment{text}}} with some rules for "comment" class
put in StyleSheet tiddler (do you know how to use it?)

I would recomend the third approach since with it you have separated
styles and markup, so you can change styling of comments whenever you
want and in every place you used it at once.

colmjude

unread,
Dec 29, 2011, 5:26:01 AM12/29/11
to TiddlyWiki


On Dec 29, 12:58 am, pinkp8ther <pinkp8t...@gmail.com> wrote:
> Thanks for the reply.
>
> The problem with /% comments of content %/ is, that if it is the only
> thing on the line it seems to leave a blank line in the text in view
> mode.  This is not a desirable effect.  I was hoping for something
> more.

You are right that doesn't sound like the correct behaviour of
invisible comments. You wouldn't expect it to alter the visual display
in anyway. I would have thought that this is not the intended
behaviour and could be a bug, in which case it might be worth adding
it to the issues list on github[1].

- C

[1] - https://github.com/TiddlyWiki/tiddlywiki/issues

PMario

unread,
Dec 29, 2011, 7:16:19 AM12/29/11
to TiddlyWiki
Try this

line 1/%
some comment
as many lines you want
%/
line 2

======= technical stuff follows =====
@colm
I don't think, it is a bug, If you write:

line 1
/% comment %/
line 2


for the parser it looks like

line 1\n
/% comment %/\n
line 2\n

where \n is a new line command. If you remove the comment /% .. %/ it
is

line 1\n
\n
line 2\n

Changing this behaviour, IMO is a compatibility issue.
eg:

some visible/% comment comes here
comment text ends here %/ text

rendered

some visibel text

is perfectly fine

-m


-m

pinkp8ther

unread,
Dec 29, 2011, 1:22:20 PM12/29/11
to TiddlyWiki
This methoid works for what I'm looking for.

> line 1/%
> some comment
> as many lines you want
> %/
> line 2

Sorry I should have thought of that myself, but I'm still learning TW
and I guess I just didn't see the forest for the trees.

PMario

unread,
Dec 30, 2011, 2:17:38 AM12/30/11
to TiddlyWiki
On Dec 29, 7:22 pm, pinkp8ther <pinkp8t...@gmail.com> wrote:
> This methoid works for what I'm looking for.
>
> > line 1/%
> > some comment
> > as many lines you want
> > %/
> > line 2
>
> Sorry I should have thought of that myself, but I'm still learning TW
> and I guess I just didn't see the forest for the trees.
That's TiddlyWiki :)

There may be some interesting possibilities, to "unlock" the hidden
comments, without editing.

eg: tiddler named TestCommentSlider

!!!Click the button to see the comment section
<<slider chkTstSliderViewComment
"TestCommentSlider##Comment"
"View comment »"
"Display the comment">>

/%
!Comment

Your comment text comes here!
/% %/

pinkp8ther

unread,
Jan 11, 2012, 7:30:11 PM1/11/12
to TiddlyWiki
I not really looking to toggle the hidden text on and off. My intent
is to insert instructions into the tiddler so other editors will know:
* What is going on in a section
* How to modify or add to a section
* What sections need to be left alone unless you understand the big
picture of how the TW is working

Thanks for all the advice,
Larry

On Dec 30 2011, 2:17 am, PMario <pmari...@gmail.com> wrote:
> On Dec 29, 7:22 pm,pinkp8ther<pinkp8t...@gmail.com> wrote:> This methoid works for what I'm looking for.
Reply all
Reply to author
Forward
0 new messages