For kicks, I decided to try turning the macro tiddler into a template and 
rendering through that on the command line, and this worked. Viz., I added 
to the bottom of the *testmacro* tiddler:

<$transclude mode="block" />

Then ran:

"$(npm bin)/tiddlywiki" --render '[[test2]]' "[is[tiddler]addsuffix[.html]]" 
text/html "testmacro"

And now I got, as expected:

<p><p>Hello world!</p><p>Some more nice text.</p><p>Signing off.</p></p> 

Obviously, this is a rather hacky "solution" to the problem, so while this 
will do for now for my use case, I'd still appreciate knowing if this is 
supposed to work, and perhaps a note in the documentation if it is not 
supposed to work.

On Saturday, May 9, 2020 at 8:55:58 PM UTC-5, Soren Bjornstad wrote:
>
> Hi all,
>
> I'm having a strange problem trying to render HTML with the Node --render 
> command. As the subject says, the output of global macros doesn't show up. 
> Yet local macros work fine. Am I doing something wrong, or is this a bug or 
> just not supported this way? The documentation doesn't say anything about 
> lack of support, and I would not expect content to be completely dropped 
> from the rendered output without warning.
>
> Here's a minimal test case:
>
> created: 20200510013858423 
> modified: 20200510013929749 
> tags: $:/tags/Macro 
> title: testmacro 
> type: text/vnd.tiddlywiki 
>  
> \define myglobalmacro() Some more nice text. 
>
> created: 20200510013706375 
> modified: 20200510013934876 
> tags: 
> title: test2 
> type: text/vnd.tiddlywiki 
>  
> \define mymacro() Hello world! 
>  
> <<mymacro>> 
>  
> <<myglobalmacro>> 
>  
> Signing off.
>
> Within my wiki, as expected, this tiddler renders as:
>
> <div class="tc-tiddler-body tc-reveal"><p>Hello world!</p><p>Some more 
> nice text.</p><p>Signing off.</p></div>
>
> On the other hand, when I run:
>
> "$(npm bin)/tiddlywiki" --render '[[test2]]' 
> "[is[tiddler]addsuffix[.html]]"
>
> ...in output/test2.html, I get merely:
>
> <p>Hello world!</p><p>Signing off.</p>
>
> My first thought was that TiddlyWiki filtered out the tiddler containing 
> the macro, so it didn't know how to do the replacement. But then I tried:
>
> "$(npm bin)/tiddlywiki" --render '[is[tiddler]]' 
> "[is[tiddler]addsuffix[.html]]"
>
> ...and that didn't work either.
>
> Any idea how I can get all my macros replaced properly? I'm actually 
> trying to extract just the rendered portions *of one global macro *from 
> my wiki this way, so having it skip rendering exactly the only part I care 
> about is pretty ironic!
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8225f81a-c3f3-4f98-b8fc-846f150340b1%40googlegroups.com.

Reply via email to