line a
line b
line c
Line d
line a
line b line c
Line d
<section style="white-space: pre-wrap;">
blank line here
!Marked
Your pasted text Wikitext markup if desired
</section>
.retain { white-space: pre-wrap; }
@@.retain
;No Blank line needed for wiki text
Some text
some more text
@@
.keep P { white-space: pre-wrap; }
@@.retain {{transcluded}}@@
Folks,I just found a solution to an issue which bugs a lot of new and experienced users alike, many come to be happy by adapting to it, however when they bring text in from elsewhere the issue rears its head again.
Problem: Consider Source Text as follows in a tiddler
line a
line b
line c
Line dGets displayed asThat is the author or source of text requires two enters resulting in a blank line before it is treated as a new paragraph, other wise the line is appended to the previous line.
line a
line b line c
Line dSee also that the source text has two line between line c and line b, yet rendering collapses this to one line, this will not change with this solutionBe aware there are good reasons for this behaviour and attempts at fixing it have tended to be cumbersome.As I posted in this thread Preserving paragraphs when pasting into TW (answer reproduced here) I think I have found a useful solution that can be applied in a few different ways.
- This solution also allows wikitext markup to be applied to pasted text, allowing subsequent markup.
Background 1st solutionIf 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>
2nd SolutionOf course you can create a css class eg "retain" and apply it like this as well (define in a tiddler tagged $:/tags/Stylesheeteg
.retain { white-space: pre; }
@@.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 when transcluding this tidder
3rd SolutionThere 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=classname and the whole tiddler content will have class appliedHowever the class is applied at the very last moment, so the preview window does not apply it, and the rendered tiddler is wrapped in one or more `<p>` tags.So let us define a class that uses the P selector to target the resulting paragraphs
.keep P { white-space: pre; border: 2px solid blue; }
and set the class field to keep
[data-tags*="preserve-breaks"] .tc-tiddler-body { word-break: normal; word-wrap: break-word; white-space: pre-wrap; }
To use it, you only need to tag a content tiddler with: preserve-breaks
To get an overview, where you used it: Create a tiddler eg: Tiddlers using hard line-breaks whith the content:
! These tiddlers are special
<<list-links "[tag[preserve-breaks]]">>
That's it!
The advantages are:
The tag-name preserve-breaks is just a convention. You can use any other "shortcut" that fits your needs. You only need to change it in the code above.
have fun!
You can drag and drop import the attached bundle to tiddlywiki.com to test it.
There are some limitations!
It should only be used for "prose text". The special formatting may break macro and widget calls!
Mario
"""
Folks,I just found a solution to an issue which bugs a lot of new and experienced users alike, many come to be happy by adapting to it, however when they bring text in from elsewhere the issue rears its head again.
Problem: Consider Source Text as follows in a tiddler
line a
line b
line c
Line dGets displayed asThat is the author or source of text requires two enters resulting in a blank line before it is treated as a new paragraph, other wise the line is appended to the previous line.
line a
line b line c
Line dSee also that the source text has two line between line c and line b, yet rendering collapses this to one line, this will not change with this solutionBe aware there are good reasons for this behaviour and attempts at fixing it have tended to be cumbersome.As I posted in this thread Preserving paragraphs when pasting into TW (answer reproduced here) I think I have found a useful solution that can be applied in a few different ways.
- This solution also allows wikitext markup to be applied to pasted text, allowing subsequent markup.
Background 1st solutionIf 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>
2nd SolutionOf course you can create a css class eg "retain" and apply it like this as well (define in a tiddler tagged $:/tags/Stylesheeteg
.retain { white-space: pre; }
@@.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 when transcluding this tidder
3rd SolutionThere 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=classname and the whole tiddler content will have class appliedHowever the class is applied at the very last moment, so the preview window does not apply it, and the rendered tiddler is wrapped in one or more `<p>` tags.So let us define a class that uses the P selector to target the resulting paragraphs
.keep P { white-space: pre; border: 2px solid blue; }
and set the class field to keep
This would not support the generation of p tags in the output however if the class is available to the static tiddlers it should generate the same visual results.
However we, Mario and I, did investigate a dot paragraph method that would do this so we could complete that method if the p tag is necessary.
I am not an expert on css or static exports but I am confident of this.
Regards
Tony
Sincerely,
Riz
<section style="white-space: pre;">
blank line here
!Marked
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mi augue, ultricies sed faucibus a, tristique rhoncus risus. Donec varius turpis hendrerit massa dapibus, sit amet dictum ipsum blandit. Aenean neque tortor, scelerisque ac elementum accumsan, iaculis quis odio. Vestibulum imperdiet aliquam justo eget aliquet. Maecenas sed magna quis lacus lobortis tincidunt. Proin eget consequat arcu. Aliquam rutrum orci id justo aliquam elementum. Nunc elementum commodo ligula, non interdum lorem fermentum et. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Interdum et malesuada fames ac ante ipsum primis in faucibus. Integer gravida efficitur metus. Integer faucibus interdum tortor, sed molestie odio ultricies sit amet. Vivamus ornare in sapien a porta.
Your pasted text Wikitext markup if desired
</section>
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes" style="white-space: pre-wrap;">
Mat & Riz,Give me the data tags code and I will add it to the lead thread.
tags: $:/tags/Stylesheet
text:
[data-tags*="YOURTAG"] .tc-tiddler-body {
word-break: normal;
word-wrap: break-word;
white-space: pre-wrap;
}
Am I seen
as a line?
Am I a paragraph 1 or just a sentence in a paragraph?
Am I paragraph 2 or just a sentence in paragraph 1?
I am still working on this and I concur with your observation but can also have to do with the source and the copy method so it can get quite indeterminate.
I am currently playing with css on html and wiki text blockquotes. In some ways pasted text is quotable. What is I believe Importiant is to allow inline block and whole of tiddler.
Regards
Tony