How important is blank line in TW? and Where we should use it?

130 views
Skip to first unread message

Mohammad

unread,
Sep 5, 2018, 10:17:53 AM9/5/18
to tiddl...@googlegroups.com
How important is blank line in TW? and Where we should use it?
Look at 

In the first case why tiddlywiki.com recommend extra blank lines as below:


<div class="tc-table-of-contents">

<
<toc-selective-expandable 'TableOfContents'>>

</div>

Why it does not use the below code

<div class="tc-table-of-contents">
<
<toc-selective-expandable 'TableOfContents'>>
</div>


There are many other cases in tiddlywiki.com

Mohammad

SpennyMcRinghoj

unread,
Sep 6, 2018, 8:10:05 AM9/6/18
to TiddlyWiki
Hi,

I think there might be spacing just to make things clearer to a new user. I don't think in the example you show, there would be any difference in the functionality.

SpennyMcRinghoj

unread,
Sep 6, 2018, 8:27:43 AM9/6/18
to TiddlyWiki
Hi again, I've just thought of a place where a newline does matter.

I've added a button on the editor for "Indent" - it will make the selected lines indented. Note that the prefix and suffix entries have a new line there. This means that the selected lines have the indent <div> inserted in the line above and the </div> on the line below. See code snippit at end of message.

I think newlines matter when you're passing arguments to functions - but don't matter in they are between functions, as the example you provided shows.

<$action-sendmessage
    $message="tm-edit-text-operation"
    $param="wrap-selection"
    prefix="
<div style='padding-left: 40px;'>
"
    suffix="
<div>"
/>


Mohammad

unread,
Sep 6, 2018, 10:32:22 AM9/6/18
to TiddlyWiki
Spenny!
 The example I have provided shows different results based an having the blank line or not!

SpennyMcRinghoj

unread,
Sep 6, 2018, 10:50:20 AM9/6/18
to TiddlyWiki
Hey - I can't recreate the difference in behaviour in the first example you provided. With or without the newlines - I still see the same stuff back - is it different for you?

The second example is in a macro - I think that's a similar situation to the example I gave - that is to say, the newline makes a difference.

PMario

unread,
Sep 6, 2018, 1:11:42 PM9/6/18
to TiddlyWiki
Hi,

 - create a new tiddler
 - copy your example into the tiddler
 - open the "preview" panel
 - open the "choose preview type" dropdown (last button in the edit toolbar)
   - choose: parsetree
   - choose: raw html  ... for smaller examples

now change the linebreaks and you'll see, how the elements created change.

You can also use this mechanism for your earlier post mentioned above. 

have fun!
mario

Mat

unread,
Sep 6, 2018, 4:41:41 PM9/6/18
to TiddlyWiki
Hey Mohammad,

as noted in HTML in WikiText

Block mode versus Inline mode
To get the content of an HTML element to be parsed in block mode, the opening tag must be followed by two linebreaks.
Without the two linebreaks, the tag content will be parsed in inline mode which means that block mode formatting such as wikitext tables, lists and headings is not recognised.

<:-) 

Mohammad

unread,
Sep 7, 2018, 12:09:06 AM9/7/18
to TiddlyWiki
Hello Mario,
 Thank you very much! I learned how can I debug and troubleshoot using raw html in preview panel.

Best
Mohammad

Mohammad

unread,
Sep 7, 2018, 12:10:51 AM9/7/18
to TiddlyWiki
Hi Mat!

Thank you for the info. This will help to create macros and complex wiki text correctly!

Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages