2022-01-20 2 min

I have taken advantage of the Christmas holidays to create a new ruby gem: notion_to_md.

Essentially, notion_to_md exports any notion page to a markdown format.

While building the website/blog of a colleague in Jekyll, I was thinking if there was an easy way to edit blog articles without messing with the markdown format. I found some interesting solutions like cloudcannon. cloudcannon allows editing blog posts online —and any other kind of content— but for a personal website, it is a bit expensive.

And then one day, I realized that notion has an API that allows managing your own content.

I looked for an existing gem that did the download and conversion but unfortunately, there was nothing in ruby that I could integrate easily. But I stumbled upon a library built with python: notion2md.

I was tented to use it within ruby. You know, execute the command in another process and store the output. Anyway, after having a look at the code base, the code seemed not too complicated. So, I rolled up my sleeves and ported the program to ruby in less than 3 days.

There are still plenty of things to do (coherent code-splitting, better logging, binaries, save in file), but it is functional as it is. Check it here.

The next step, build the Jekyll plugin.

Before ending this post, I’d like to give the credit to the guys who built the lib in python. They inspired this gem with their straightforward approach.

Feel free to use the gem. I’m open to suggestions and improvements.

See you soon!