For years at the office, I have been using a simple directory with markdown files for my notes. I stored these notes in a git repository, so I have a backup and my colleagues could see my notes. It works really well for me.

Testing Joplin

Recently we started investigating Joplin to use as our company wide notes app. So I downloaded Joplin as a portable app. A portable app makes testing it easy, without polluting my system during the test.

One of the first things a did was importing the directory with my notes. After importing my notes, I noticed that the new notes all have the filename as the title. Not exactly what I had hoped for.

It turns out that the name of the note needs to be in a title tag in the front matter. I always have used tags in front matter to those notes, but never had any need to add a title tag. But the fast majority of my notes did have a H1 with the title of the note. There is no way to do anything with this header during the import. So I was looking for an quick way to add a title tag based on the first H1 line in the file.

Scripting the solution

I search a bit but couldn’t find a ready made solution. Therefore I decided to write a simple bash script to fix this.

It searches in all the markdown file for a H1 header. If that is found, the title is written as the second line in the file. Because I wrote the script to solve my personal need there is no error checking, like is there front matter or is the first line ---.

Only a very small number of files needed the changes made by the script edited or reverted. All in all, it worked great for me.

# Go through all the markdown files
for file in $(find . -name \*.md)
do

  # Get the title from the first H1
  title=$(grep "^#\ " "$file" | head -n 1 | colrm 1 2)

  # Was a header found?
  if [[ -n $title ]]
  then

    # Put the header in the title tag
    echo "---" > file.tmp
    echo "title: $title" >> file.tmp
    tail -n +2 "$file" >> file.tmp
    mv file.tmp $file

  fi

done

Using Joplin

At this moment, for me the benefits of Joplin over the directory with markdown files are limited. Maybe after using it a while the benefits will become more. But there is no reason not to switch to Joplin. After tweaking the settings a bit it works quite the same as using a directory with markdown files.

Importing OneNote notes

For most users at our company Joplin is a real improvement. Some have their notes in OneNote, some on paper. Finding a solution to import OneNote notes was quite the task.

The Joplin docs say you need to visit OneNote Web. But that only works for OneNote with a personal Microsoft account, not for business accounts.

The OneNote desktop app can store the notes in a .one or .onepkg file, but the importer of Joplin is not able handle those files directly. The zip-export of personal notes contains files in .one format for each section in OneNote, together with a toc-file. So there is code to import .one file, why is it not offer separately?

From my tests I find the entire OneNote import is a bit limited. The .one files in the zip-export are converted to html files. Within Joplin you can convert the html to markdown.

Luckily there is the OneNote to Markdown exporter. A console app, written in .NET, that can export OneNote notebooks to a set of markdown files with front matter. It requires that the desktop app is running because it uses the OneNote Office Integration. Just run the console app, answer a few basic questions and a set of directories is created ready to be imported into Joplin.

This is the best available option at this moment to get your notes from OneNote to Joplin.