Transclude Text in plain text tiddler?

I want to be able to transclude in plain/text tiddlers I only want the text to show as raw, allowing only {{}},{{||}},{{!!}}&{{##}} transclude methods, all other including nested tiddlers should show as plain text without formatting I’m using this for coding and tw5 functions are hard to get around short of just disabling by brute force all the text shortcuts. Any ideas?

Edit:
I don’t want */#/[[]] to work in the plain text only Transclusion and the preserved line spacing.

Try this:

First, create a stylesheet tiddler (tagged with $:/tags/Stylesheet), containing:

.plaintext { white-space:pre; font-family:monospace; }

Next, create your content tiddler:

At the top, put:

\rules only transcludeinline transcludeblock

and also add a field named class, with a value of plaintext

Notes:

  • The \rules only ... pragma disables all wikitext parsing except for transclusion.
    • See $:/ControlPanel > Info > Advanced > Parsing for a list of parsing rules.
  • You can’t set the tiddler’s type field to text/plain, as that would completely disable ALL wikitext processing, including transclusion.
  • Instead, use the class field to automatically apply whatever styles you have entered into the .plaintext { ... } CSS definition.

Let me know how it goes…

enjoy,
-e

1 Like

Hi, 3 tiddlers

title: test-procedure

\procedure test()
Some text
\end

<<test>>
title: plain/template

<pre><code><$view /></code></pre>
title: test-transclusion-template

{{test-procedure||plain/template}}

test-tansclusion-template.json (452 Bytes)

Also see: https://tiddlywiki.com/#Transclusion:Transclusion%20[[Transclusion%20with%20Templates]]

1 Like