How to add support for zip-md in addition to zip-tid depending on the type of tiddlers being exported

https://marxsal.github.io/various/playground.html#Zip%20File%20Experiments

@Mark_S How to add support for zip-md in addition to zip-tid in this code depending on the type of tiddlers being exported. I mean both zip-tid and zip-md export option should be there and depending on the type of the tiddlers, one of them to be used for exporting.

I only jus followed this to see “A macro to export multiple tiddlers as a zip file”, I have not fully tested but can see value adding an Advanced Search > Filters tab option to export the tiddlers listed in the search results. That is using the filter provided.

Wonderful work there @Mark_S

Out of interest @arunnbabu81 what do you mean by “zip-tid and zip-md”

I ask because I am considering an update and “fork” for the above if @Mark_S is not interested in updating/enhancing this.

  • In the long run I also want to be able to generate a plugin library form single file wikis this way.
  • This involves using other templates to generate the files then zip.

I am already using this in my wikis in the filter tab…I can share the link if you need

Current macro by @Mark_S is ziptid which exports tiddlers as zip of .tid files.
I want to replicate the same function for markdown tiddlers ( .md files)
So depending on the filter output (whether tid or md files), ziptid or zipmd needs to be used automatically to export the tiddlers

Thanks for that,

I imagine we could even turn a JSON of tiddlers, into a plugin and zip it.

In a similar way there would be value exporting multiple tiddlers as a JSON but inside a ZIP in part because many email clients wont allow JSON but will allow zip (from memory).

  • I have long wished to select a group of tiddler by a filter then zip it and use a mailto:// link to create an email with the zip attached. However this needed mime encoding the body.
  • This would allow someone to make changes on a read only wiki and send those changes for review and import by the wiki owner.
  • But you could even send anything you can zip including multiple tiddlers and plugins, even whole wikis.

Yes please :nerd_face:

Looking at the plugin $:/plugins/tiddlywiki/jszip there is more than enough documentation to build what we both want using wiki text rather than JavaScript.

You just need a template for your markdown files.

https://tiddler-multicolumn-views.tiddlyhost.com/#%24%3A%2Farsheth%2Fadvanced-search%2Fexport%2Fzip-tid

This is the one tiddler concerned. Open it only in desktop mode…I am currently using mobile…If you are facing any issues, I will share another link. I think you will have to drag and drop the icon tiddler also from this wiki…just used the cntrl+P shortcut of command palette plug for searching.

I have to read through other comments of your before responding to them which I will do later… I am currently at work place

1 Like

This should work for at least one variety of markdown. Since I couldn’t search your example (you must have a search box somewhere?) I don’t know if it works for your variety.

The only difference (I think) between tid and md is the extension. Unless of course your markdown editor doesn’t like meta info at the top.

But with other varieties, like JSON, there will have to be a different export template. So, yeah, if anyone wants to have a go at that …

\define ziptid(filter: "[all[tiddlers]]" , output: "tiddlers.zip" , title:"Make Zip")
<$button> $title$
<$vars ziptid="$:/temp/zip">
<$action-sendmessage $message="tm-zip-create" $param=<<ziptid>>/>

<$vars sys="$:/" >
<$list filter="""$filter$""">
<$let 
sufx={{{[<currentTiddler>get[type]match[text/markdown]then[.md]else[.tid]] }}}
fname={{{[<currentTiddler>split<sys>join[_]split[/]join[_]addsuffix<sufx>] }}} >
<$action-sendmessage $message="tm-zip-render-file" $param=<<ziptid>> filename=<<fname>> tiddler=<<currentTiddler>> template="$:/core/templates/tid-tiddler" mode="block" output="text/plain"/>
</$let>
</$list>
</$vars>
<$action-sendmessage $message="tm-zip-download" $param=<<ziptid>> filename="""$output$"""/>

</$vars>
</$button>
\end

<<ziptid "[tag[Learning]]" "Learning.zip" "Zip Learning">>
2 Likes

Thanks @Mark_S This works well. I tried it in obsidian. Even external images are rendered correctly. Only problem is the long metadata at the top of the md file.

The wiki which I shared was for the purpose of sharing the previous code I used with @TW_Tones. I was on mobile at that time and I couldn’t figure out any other old wiki on tiddlyhost with zip functionality added. But this wiki was created to showcase something else. I don’t remember why I removed the search box. But I use Cntrl+shift+A to open advanced search if the search box is not seen in the UI.

I will share a wiki with default UI for sharing code from now onwards. Here is it

1 Like

There’s another tool on the playground page for zipping images. If you’re departing for Obsidian, then a two-pass, one-time approach should work.

Hmm. The meta data for tids almost looks like the YAML Obsidian uses. So you might be able to create a template that would, at a minimum, put “—” around the meta that TW creates.

Or, you might ask on the Obsidian forum if anyone has a tool for TW-to-Obsidian conversion. I recognized at least one prominent former TW-er as the author of one or more Obsidian plugins.

I don’t have any plans to move to obsidian. Just that I want to make sure that the notes which I create last longer. That’s why I just wanted to try out markdown tiddlers in TW. ( only for the notes part)

I don’t have the skills to make obsidian work like I want it to be…but Tiddlywiki can be made into whatever form I want it to look like…the good thing is that even if I use markdown for notes in TW, all other customisation which I have made till now will still work. Non programmer like me will any day prefer tw over obsidian if we need own custom app and solutions.

I guess you are referring to grossinger.

Are you using obsidian for any purpose? I have tried out many apps since 2020…tw, remnote, obsidian, logseq, tana, dendron…tw suits me better than anything else …may be because I have experimented more in TW and have some confidence that I can do something on my own or hack someone else’s solutions to suit mine using TW…

@Mark_S you must be remembering the wikitext to md conversion button you created for me sometime back based on cdavens markdown convertor…can the tid to md conversion and subsequent exporting of individual md tiddlers as zip files work from the filter tab of advanced search.