Hard Linebreaks not appearing with some text formatting

146 views
Skip to first unread message

AndrewMc

unread,
Nov 25, 2017, 9:32:46 PM11/25/17
to TiddlyWiki
Hi All

I need to have hard linebreaks appear in some of my text (a quoted part a poem).
I followed the instructions at https://tiddlywiki.com/#Hard%20Linebreaks%20in%20WikiText and successfully had the line breaks appear.
However, as soon as I added italics or bold formatting to the entire block of text, the line breaks disappeared.

The following wikitext works:
"""
This is a line
and this is a new line
while this is yet another line
"""


This is a line
and this is a new line
while this is yet another line

-------------

However, adding italics or bold to the inside of the whole block removes the line breaks:
"""
//This is a line
and this is a new line
while this is yet another line//
"""

"""
''This is a line
and this is a new line
while this is yet another line''
"""


This is a line and this is a new line while this is yet another line


This is a line and this is a new line while this is yet another line


Note that the italics (or bold) formatting doesn't have to surround the whole block of text for the line breaks to be affected. If the formatted text encompasses a line break, then that line break will not appear.
-------------

If I put the formatting outside the hard line break block, then both the formatting and the line breaks appear:

//"""
This is a line
and this is a new line
while this is yet another line
"""//


This is a line
and this is a new line
while this is yet another line


Is this expected behaviour, or have I discovered a small bug in the wikitext processing?

Cheers
Andrew Mc

TonyM

unread,
Nov 26, 2017, 5:38:35 AM11/26/17
to TiddlyWiki
Yes, it takes time getting used to the need for line breaks, without solving your exact request consider addin semicolon or colon as the fist character of you poems line or forcing a break with htmls <br>.

on that note actualy tw5 honors almost all html formats learning them give you more power and teaches you html.

see https://www.w3schools.com/html/html_formatting.asp

if no one answers I will post on tw5 subtlties.

TonyM

unread,
Nov 28, 2017, 8:12:24 PM11/28/17
to TiddlyWiki
As Suggested, I did the Homework for you.

Try this - wrap in a <pre> tag, not tiddler links still work

 <pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and [[HTML use in Tiddlers]]
line breaks
</pre> 

Regards
Tony

AndrewMc

unread,
Dec 2, 2017, 3:50:08 PM12/2/17
to TiddlyWiki
Thanks Tony

The use of <pre> </pre> tags does indeed give the desired line layout. It also allows the use of wikitext formatting such as ''bold'' and //italics//. However, it does also give a fixed-spacing font which may not be desired.

Cheers
Andrew Mc

RichardWilliamSmith

unread,
Dec 2, 2017, 4:21:58 PM12/2/17
to TiddlyWiki
Hi,

When you block format a paragraph, it gets split into separate lines so you need to style them separately:

"""
//This is a line//
''and this is a new line''
//while this is yet another line//
"""

The issue is with how HTML itself treats block and inline elements, I think.

Regards,
Richard

TonyM

unread,
Dec 2, 2017, 7:28:26 PM12/2/17
to TiddlyWiki
Andrew,

TiddlyWiki is fantastic as responding to most of html, a Quick check of the CSS rules shows you can add styles or classes to most HTML elements, including Pre



<pre style="font-family: Times New Roman, Times, serif;" >
Some text 
</pre>

<pre style="font-family: Impact, Charcoal, sans-serif;" >
Some text 
</pre>

or

<pre class="classinstyleshhet" >
Some text 
</pre>

Regards
Tony

AndrewMc

unread,
Dec 3, 2017, 3:19:16 AM12/3/17
to TiddlyWiki
Hi Tony

I was not aware of this. Thanks for pointing it out - I can see a whole range of possibilities.

Cheers
Andrew Mc

AndrewMc

unread,
Dec 3, 2017, 3:22:46 AM12/3/17
to TiddlyWiki
Hi Richard

This is useful to know. Perhaps the information about this can be amended to add a note about the care needed in applying such formatting (and perhaps even adding use of the <pre> </pre> tags as an alternative).
https://tiddlywiki.com/#Hard%20Linebreaks%20in%20WikiText

Cheers
Andrew Mc
Reply all
Reply to author
Forward
0 new messages