Conversion from vimwiki to tiddlywiki and back?

Is anyone aware of a program or script that might be able to convert from tiddlywiki to vimwiki and back again?

I make heavy usage of the tabs macro in my wikis, so it would be good if that were handled somehow in the solution; but I don’t expect that a solution would work that way.

Just thought I’d see if anyone was using something similar to that.

I also know that vimwiki as well as tiddlywiki are capable of using markdown, so that might be a good way to do it moving forward; but as of now most of my wikis are in Tiddlywiki format.

I’ve never used vimwiki, but a quick look at the docs makes me think that it would be fairly trivial to write something to convert vimwiki to TW. The other way is much harder, though, given all the power of TW. Does transcluded content become static? Do widgets get ignored? How about <<toc-* ... >> or <<now>> or any other macros? Can you include dynamic lists?

I think you could do this only for the simplest TW content. Would that be worth it to you?

My thinking is that it would be useful for using tiddlywiki in distinctly untiddlywiki-friendly environments. It would be more of a “convert to and use”; rather than a make changes and convert back to; I mean if one did make edits, one could always re-export the other one out of tiddlywiki and diff the files against each other to see the changes.

So for instance, maybe one is at a job; or one is working as a vendor; and doesn’t want the customer to see the contents; it could be stored in an encrypted volume or in password-store or something. Or say you’re on a headless server somewhere and there isn’t another way to serve the content.

I think these would be use cases for this.

As for macros and such, maybe those could be handled by having a Javascript function that is called to create the text-only output. And maybe the base-64 string of the image could be stored and used elsewhere if an image needs to be seen.

One would definitely have to plan in advance if using the simplest content or make modifications or alternate tiddlers identified with tags or special fields containing the name of the original tiddler or something.

I’m just spitballing ideas, I haven’t really done much development of TW5.

I’m afraid that most of what I see are the difficulties. If it’s one-way translation, then I think we can manage either direction. On top of the easy vimwiki → tiddlywiki, we could do something similar to the static export to handle tiddlywiki → vimwiki. I don’t think that would be trivial, but I imagine it’s doable. But once we’ve converted to vimwiki, I don’t see how we could ever get anything like the TW version back.

Imagine a tiddler with this content:

<$list filter="[tag[Book]each:list-item[authors]]" variable="auth">
  <$link to=<<auth>> />
  <<list-links filter:"[<auth>listed[authors]tag[Book]]" >>
</$list>

That might create output like this1:

Diana Gabaldon

Neil Gaiman

Terry Pratchett

Kass Morgan

Danielle Paige

If our (static-like) conversion to vimwiki created something that gave that same output, great. But when trying to convert back, we’re never going to get anything like the wikitext that generated. At best, we’ll have a static list of authors and books. The dynamic nature will be gone.

I can’t imagine any useful way around this.





1 Example taken from Feedback on documentation of filter operators.

Yeah I agree, I think it’s a one way conversion, and if anyone intended to use it the other way (which I wouldn’t recommend) they would have to diff the export files; the vimwiki files that would be taken along to such an environment, modified and then have those diffed against currently exported ones; (but that sounds like a lot of trouble, so I wouldn’t recommend it).

But as a one way export reference to an encrypted file system or password store entry it might work okay.