How to display a filtered transclusion with markup formatting?

129 views
Skip to first unread message

Si

unread,
Jul 7, 2021, 11:43:11 AM7/7/21
to TiddlyWiki
I have a macro where I use the $text widget where the "text" attribute is a filtered transclusion (i.e. {{{ [myfilter] }}} ).

I've noticed that occasionally [myfilter] produces something containing markup, which obviously gets rendered as plain text.

E.g. <$text text={{{ [myfilter] }}}/> might output A __sentence__ with ''formatting''.

Is there some equivalent of the $text widget that will output the text with the formatting applied?

So for the above example I would instead get: A sentence with formatting.

Maybe this is a basic question but I'm not sure what the simplest approach would be?

Eric Shulman

unread,
Jul 7, 2021, 11:56:54 AM7/7/21
to TiddlyWiki
On Wednesday, July 7, 2021 at 8:43:11 AM UTC-7 Si wrote:
I have a macro where I use the $text widget where the "text" attribute is a filtered transclusion (i.e. {{{ [myfilter] }}} ).
I've noticed that occasionally [myfilter] produces something containing markup, which obviously gets rendered as plain text.
E.g. <$text text={{{ [myfilter] }}}/> might output A __sentence__ with ''formatting''.
Is there some equivalent of the $text widget that will output the text with the formatting applied?

Don't use the $text widget.  Just put the filtered transclusion directly in your wikitext, e.g.,
{{{ [myfilter] }}}
 
By default, the transcluded content will be "wikified", which will automatically process any formatting syntax.

enjoy,
-e

Si

unread,
Jul 7, 2021, 12:07:09 PM7/7/21
to TiddlyWiki
Hi Eric, thanks for your reply.

That doesn't seem to work for me? Adding the filtered transclusion directly gives me the 'literal' text as a link.

Even when I try it if I try something like this: {{{ [[`test`]] }}}. This just displays `test`, but as a link.

Charlie Veniot

unread,
Jul 7, 2021, 1:14:52 PM7/7/21
to TiddlyWiki
Me thinks we are going to need to see the macro and/or a description of what you're trying to do.
Message has been deleted

Si

unread,
Jul 7, 2021, 2:35:56 PM7/7/21
to TiddlyWiki
Hi Charlie.

>>> Me thinks we are going to need to see the macro and/or a description of what you're trying to do.

To be honest I don't think it is that relevant: the simplest way to display the filter {{{ [[`test`]] }}} with wikitext formatting (and not as a link) is all I want to know.

The macro I am actually using is very messy, but here it is:

\define context()
    <b>
    <small>
        {{{
            [<currentTiddler>get-stream-root[]addsuffix[: ]]
            [<currentTiddler>get-stream-root:includeall[]!search[<<*>>]rest[1]butlast[2]get[text]addsuffix[: ]]
            [<currentTiddler>get-stream-root:includeall[]!search[<<*>>]butlast[1]last[]get[text]]
        }}}
    </small>
    </b>
<br><br>
\end

Edit: I pasted the wrong thing so deleted my previous message.

TW Tones

unread,
Jul 7, 2021, 4:44:57 PM7/7/21
to TiddlyWiki
Si,

I have recently being working on a tool that pulls wiki text from a field in another tiddler. Because the value is in a variable (display-markup) I used the wikify widget as follows;

<$wikify name=result output=html mode="inline" text="<<display-markup>>"><<result>></$wikify>

This could have a variable, transclusion or filtered transclusion as the text value and achieve what you ask, however as others said can you transclude directly,
{{tiddler!!field}} or use the transclude widget?

Tones

Saq Imtiaz

unread,
Jul 7, 2021, 6:06:12 PM7/7/21
to TiddlyWiki
@si

Try this:

\define context()
    <b>
    <small>
        <$list filter="[<currentTiddler>get-stream-root[]addsuffix[: ]] [<currentTiddler>get-stream-root:includeall[]!search[<<*>>]rest[1]butlast[2]get[text]addsuffix[: ]] [<currentTiddler>get-stream-root:includeall[]!search[<<*>>]butlast[1]last[]get[text]]" variable="x">
            <<x>>
        </$list>
    </small>
    </b>
<br><br>
\end

Throw in an extra line break before and after <<x>> if you need it in block mode.

Alternatively if you really want to use the triple brace syntax:
{{{ filter || template }}}
Where template is a tiddler that just contains:
<<currentTiddler>>

Si

unread,
Jul 8, 2021, 10:44:26 AM7/8/21
to TiddlyWiki
Thanks Saq!
Reply all
Reply to author
Forward
0 new messages