Preserving paragraphs when pasting into TW

255 views
Skip to first unread message

Anne-Laure Le Cunff

unread,
May 9, 2020, 8:26:44 PM5/9/20
to TiddlyWiki
Hey everyone!

I often have to paste long content from other sources (Google Doc, Roam, email) into TW and it just lumps everything together. No more paragraphs, formatting or anything, just a massive blob of text.

Is there a way to fix this?

Thank you!
Anne-Laure.

TonyM

unread,
May 9, 2020, 9:35:15 PM5/9/20
to TiddlyWiki
Anne-Laure.

This becomes an issue for all tiddlywiki users eventually for many when typing, or in your case importing text. I believe it is a product of the way wikitext need to cohabit with widgets and other code. I and mario were recently looking at "dot paragraphs" where placing a period at the beginning of a line would turn it into a paragraph   `<p>` when rendered. I was about to revisit where we were on this. With a line based Editor toolbar button to add a period at the beginning of every line in highlighted text, This method can be used to rapidly transform imported text, that comes in the forms of lines rather than paragraphs when pasted. It has the advantage of also collapsing extra blank lines.

I believe there may be options in the tools one uses to copy and paste that will use double line breaks when pasting a paragraph.

Depending on your final use of the text you capture from elsewhere and whether you intend to edit it. you can get a browser tool to copy as html from the source, and paste this html it tiddlywiki thus retaining much of its original structure.

We could also make an editor toolbar button that wraps every (all or selected) lines in `<p>` but these will remain in the text in edit mode.

Try these things and let us know if you want to explore this in more detail.

Regards
tony

Anne-Laure Le Cunff

unread,
May 9, 2020, 9:39:38 PM5/9/20
to TiddlyWiki
Thanks so much Tony, I didn't think of using a tool that would preserve the HTML formatting. I'll give that a try. I honestly can't write long-form content in TiddlyWiki. For short notes, it's fine. But when I write long notes (thousands of words), the writing experience is not comfortable. So I write in Roam or Google Docs, but when I paste these into TiddlyWiki the formatting is all gone and it's quite tedious to add the paragraphs back.

Mark S.

unread,
May 9, 2020, 9:42:25 PM5/9/20
to TiddlyWiki

I'm sure someone will come along with a better solution. This will replace single line feeds with <p/> paragraph breaks. Unfortunately, this means your original text will actually be physically more mangled than it started -- I have no way to generate a literal carriage return. Be sure to make backups if you try this.

Name of tiddler: <$edit-text tiddler="$:/temp/convertme" size="20" tag="input" placeholder="Tiddler to convert" default="Sample"/>

<$vars br="<br/>" par="<p/>" title={{$:/temp/convertme}} >
<$button>Add line feeds
<$list filter="[<title>get[text]splitregexp[\n]join<par>]">
<$action-setfield $tiddler=<<title>> $field="text" $value=<<currentTiddler>>/>
</
$list>
</$button>

</
$vars>



Anne-Laure Le Cunff

unread,
May 9, 2020, 9:54:05 PM5/9/20
to TiddlyWiki
Thank you, Mark!

I'm curious - do people actually write straight into TW for long texts? How come this hasn't been much of an issue for everyone else? Or is it just that most people take quick notes / bullet points and never feel the need to write or paste very long articles?

Julio Peña

unread,
May 9, 2020, 10:29:10 PM5/9/20
to TiddlyWiki
Hello Anne-Laure and all,

I hope I am understanding the question correctly, so forgive the intrusion.
This may not be an ideal solution, however, what I do is:

1. go to the page
2. right-click on page and click on "View Page Source"
3. Go look for my text in question
4. highlight tags and all and then copy/paste to my tiddlywiki

Its not pretty but it works fore me.

Blessings,
Julio

TonyM

unread,
May 9, 2020, 10:34:51 PM5/9/20
to TiddlyWiki
Anne-Laure,

Since I do not YET follow you, what kind of content are you authorig,?, it can make quite a difference how to make use of TiddlyWiki.
What is bothering you when writing longer form content?

I have a view on how authors should write with a view to long term viability, I can share if appropriate, although I am no expert.


On Sunday, May 10, 2020 at 11:54:05 AM UTC+10, Anne-Laure Le Cunff wrote:

I'm curious - do people actually write straight into TW for long texts? How come this hasn't been much of an issue for everyone else? Or is it just that most people take quick notes / bullet points and never feel the need to write or paste very long articles?


Given I build logic and relationships or features and functions into my tiddlywiki, that is I abstract, and extract concepts and relationships as I go, I often have shorter tiddlywiki content and I am fine with the wiki text editor, although I want the aforementioned dot-paragraph.

You may find pasting found content as HTML and then copy out snipits and paste into your authored tiddlers as needed, in effect capture your references and related content, and cherry pick it as needed (Copy paste/markup}, consciously using your choice of markup in your content rather than adopting that of the original source.

I have taken recently on my Desktop tiddlywiki with a wide screen to using the editors preview to show the Output at the same time as a I type wiki text, even to the point of adding blank lines to the wiki text to line it up with the rendered content on the right. You can use <!-- comments --> to write author notes not visible in the content, and these are searchable.

Another trick on a multi-screen computer is to open a tiddler in a new window, then edit it in the main window, then save and keep editing the rendered result is available in the new window. This is also a good trick when editing a compound tiddler, one that links to many others, because when you click a link of a compound tiddler in a new window, that tiddler opens in the main wiki window, I think of this as a remote control.

When doing training and taking notes in class, I do like to type long tiddlers and to regularly save and reopen becomes annoying, so I have save and continue editing button, or even edit a different tiddler with the edit-text widget so every keystroke is saved, and I depend on undo and redo for typos.

The Visual Editor which writes html tiddlers WYSIWYG (That can include widgets) based on ckeditor (has local computer dependance) may suit some short article writers, but someone writing a book may stick with wikitext because of its brevity and worry about overall appearance towards the end of the writing process.

There are full screen editor modes, but I would like to see a full screen edit and Preview mode, or perhaps try with David Gifford's new edition?

Buttons for the Edit Toolbar

  • Save & Close (Done & Close)
  • Cancel & Close (Discard & Close)
  • Save & Keep Open (Done & Reopen)
source https://tid.li/tw5/plugins.html
tags
title $:/plugins/telmiger/EditButtons

Visual Editor 
source

https://github.com/buggyj/TW5-tools
title $:/plugins/bj/visualeditor
 

Regards
Tony

TonyM

unread,
May 9, 2020, 10:42:47 PM5/9/20
to TiddlyWiki
Julio,

Keep in mind what appears on the screen is not always visible in the source. The best example is if you do this with tiddlywiki, t will not be "true". I recommend a Copy as html addon in the browser to address this.

What you say may be 100% correct on static sites.

Regards
Tony

Birthe C

unread,
May 9, 2020, 10:57:44 PM5/9/20
to TiddlyWiki
TonyM,

I could have kicked myself never having thought of that solution. You wrote it just at the right time for me, trying to get some rather nasty tables into my TW. All worked well and I am so pleased.

Birthe

søndag den 10. maj 2020 kl. 03.35.15 UTC+2 skrev TonyM:
Depending on your final use of the text you capture from elsewhere and whether you intend to edit it. you can get a browser tool to copy as html from the source, and paste this html it tiddlywiki thus retaining much of its original structure.

Regards
tony

Julio Peña

unread,
May 9, 2020, 11:09:17 PM5/9/20
to TiddlyWiki
Hello,Tony, much appreciated for the clarification! :)

Regards,
Julio

David Gifford

unread,
May 9, 2020, 11:31:35 PM5/9/20
to TiddlyWiki
Anne-Laure

In TiddlyWiki there has been a tendency to write paragraphs as short tiddlers and transclude them into longer 'article' tiddlers. That is not really my thing, and I share your frustration. I prefer to write in Dynalist, and use TiddlyWiki for publishing or for playing with data to build mini databases such as this unfinished project of mine: https://giffmex.org/gospels.bubbles.html#Gospels%20Bubbles

Mark S.

unread,
May 9, 2020, 11:34:41 PM5/9/20
to TiddlyWiki
I have various clippers in my browser. One of them for instance copies markdown. The markdown text is a lot cleaner to edit than HTML.

My impression is that not many people actually use TW as an editing platform.

I'm thinking that editing in TW would be OK if it worked more like dynalist. Here's how I think it would work, and should be possible in TW:

You'd start in your chapter/article tiddler. There would be an existing line to start (don't ask how that got there). You could click on it similar to the way that you can click paragraphs in the Slicer edition. When you do you will immediately be in edit mode without opening a tiddler. You can make changes and add more text. When you close the editor any paragraphs inside the editor would turn into tiddlers and be added to your working article. You could then click on any paragraph to edit it, adding more text and paragraphs that would also be broken into more tiddlers. In this way the working text would always be a comfortable size while the surrounding text would be in it's rendered form.

I'm kind of surprised no one has made something like this.

Birthe C

unread,
May 9, 2020, 11:59:32 PM5/9/20
to TiddlyWiki

Birthe

Sylvain Naudin

unread,
May 10, 2020, 4:17:43 AM5/10/20
to TiddlyWiki


Le dimanche 10 mai 2020 03:54:05 UTC+2, Anne-Laure Le Cunff a écrit :

I'm curious - do people actually write straight into TW for long texts? How come this hasn't been much of an issue for everyone else? Or is it just that most people take quick notes / bullet points and never feel the need to write or paste very long articles?



On rather long contents, this becomes indeed not always obvious. I like to have the preview, and at some point there's obviously a gap that disturbs.

As said before, the non-linear micro-content logic in TiddlyWiki takes precedence. So we transclude when it becomes necessary.

I really like writing in TW, since the syntax is very familiar to me now.
For a long time we didn't have a formatting wikibar. There have already been requests for it to be able to follow the scroll, I add I'd like to see this feature coming one day. And if I'm dreaming, a rendering of the dynamic preview based on the WikiText displayed :D

Regards the formatting issue, it's rather a feature in my case, it avoids importing too much useless code.
Even if I admit it's useful in other tools to get the boldface for example.

But it's the opposite for me in general. I write my reports in TW, and I copy and paste the result in an email to send it.

Sylvain

Peter Buyze

unread,
May 10, 2020, 4:23:46 AM5/10/20
to TiddlyWiki forum
Sylvain, that makes a lot of sense, I have the same view on it. Also, the point you make about the micro-content, atomicity, the smallest semantic unit, is an important thing.

It seems to me that David Gifford developed his Idea Stew for longer texts.

--
Securely sent with Tutanota. Get your own encrypted, ad-free mailbox:


10 May 2020, 11:17 by sil...@gmail.com:
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

TonyM

unread,
May 10, 2020, 4:42:31 AM5/10/20
to TiddlyWiki
Mark

This is an interesting idea. Kind of a structured master tiddler so you can manage a paragraph at a time.

It would be worth the experiment.

Regards
Tony

Birthe C

unread,
May 10, 2020, 4:48:28 AM5/10/20
to TiddlyWiki
Not long ago Mat asked us to read his http://bigpic.tiddlyspot.com/ At the same time we could see and try out the way he used his fantastic  SideEditor . That is if someone did not know of it or used it already.
An older plugin I have used since I first saw it in twaddle . At that time because it is tremendous helpful when writing stylesheets.

Birthe

Birthe C

unread,
May 10, 2020, 7:28:51 AM5/10/20
to TiddlyWiki
 I use j.d. paragraph macro like this http://demo-writer.tiddlyspot.com/


Birthe

FrD

unread,
May 10, 2020, 7:38:12 AM5/10/20
to TiddlyWiki

David Gifford

unread,
May 10, 2020, 8:52:35 AM5/10/20
to TiddlyWiki
Anne-Laure,

Here is a strange but simple hack that just occurred to me: I cloned the bulleted list button to add <br><br> before each line. So you paste from Roam, Workflowy, etc, select all text, and push the button.


You will probably want to change the icon.

Anne-Laure Le Cunff

unread,
May 10, 2020, 10:01:45 AM5/10/20
to TiddlyWiki
Wow, thank you so much everyone for all the help. While I understand the philosophy behind TiddlyWiki, with each tiddler being the smallest unit of information, I often write longer essays and it wouldn't feel natural to break them into separate tiddlers, so it's great to see there are workarounds.

@Tony: Thanks for these! The problem with copying and pasting HTML is that I write my essays in Roam Research, and the HTML is a hot mess. I also very often write in Google Docs and it would be annoying to have to publish each essay as an HTML page to then copy the source code and paste it into TiddlyWiki.

@FrD: Thank you! If I understand correctly, I'd have to tag each new tiddler with the corresponding data-tag to make sure these custom styles are applied?

@David: this is super smart! I wonder if there's a way to hack it so it wraps paragraphs in <p>*</p> instead so the output is more semantically correct? In the mean time that's a great hack.

Mohammad

unread,
May 10, 2020, 10:17:23 AM5/10/20
to TiddlyWiki
Hi Anne-Laure


On Sunday, May 10, 2020 at 6:31:45 PM UTC+4:30, Anne-Laure Le Cunff wrote:
Wow, thank you so much everyone for all the help. While I understand the philosophy behind TiddlyWiki, with each tiddler being the smallest unit of information, I often write longer essays and it wouldn't feel natural to break them into separate tiddlers, so it's great to see there are workarounds.

If you write long text in one tiddler, you may be interested to see how ebooks are distributed using Tiddlywiki!
and see example ebook provided by Xavier Cazin

--Mohammad

Anne-Laure Le Cunff

unread,
May 10, 2020, 11:14:29 AM5/10/20
to TiddlyWiki
This is really cool, thanks Mohammad! Love that implementation and always in awe of TiddlyWiki's flexibility.

I'm not too worried about the way the text is displayed once it's formatted correctly. It's just annoying to have to manually add back the spaces between the paragraphs every time I paste from another text editor. David's solution will do until I can figure out how to add paragraphs automatically :) 

FrD

unread,
May 10, 2020, 12:19:40 PM5/10/20
to TiddlyWiki
Yes that's how I use it in some TWs of mine.

Regards
FrD

Le dimanche 10 mai 2020 16:01:45 UTC+2, Anne-Laure Le Cunff a écrit :
Wow, thank you so much everyone for all the help....

@FrD: Thank you! If I understand correctly, I'd have to tag each new tiddler with the corresponding data-tag to make sure these custom styles are applied?

@...

TonyM

unread,
May 12, 2020, 9:00:53 PM5/12/20
to TiddlyWiki
Update on this Paragraph formatting issue;

I think I have found some easy to use methods to resolve this!

This solution also allows wikitext markup to be applied to pasted text, allowing subsequent markup.

If you wrap a block of text in a section or other html blocks and use a style to use the same white spacing as pre you will get text that behaves like was intended in the source text.
Using a blank line after the first html tag ensures any wikitext markup is honored.

<section  style="white-space: pre;">
blank line here
!Marked

Your pasted text Wikitext markup if desired
</section>

Of course you can create a css class eg "retain" and apply it like this as well (define in a tiddler tagged $:/tags/Stylesheet

@@.retain
;No Blank line needed for wiki text
Some text

some more text
@@
You can leave off the closing "@@" with no apparent ill effect

The above is honored whe transcluding this tidder

There may be better ways but if on a given tiddler you wish to have a class applied to the whole content create a class field and give it the value of the class in the following format.

class @@.retain and the whole tiddler content will have "style="white-space: pre;" applied.

Regards
Tony

David Gifford

unread,
May 12, 2020, 9:16:41 PM5/12/20
to TiddlyWiki
I am posting a separate thread to request a "suffix-line" parameter to work with the "prefix-line" parameter.

TonyM

unread,
May 12, 2020, 10:05:10 PM5/12/20
to TiddlyWiki
I started a New Thread to discuss the solution I found for this 


Regrads
Tony

A Gloom

unread,
May 13, 2020, 9:30:43 AM5/13/20
to TiddlyWiki
From Google docs with Firefox I have no issues copying and pasting from Google doc to TW-- the browser preserves single and double linebreaks but not 1st line indents

After pasting into a tiddler I wrap it in $$$text/vnd.tiddlywiki>text/html $$$ ($$$ being the end tag) to get paragraph tags if needed (though you lose double line break spacing)

For Chrome there is an extension for copying html code which can be pasted

TonyM

unread,
May 13, 2020, 9:45:43 AM5/13/20
to TiddlyWiki
There is an extension in FireFox as well.

Regards
TonyM
Reply all
Reply to author
Forward
0 new messages