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 d

Gets displayed as
line a

line b line c

Line d
That 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.

See 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 
solution

Be 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 
<https://groups.google.com/d/msg/tiddlywiki/TX1VfRRFmhE/qzhN7TePBQAJ> (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 solution*
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>

*2nd Solution*
Of course you can create a css class eg "retain" and apply it like this as 
well (define in a tiddler tagged $:/tags/Stylesheet
eg
.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 Solution*

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=classname and the whole tiddler content will have class applied

However 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

So the whole tiddler will honor this formatting, good for pasted content 
with line breaks considered paragraph breaks, and still permits wikitext.

   - In this case unlike 1st and 2nd solutions this class is not honored in 
   transclusions, which may a be good or bad 
   - Use this to fix it, ie add the retain class to the section

@@.retain {{transcluded}}@@

*In closing*
Some of us may consider this a substantial improvement in usability others 
will see little or no value.

   - What do you think?
   - Have you other ideas?
   - Feedback please

Regards
Tony(m)

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/bf861654-e5d6-4dd8-af08-9e6f22b4fb47%40googlegroups.com.

Reply via email to