Is it possible to retain the exact arrangements of newlines in a text that is wikified and then shown in a codeblock (or copied to clipboard)?
If tiddler Text
contains exactly:
{{A}}
{{B}}
{{C}}
I expected that the following code:
<$wikify name="text" text={{Text}}>
<$codeblock code=<<text>>/>
</$wikify>
would produce the following, shown in a codeblock widget:
Alpha
Bravo
Charlie
Instead it produces
AlphaBravoCharlie
or, if output="formattedtext"
is added to the wikify widget, it produces
Alpha
Beta
Gamma
Is it possible to retain the exact spacing/newlines, that is: double newline remains double newline, single newline remains single newline? The leading/trailing newlines are unwelcome, but easy to deal with if consistent, so they’re not the heart of the problem.
I haven’t found any satisfying solution so far. Two ugly workarounds I have found are:
- Transclude a tiddler containing a single newline in places where I want double newline, so in this example, assuming the tiddler
-
contains a single newline:
{{A}}
{{-}}
{{B}}
{{C}}
- add any whitespace character, e.g. single space, between the double newlines (this is error prone and the space remains in the final output ).
- I experimented with manipulating the text before it is wikified, that is using a filtered transclusion as $wikify text parameter, and search-replace the double newlines. But I haven’t found anything that would work.
Any help would be appreciated!
Context:
I’m creating a set of document templates, which should be easy to copy from TW. The templates consist partially of plain text, and partially of reusable transcluded parts (so the wikification is necessary).
Right now for testing purposes I’m only displaying the templates in a codeblock, to see if the spacing is preserved right.