I migrated around 2,600 entries from TiddlyWiki 5 to Obsidian.
My method was based on this really helpful blog post. These instructions are for MacOS. I’m not much of a programmer so a lot of this stuff is kinda hacky and someone can probably come up with a cleaner version of this. I am happy with the end result though.
Here’s an outline of my steps:
1. First export all the Tiddlers to HTML files
Run this command in your TiddlyWiki directory
tiddlywiki --render [!is[system]] [encodeuricomponent[]addsuffix[.html]] text/plain $:/core/templates/custom-template
A couple notes about that command: 1. I am using the encode URI flag because I have a lot of entries with punctuation and special characters which I wanted to change manually. You may not need it. 2. I created a custom template for myself that has the tags in plain text listed at the top. Here is my template:
title: $:/core/templates/custom-template
`created: `<$view field="created" format="date" template="YYYY-0MM-0DD"/>
<$fields exclude='text bag title tags type created modified' template='$name$: $value$
'></$fields>
<$list filter="[all[current]tags[]!is[system]sort[title]]">#<$view field="title"/> </$list>`
`
<$view field="text" format="text" />
2. Rename the files
I used Hazel on Mac for this but you could use other apps
- Do a bit of cleanup to remove the URL encoding on the file name. I do this so that I can control exactly how the characters get replaced in the file name.
- Change creation date and modification date
3. Convert to Markdown with Pandoc
Run this command on the folder that contains all your HTMLified tiddlers.
for f in *.html; do pandoc "$f" -f html-native_divs-native_spans -t commonmark --wrap=preserve -o "-md/${f%.html}.md"; done
- iterates on all files in a folder
- puts them in a “/-md” subfolder
4. Cleanup with Sublime Text
Using the batch find/replace on the whole folder I ran a lot of cleanup on the entries.
I couldn’t figure out how to stop Pandoc from escaping all kinds of characters so I ran this (in normal find/replace mode)
Find: `\` Replace: nothing
Also needed to clean up internal links. Pandoc spits internal links out as [Note Name](#Note%20Name)
Use regex mode (click the *
icon in the find/replace UI) to find internal links and replace them with [[ ]]
notation
Find: `\[([^\[\]]*)\]\(\#(.*?)\)`
Replace: `[[$1]]`
That’s about it! Did some other minor cleanup with Sublime. LMK if this helps. I think there is definitely room to simplify the process.