On Wednesday, October 2, 2013 12:03:15 AM UTC-7, Branimir Braykov wrote:

> !Title
> {{{
> Some code
> }}}
> !Another title
>
>
> Now notice the vertical space between "Some code" and "Another title" in 
> both tiddlers.
>
 
The above syntax generates this HTML:
----------------
<div class="viewer"><h1>Title</h1><pre>Some code
</pre><h1>Another title</h1></div>
----------------
Note that the HTML does *not* contain an extra blank line... the spacing 
between the end of the 'pre' block and the 'h1' element that follows is due 
to the TWCore default CSS for H1, H2, and H3 headings, which includes 
"margin-top: 1.2em".  You could adjust this by adding
    H1, H2, H3 { margin-top: 0em; }
to the StyleSheet tiddler, but that would affect all headings, everywhere 
in your document.
  

> SubTiddler
>
> {{{
> Some code
> }}}
>
>
> NewTiddler
>
> !Title
> <<tiddler SubTiddler>>
> !Another title
>
>
The above syntax generates this HTML:
-----------------------------
<div class="viewer"><h1>Title</h1><span refresh="content" 
tiddler="SubTiddler"><pre>some code
</pre></span><br><h1>Another title</h1></div>
----------------------------- 

In this case, there are a few extra bits of HTML not found in the first 
example:
* the transcluded content is wrapped in a span indicating the tiddler of 
origin, allowing the TWCore to perform automatic refresh handling when the 
underlying tiddler content is modified.  This does not affect the rendered 
layout.
* a <br> DOES follow the transcluded span.... however.... that <br> is not 
due to the transclusion itself, but rather it is the *literal* newline that 
is embedded in the tiddler content following the <<tiddler>> macro.  To 
observe this more clearly, if you omit *only* the "<<tiddler ...>>" syntax, 
you can see that there is still a newline in between the two heading 
elements.  Thus, you get unwanted white-space before the second heading.

Unfortunately, because TW headings MUST start on a separate line there's no 
way to omit the literal newline following the macro.

Fortunately, there is a solution that MIGHT work (depending upon how 
"modern" your browser is): you can use the CSS "next element" selector 
syntax to define a rule that adjusts the margin-top whitespace for 
headings, but *only* if it follows a <br>, by adding something like this to 
your StyleSheet:
   br+H1, br+H2, br+H3 { margin-top: -0.5em; }
(note: adjust the -0.5em value to suit your tastes... this may depend upon 
the fonts you are using).
While the <br> still *exists* in the rendered content, the whitespace from 
the heading that follows it will overlap with it, so that it doesn't affect 
the overall appearance.  One drawback: this method will 'eat' the trailing 
newline in any section that has another heading following it, not just ones 
containing a <<tiddler>> macro transclusion.

There *is* another workaround: you can use native HTML syntax to bypass the 
need for a newline following the <<tiddler> macro in this one specific 
instance, without affecting anything else in your document:
-----------------------
!Title
<<tiddler SubTiddler>><html><h1>Another title<h1></html>
-----------------------

Hope this helps,

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
   http://www.TiddlyTools.com/#Donations

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
   http://www.TiddlyTools.com/#Contact

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to