Skip to content

Convert an org-roam notes collection to markdown for Obsidian

Notifications You must be signed in to change notification settings

goshatch/orgroam_to_obsidian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convert org-roam files to Obsidian-ready markdown

This is a Ruby script that help converting a collection of notes created with org-roam to a bunch of Markdown files suitable for being imported into an Obsidian vault.

I hacked this together in a couple of evenings because I wanted to see if it made sense to start using Obsidian instead of Emacs for my note library.

Requirements

Running the conversion

Preparation

$ cp ~/.emacs.d/.local/cache/org-roam.db input/
$ cp -R ~/org-roam input/

The locations of org-roam.db and the roam directory above are provided as examples only. You can find the actual locations on your system by inspecting these variables in Emacs:

  • org-roam-db-location
  • org-roam-directory

Make sure to COPY these to your input directory, so that you have a backup in case things go wrong.

Next, you can either run it locally (you'll need Ruby and Pandoc) or via Docker.

Locally

$ git clone https://github.com/goshatch/orgroam_to_obsidian
$ cd orgroam_to_obsidian
$ bundle install
$ ./convert.rb

Specifying the root org-roam directory

The script needs to know your root org-roam directory in order to correctly figure out the file names for each note. By default, it will use the org-roam default, which is ~/org-roam. If you have changed this, get the value from emacs by inspecting the org-roam-directory variable, and pass it to the script with a command line flag:

$ ./convert.rb --roam-root "~/org/roam"

Docker

$ docker build -f $PWD/Dockerfile -t orgroam_to_obsidian:0.0.1 .
$ docker run -it --rm -v $PWD:/opt/orgroam-to-obsidian orgroam_to_obsidian:0.0.1 

After the conversion is complete, the generated markdown files will be under the output directory.

Help and contributing

If you need any help with this, please feel free to reach out to me on Mastodon, or to submit an issue to the repository.

If you encounter an issue, please run the script with the --debug flag for additional debug info, and include this in the issue.

Pull requests with improvements are very welcome.