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
- Download and install Node.js
- 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
- If an error occurs, run
- Check if it works by running
tiddlywiki --version
. If everything worked it should show you the version of TiddlyWiki - Run
tiddlywiki myfirstwiki --init server
- Run
tiddlywiki myfirstwiki --listen
to start the server
Step 2: Import Notes into new TiddlyWiki
- Open http://127.0.0.1:8080/ in your browser. It should load an empty TiddlyWiki.
- Drag the file that contains the TiddlyWiki you want to export (for me it’s “empty.html”) in the top of the browser window
- 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.
- In Terminal, press
Control + C
to exit the server
Step 3: Export Notes as .html
- 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.
- For me that’s ~/myfirstwiki/. In Finder
- Right click → Services → New Terminal on the “myfirstwiki” folder.
- In that Terminal window run
tiddlywiki --render [!is[system]] [encodeuricomponent[]addprefix[tiddlers/]addsuffix[.html]]
- You can find the exported Tiddlers in the “output” folder in the “myfirstwiki” folder.
Step 4: Change .html to .md notes using Pandoc
-
Install Pandoc
-
Navigate to the “output”-folder containing the .html Tiddlers
- Open Terminal
- Show directory by typing and entering
pwd
- 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
-
-
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
-
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
- 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.”
- 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.
- Use regrex mode (click the
- After that, I didn’t need to do any more cleaning up. Run more find/replace searches if necessary.
Step 6: Import into Obsidian
- Navigate to the Obsidian Vault in Finder. Create a new folder “TiddlyWiki Import”.
- 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.
- 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