I know that I can create a list of all the tags and Tiddlers under the current Tiddler as the following:
<div class="tc-table-of-contents">
<$macrocall $name="toc" tag=<<currentTiddler>> />
</div>
I also know that I can send parameters to an iframe:
<iframe
width="100%"
height="800"
src='http://mypage.com/tiddlywiki?tagTree={"rootTag":{"childTag":["tiddler1","tiddler2","tiddler3"],"childTag2":["tiddler1","tiddler2","tiddler3"],"childTag3":["tiddler1","tiddler2","tiddler3"]}}'
allowfullscreen="allowfullscreen"
allowpaymentrequest
frameborder="0">
</iframe>
The JSON here has the following structure:
{
"rootTag": {
"childTag": [
"tiddler1",
"tiddler2",
"tiddler3"
],
"childTag2": [
"tiddler1",
"tiddler2",
"tiddler3"
],
"childTag3": [
"tiddler1",
"tiddler2",
"tiddler3"
]
}
}
With this iframe structure, I’m sending the JSON declared in the tagTree
variable to the page http://mypage.com/tiddlywiki… This way I can receive the data inside the iframe and build a visualization tool with Javascript. My doubt is if it’s possible to convert the first command used with toc
to JSON, just so I can put it on my iframe. A pseudocode of what I have in mind would be:
<iframe
width="100%"
height="800"
src='http://mypage.com/tiddlywiki?tagTree='tocToJSON(<div class="tc-table-of-contents"> <$macrocall $name="toc" tag=<<currentTiddler>> /> </div>)'
allowfullscreen="allowfullscreen"
allowpaymentrequest
frameborder="0">
</iframe>
Is there any easy way of doing something like that? My goal here is to build some alternative visualization perspectives of my tree of Tiddlers on a Javascript page…
Edit
After researching for a while I found this jsontiddlers Macro https://tiddlywiki.com/#jsontiddlers%20Macro on the documentation… It works fine when I’m using filters:
<$macrocall $name="jsontiddlers" filter=[prefix[Hello]] $output="text/raw"/>
The result here is like I expected on my original question… However, I’m not sure how I can filter a list of Tiddlers just like toc
does. Or if instead of using the filter I should be trying to use <div class="tc-table-of-contents"><$macrocall $name="toc" tag=<<currentTiddler>> /></div>
as a parameter o the jsontiddlers
macro. Can I filter a JSON that will follow the structure of my tags just like toc
does?