Please note that this is an ongoing project so I will edit and add to this post as I go along.
Zettelkastens are for life, well at least an academic or research life, that might span 30 or 40 years. So traditionally, Digital Zetterlkastens were written using simple and long standing programming file types, such as .txt, .rtf and .md, that ensured a certain level of redundancy.
Zkn3 is no different and it is designed so that you can export the Notes and the data they contain in several different file types including the commonly used Markdown (.md). This is the most basic form of web page language and is converted into HTML to make working websites and it has been around since 2002. However this is computing so nothing is ever simple or straightforward and there are several different variants of Markdown.
Now every so often, I do some Doomsday planning for when Zkn3 no longer works and I download a copy of my Zettelkasten as Markdown files and ‘attempt’ to upload them to other Zettelkasten type programmes. The ones I have chosen are Obsidian and Zettlr which are note taking apps which work in Markdown. But mainly I chose them because they are a) FREE b) have a large, vocal community c) are data agnostic, d) converts to other popular Zetterlkasten programmes such as Roam, Tiddywink, Notion, Trello, etc. So if I can get Zkn3 into Obsidian and Zettlr there’s a good chance I can get it across to other programmes too.
Migrating to Obsidian
Luckily, there is already a Support Forum Thread called Migrating from Zkn3 to Obsidian without losing your tags and internal links. But, it only relates to Mac and Linux, so the aim of this section is to reproduce the methodology for Windows and the less computer literate historians.
Step 1: Arming yourself with some tools
For Windows 11 users, this is my suggestion. (Obviously for Mac and Linux users follow the Obsidian Knowledge Base Thread above.) These two programmes should be sufficient for you to convert Zkn3 Markdown files into standard Markdown files that can the be uploaded into various programmes and retain their Notes, Links and Keywords.
Download Bulk Rename Utility for here and install
Download Notepad++ from here and install
Step 2: Converting Zkn3 syntax to Markdown syntax within Zkn3
There is a lot of tidying up that you can do quite simply within Zkn3 itself just using the Replace (Ctrl+R) command. I have put this explanation on a separate page so that I can more fully discuss Markdown and its links with Zkn3. Read here about what you can do to tidy up your files before migration.
For instance: Converting Keywords
Zkn3 Keywords look like this: apples and pears
but in Markdown they needs to be: #apples-and-pears
This is done in Zkn3 which is easy. Go to the top Menu Bar and select Find - Replace (Ctrl+R). Type a ‘space’ into the Find for: box and then type a hypen ‘-’ into the Replace with box and check just the Keywords tick box below. This will replace all the spaces in your Keywords with a hyphen in one go.
Then repeat and replace the invisible ‘^’ symbol with a hash tag ‘#’ and this will convert all the keywords at once, in my case 825 of them. Job done.
Step 3: Exporting from Zkn3 to Markdown
We did ‘exporting’ this earlier in post No.3 and this uses the same technique only selecting the Markdown format rather than the .zkx3 file format. So, first create a folder in your Zettelkasten Box folder called Markdown Archive or something similar. Then select from the Menu Bar: File - Export and set it up as below:
Export the files to a Markdown Archive by pressing ‘Finish’ and the files will be created in the folder with the same number of files as you have Notes in your Zettelkasten.
If you open one of these Markdown files you will see the Note Information laid out like this. This Note (no.4) has an entry for every box and insertion type, links to a website, link to another Note, a Table, Remarks, Link to Authors, Keywords, an Attachment and a Cross Reference.
The problem when uploading the Zkn3 Markdown files to Obsidian is that they appear as a collection of unrelated single Notes with no Note Sequences or internal Note linkages. This is because Obsidian uses wiki links to do this. However we can convert all these Zkn3 links into wikilinks that Markdown programmes can recognise.
Step 4: Renaming the markdown files
I am not going to use the original suggestion of the author of the Obsidian Migration as I think we can do it in a simpler way. Remember that our Markdown files are downloaded in the format Note number, space, Note title with hyphens and we need to get to just a Note number, i.e. removing the space and everthing after it.
Open Bulk Rename Utility and navigate to the folder containing the Markdown files you want to rename
Select the individual Markdown files you want to rename in that folder
In Box 13 select a new folder to put the results and check the 'Copy' tick box
In the “Remove (5)” section select the tickbox
In the drop down menu beside Crop select ‘After’ and enter a ‘space’ in the text box in the right to remove everything after the space following the number
Preview the changes in the right pane to ensure they look correct
Select “Rename” to apply the changes. The files should now look like 1234 .md
The next step is to remove the space after the number and before the file type .md
Repeat this process only putting a space in the Char box and leave the Crop box unchanged.
Preview and Rename.
It should look like this:
Step 5 Creating Wiki Links within the Markdown files
Remember to back up the Markdown files that you have just renamed so that you can retrace your steps when it all goes wrong.
The author of the Obsidian thread obviously uses a lot of internal links within his Notes. These are created when editing a Note when you select Insert - Crossreference and it inserts the following into the text box [z 1]Link to another note[\z]
However Markdown does not recognise this as a link and so just treats it as text. In order for this to work it has to be converted to [[1]]Link to another note as the double [[ is used as a special character. So we will use Notepad++ to bulk convert these links across all the Markdown files in your Markdown Archive file.
Open Notepad++
On the top Menu Bar select File - Open Folder as Workspace
Click on a Note in the window on the left to see contents on the main screen
On the top Menu Bar select Search - Replace (Ctrl+H)
Select 'Find in Files' tab
Select tick box 'Follow current document'
Select Directory of folder with Markdown files
Select tick box 'In all sub-folders'
In filters text box enter *.md* to restrict changes to just Markdown files
Enter these expression into Find and Replace boxes (copy and paste is easiest)
Find: \[z ([0-9]+)\](.*?)\[/z\]
Replace: [[${1}]]${2}
Select the ‘Regular Expression’ radio button at bottom
Press 'Find Files'
When you are happy with the results Press 'Replace in files'
Keep repeating the Find/Replace sequence until the results equal zero to capture all instances
Check a couple of Notes and you should see that ones with internal links [z 123]…. will have changed to [[123]]
Step 6 Converting Note Sequences and CRoss References into Wikilinks
Zkn3 automatically provides different linkages for different types of connections so that you build Folgezettel and structure into your zettelkasten. Obsidian is simpler and just provides Wiki Links between Notes. There are some work around (discussions here and here), you can use plug-ins such as Breacrumbs and Jggl to help. You can create an Index Note and then provide links to all its children and parents but essentially they are all just simple links.
Aside: If you want to read more about the concept of Folgezettel see this blog post by Daniel.
So, if we are to fully translate Zkn3 into Obsidian, we need a way to convert all these myriad Zkn3 links int the format [z]Note title[/z] into Wiki Links in the format [[327]] Note title.
Both these sections can be converted in the same manner, so will be dealt with together. The layout of the section is as follows:
## Cross references
(blank line)
123, 745, 2020, 347
with the links to the Notes expressed as a series of numbers, seperated by a space and a comma with the last number having no comma. Note Sequences are laid out exactly the same only with the itle changed. To change these to Wiki Links, we need to remove the commas and then surround the numbers with double brackets [[123]]. This will have to be done step by step rather than in one go.
So using the Find & Replace technique which we used in Step 5 but using the different search and replace terms. This will replace one number on each line in every file per run and so will have to be run repeated times until there is no further results. Set up the Replace (Ctrl+H) as before except with these expressions:
Find: (## (?:Cross references|Note sequences)\s\n\s\n.*?)( )?(\d+)(?:,|$)
Replace: \1\2[[\3]]
As before, use the Find next button to check that the results are as you want and then press the Replace All button to change the files. Repeat until it shows 0 changes in the bottom ;eft hand corner of the Replace screen.
Thanks to msteffens of the Zettelkasten forum for working out the expressions (see Zettelkasten.de for our discussion)
At this point, the amended files should be ready to be uploaded to another Zettelkasten style Markdown programme, in this test case I used Obsidian, and as you can see below, rather than being individual Notes, the amended ones now show all the linkages between them. The large circles are Index Notes which link to lots of other Notes on their topic and to other Index Notes to aid navigation around the Zettelkasten.
Converting for Zettlr
Zettlr is another popular markdown editor which can be used as a Zettelkasten. In essence, everything that you do for Obsidian above should work with Zettlr.