Advice for new TW5 user regarding line breaks

171 views
Skip to first unread message

BhKh

unread,
Sep 4, 2020, 11:13:44 PM9/4/20
to TiddlyWiki
Hello! After about 7 years I am considering getting back into using TiddlyWiki again. When Iast I used, it was 2.4.4.

Now I am starting a new TW5 and I am a bit perplexed as to how to deal with line breaks.

I'm planning on using my wiki to collect notes clipped from other places, write my own notes, and copy my notes out of TW into other things. I thought that this was the primary function of TW, so this issue has me scratching my head.

In 2.4.3, you could simply put a line break in the editor and you got a line break (new line) in the rendered tiddler.

In TW5 this seems to no longer be the case. If I have ten lines of text that I copy from one location into a my TW, it all gets put onto a single line. Obviously not good. I can understand formatting like bold, italics, and headings not surviving a copy paste. But line breaks?

So I have implemented the solution here: https://tiddlywiki.com/#Hard%20Linebreaks%20with%20CSS
As I understand this solution, I'm just tagging all tiddlers that I want to show the same breaks in the editor as in the final doc with a certain class.

Now when I paste in ten lines of text into a tiddler I get ten lines in the rendered version. Great!! However, when I copy those ten lines from my tiddly wiki back into another document, they are all on a single line.

As well, the breaks are not shown in the preview window. There it is just all one big line.

So my questions are: Am I doing something wrong? Is there a different way I'm supposed to be doing things?

It seems like if TW is supposed to be for keeping notes on things, this is odd behaviour. I thought I should be able to paste things in and cut things out and have them at least keep line breaks. However it seems like TW is now designed to be more a code editor and less a document editor. I realize that the line is necessarily blurry in TW, but in the end the purpose of a TW is not to write code.

All the threads on this topic seem to be long and complicated and hard to piece together a solution. I realize this may be difficult since different people may need different solutions.

I thought I could start all tiddlers with """. However it seems that this needs to be done on a paragraph by paragraph basis. If I try to make a heading by typing
! title
it gets rendered literally. So that solution seems to fall into the "reformat my text every time category."

So keeping in mind that I plan to use my TW for collecting text, writing text, and re-using text, what is my best solution? I really don't want to have to re-format everything I paste into a tiddler. Also keep in mind that I am starting fresh, so that may give more options.

I'd even be fin with a solution that involved copy and pasting through some sort of intermediary system if it was a simple as pasting it in and copying it out.

Thanks! I appreciate everyone's contributions over the years I have been away!

TW Tones

unread,
Sep 5, 2020, 12:28:27 AM9/5/20
to TiddlyWiki
BhKh,

This is a common issue for new users, and as annoying as it is there are good reasons for it. However it has long being a "bug bear" of myself and many others.

The good news is;
  • You tend to get used to it
  • Quite a few existing solutions can help (many exist so I am not sure where to start for you)
  • Some of us are currently working on a solution which introduces a much more powerful set of choices that will all but eliminate the issue.
  • A lot of copy and pastes work out of the box with tiddlywiki already so this is not a problem in many cases
  • If you wish you can copy as html and paste html into a tiddler and reasonable well rendered.
  • You can also past anything into one "data tiddler" and create another tiddler that extracts content from the data tiddler, according to your desired rules and presents it correctly. Eg each line as a paragraph.
    • This is a powerful solution because you could past updated content in the data tiddler and the same "re-parse" rules will be applied.
    • This allows one effort to parse the input that can be reused again on other data with a click.
    • Note: This is a design possibility I have noted as an advanced solution one-day
Some even find it difficult to enter two new lines to separate each line and paragraph and stop this concatenation occurring when rendered.
  • As you seem to have noticed if you use a Heading !! , bullet # and * or ; and ; you discover that the end of line does wrap and not concatenate.
  • What you may not know each of these can be followed with one or more css classnames to format that same line eg "*.classname1.classname2 Test here" so you could use a class name of .green and .r to make the line green and also indented from the right. 
  • Obviously the above wikitext markup are designed for lists and do not have a blank line between each (when displayed)
Our recent work is to introduce a special character you can pace as the first character of any other line to turn each line into a html div or p paragraph.
  • All you need to do then in your imported text to to select all lines and prefix them with this special character using an editor toolbar button and they should render as expected.
  • In addition it allows the above .classname trick to be applied to any line
By turning every line into a paragraph the text will not only not concatenate, but you are guaranteed to have a blank line between each (paragraph) and if you have surplus line feeds, these will collapse into one only blank line.
  • This help full when importing text.
Thus with this new solution on the cards whether you are typing it in yourself, or reformatting pasted content you can manipulate a whole line/paragraph with a few characters at the front of a line, as you already can with bullets etc... and if you wish apply it to multiple lines at once.

Regards
Tony

BhKh

unread,
Sep 5, 2020, 1:07:30 AM9/5/20
to TiddlyWiki
Dear Tony,

I have noticed your involvement in several related threads and I appreciate the work you and others are doing on this.

> Quite a few existing solutions can help (many exist so I am not sure where to start for you)

I wonder if you could just try to pick one? :-) Lets say I'm going to paste twenty lines of text into a tiddler from a word document. Each line is (as is standard) on it's own line. How can I make them appear on their own lines
  1. in the editor
  2. in the preview
  3. in the final tiddler
  4. and when I copy from the tiddler into another document
without
  • having to put double enters at the end of every line
  • code the whole thing in html
  • have other markup be broken
Is that possible?

Right now using the custom class for text tiddlers seems to meet this except for #2 and #4.

I really wanted to get back into using TiddlyWiki, but this issue seems almost absurd. I could appreciate this if we were talking about making a website (which I guess in the the end is what TW is, which may be the issue). But even then, in WordPress I am easily able to copy and paste text both in and out of a web page without thinking twice.

I found this post and am wondering if it provides a solution. I tried to implement it, but I just don't know enough yet about how TW works to get it working.

Alternatively, I wonder if I should be using the wysiwyg editor here: http://bjtools.tiddlyspot.com/#VisualEditor. I've tried getting that setup but have so far been unsuccessful.

Am I to assume correctly that I don't want to be tagging tiddlers as text/x-tiddlywiki? This seems to fix it, but there must be some problem with it since a big warning box is displayed.

Any help you can give is most appreciated.

TW Tones

unread,
Sep 5, 2020, 2:18:55 AM9/5/20
to TiddlyWiki
BhKh

I have noticed your involvement in several related threads and I appreciate the work you and others are doing on this.

Thanks
 

> Quite a few existing solutions can help (many exist so I am not sure where to start for you)

I wonder if you could just try to pick one? :-) Lets say I'm going to paste twenty lines of text into a tiddler from a word document. Each line is (as is standard) on it's own line. How can I make them appear on their own lines
  1. in the editor
  2. in the preview
  3. in the final tiddler
  4. and when I copy from the tiddler into another document
without
  • having to put double enters at the end of every line
  • code the whole thing in html
  • have other markup be broken
Is that possible?

Sure.  Can you point to an example slab of text I can use to test this on an internet location, that would help.

 I really wanted to get back into using TiddlyWiki, but this issue seems almost absurd. 

I understand but there are good reasons, for example in simple text you cant add macros and widgets that build content from dynamic lockups etc... It is the rich features of tiddlywiki that creates this anomaly. So remember as I suggested we have a new solution. In the mean time I will give you one or more of the existing solutions, and others may too.


I found this post and am wondering if it provides a solution. I tried to implement it, but I just don't know enough yet about how TW works to get it working.

That's somewhat related to a solution I am thinking of.
 

Alternatively, I wonder if I should be using the wysiwyg editor here: http://bjtools.tiddlyspot.com/#VisualEditor. I've tried getting that setup but have so far been unsuccessful.


This visual editor saves HTML in your tiddlers, which is fine, but I suspect that is not what you are after.
 
Am I to assume correctly that I don't want to be tagging tiddlers as text/x-tiddlywiki? This seems to fix it, but there must be some problem with it since a big warning box is displayed.

What is the warning?
 

Any help you can give is most appreciated.

No problems, 

Tones.

Birthe C

unread,
Sep 5, 2020, 3:06:56 AM9/5/20
to TiddlyWiki
TW Tones,

text/x-tiddlywiki is tiddlywiki classic format.

The warning is: This tiddler is written in TiddlyWiki Classic wiki text format, which is not fully compatible with TiddlyWiki version 5. See https://tiddlywiki.com/static/Upgrading.html for more details.

Birthe

TW Tones

unread,
Sep 5, 2020, 3:50:27 AM9/5/20
to TiddlyWiki
Hi,

Try wrapping all your pasted text in html pre tag

<pre>pasted text here
new lines honoured
</pre>
In tiddlywiki this gives it a grey background and does not render wiki text

Same if you wrap it all in div with the pre white space
<div style="white-space: pre;">
pasted text here
new lines honoured
*List
* list
</div>

Do you want to edit it and add Wikitext?

Also rather than content type = text/x-tiddlywiki have you tried content type = text/plain



Tones




On Saturday, 5 September 2020 13:13:44 UTC+10, BhKh wrote:

JWHoneycutt

unread,
Sep 7, 2020, 3:31:01 PM9/7/20
to TiddlyWiki
@BhKh
I had the same problem. Here is my solution - not perfect, so suggested improvements welcomed:

I have a tiddler with the tag: $:/tags/Stylesheet, and contents:

[data-tags*="Linebreaks"] .tc-tiddler-body {
  word-break: normal;
  word-wrap: break-word;
  white-space: pre-wrap;
}


When I need to preserve linebreaks, I tag a tiddler with the tag: Linebreaks

JWHoneycutt

BhKh

unread,
Sep 8, 2020, 6:33:21 AM9/8/20
to TiddlyWiki
I had the same problem. Here is my solution - not perfect, so suggested improvements welcomed:
...
When I need to preserve linebreaks, I tag a tiddler with the tag: Linebreaks
JWHoneycutt

Are you able to get the preview looking correct? I guess since the css isn't applied to the preview window that solution will never work for that? Just checking.

Hubert

unread,
Sep 8, 2020, 8:05:27 AM9/8/20
to TiddlyWiki
Hi BhKh,

Welcome back to the world of TiddlyWiki! :)

> I wonder if you could just try to pick one? :-) Lets say I'm going to paste twenty lines of text into a tiddler from a word document. Each line is (as is standard) on it's own line. How can I make them appear on their own lines

A simple and quick way that I use when I need to paste something from anywhere else and preserve the original line breaks is wrap my content in three double quotes, like here:

"""
This is my content. This is the first line.
This is the second line.

This is the fourth line (note the third line is blank)
"""

When you save your tiddler you will see that the rendered tiddler looks exactly like your input (the draft), except the quotes.

As Tony said, there are many ways to implement this, many of which may be programmatic etc. By contrast, the above way is just a quick and simple solution that you can use right away.

Hope this helps.

Enjoy!
Hubert
Reply all
Reply to author
Forward
0 new messages