Saq, Aha! This totally makes sense. Just a part of the rendering mechanism I've never had reason to look into. Thanks!
On Sunday, May 10, 2020 at 4:44:30 AM UTC-5, Saq Imtiaz wrote: > > Hi Soren, > > So in your first example of a render command, you aren't providing a > template to render the tiddler through. So the actual content with no extra > processing gets rendered. > > Macros in TiddlyWiki are made available (or not) by the templates you use. > > For example, note the third line in: > > https://tiddlywiki.com/#%24%3A%2Fcore%2Ftemplates%2Fserver%2Fstatic.tiddler.html > > \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro > ]!has[draft.of]] > > You can place that in any template you use to render your tiddlers to make > global macros available. > > You will find that the same line appears in $:/core/ui/ViewTemplate as > well. > > Hope this helps, > Saq > > > On Sunday, May 10, 2020 at 3:55:58 AM UTC+2, 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/0f3a4d99-b55d-4712-b30c-4e59323a0605%40googlegroups.com.

