Import from TiddlyWiki 5 to Obsidian

How to Export from TiddlyWiki to Obsidian

Note: I am on Mac, so all the steps are specially for that OS. I followed the steps by @kepano and just tweaked/clarified the things that didn’t work for me initially. So this is very much his work. @pikacho, I hope this is helpful for you and others.

Step 1: Set up TiddlyWiki in Node.js

  1. Download and install Node.js
  2. Open “Terminal”, run npm install -g tiddlywiki
    • If an error occurs, run sudo chown -R $USER /usr/local/lib/node_modules (that gives you admin privileges for the specific folder
    • Run npm install -g tiddlywiki again
  3. Check if it works by running tiddlywiki --version. If everything worked it should show you the version of TiddlyWiki
  4. Run tiddlywiki myfirstwiki --init server
  5. Run tiddlywiki myfirstwiki --listen to start the server

Step 2: Import Notes into new TiddlyWiki

  1. Open http://127.0.0.1:8080/ in your browser. It should load an empty TiddlyWiki.
  2. Drag the file that contains the TiddlyWiki you want to export (for me it’s “empty.html”) in the top of the browser window
  3. Press “import”. This imports all of your Tiddlers into the empty wiki so we can export them later. You might need to reload the wiki.
  4. In Terminal, press Control + C to exit the server

Step 3: Export Notes as .html

  1. Navigate to the folder “myfirstwiki” in Finder.
    • For me that’s ~/myfirstwiki/. In Finder Shift + Command + G opens a window in which you can copy my path.
  2. Right click → Services → New Terminal on the “myfirstwiki” folder.
  3. In that Terminal window run tiddlywiki --render [!is[system]] [encodeuricomponent[]addprefix[tiddlers/]addsuffix[.html]]
  4. You can find the exported Tiddlers in the “output” folder in the “myfirstwiki” folder.

Step 4: Change .html to .md notes using Pandoc

  1. Install Pandoc

  2. Navigate to the “output”-folder containing the .html Tiddlers

    1. Open Terminal
    2. Show directory by typing and entering pwd
    3. Move to directory
      • cd makes you enter a folder, pwd shows you the directory you’re in
      • This is how I entered the folder, yours might be slightly different
        • cd myfirstwiki
        • cd tiddlers
        • cd output
        • pwd to confirm you’re in the right directory
  3. Once you’re in the right folder run this command in Terminal: for f in *.html; do pandoc "$f" -f html-native_divs-native_spans -t commonmark --wrap=preserve -o "${f%.html}.md"; done

  4. In Finder, I then copied and pasted the Markdown files into a separate folder.

A note on the original code by @kepano
  • The original code (for f in *.html; do pandoc "$f" -f html-native_divs-native_spans -t commonmark --wrap=preserve -o "-md/${f%.html}.md"; done) that puts all of the files into a seperate folder didn’t work for me. All of the tiddlers that are transferred to Markdown (.md) files are now in the same folder as the .html files.

Step 5: Clean up using Atom

  1. I use Atom, other editors will work just as fine. I loaded the folder with all of the Markdown Tiddlers into Atom and then opened “Find in Project.”
  2. Clean up links.
    • Use regrex mode (click the * icon in the find/replace interface)
    • Find: \[([^\[\]]*)\]\(\#(.*?)\) Replace: [[$1]]
    • This cleans up the links from [Note Name](#Note%20Name) to the [[]] notation.
  3. After that, I didn’t need to do any more cleaning up. Run more find/replace searches if necessary.

Step 6: Import into Obsidian

  1. Navigate to the Obsidian Vault in Finder. Create a new folder “TiddlyWiki Import”.
  2. Copy and paste the Markdown Tiddlers in the folder.
    • Note: A lot of my notes were just empty pages that got created by linking to them. The way Obsidian handles backlinks makes them redundant. In Finder I sorted the converted Tiddlers by size and only imported the ones that were bigger than 1 byte.
  3. Open (if it’s already open then reload with Cmd + R) Obsidian and voilà! Your notes are right in the TiddlyWiki Import folder!

Some final notes
I excluded the use of a custom template in step 3 to minimize friction. I can see how that would be very handy to add though. Also somehow my journaling notes didn’t get exported properly so I will have to manually transfer those.

I am not a coder, so my knowledge comes just from trial and error. If more experienced forum members have things to add/simplify please let me know. All of these steps worked well for me but if you run into issues, let me know and I will do my best to help :slight_smile:

6 Likes