A small script for converting any Notion pages that have been imported from Roam
(which uses the literal [[some category]]
or backlinks) to use the proper
Notion mentions, which use the @some category
notation. With this script, you
can have pretty much all of the benefits of Roam, but with all of the benefits
of Notion!
⚠️: This script requires Python v3.6 or greater (v3.6 has those juicy format strings)
[[...]]
values. For me, I simply added the integration to every top level Page in
my Notion workspace's lefthand navbar.cp .env.example .env
and replace the dummy Notion API key with the one you
created in step (1) above.python3 -m venv /path/to/virtualenvs/roam_2_notion && source //path/to/virtualenvs/roam_2_notion/bin/activate
python3 -m pip install -r requirements.txt
python main.py
./cursor_metadata.json
file. If you run the script again, it will pick
up where it left off. If you want to from the beginning, simply
rm ./cursor_metadata.json
and rerun the script.I originally had all of my personal notes in Roam Research, which uses the
[[some category]]
text to link to other pages. I decided to switch to Notion
because I liked its design, as well as the ability to make any page a public
webpage. So I exported all of my Roam Research notes into markdown files on my
local machine, and then imported these markdown files into Notion. However, the
re-import did not integrate 100% with Notion; specifically all of my Roam
backlinks were left as literal [[...]]
text values when really I wanted them
to be Notion's native backlinks (which use the @
prefix) To fix this, I would
have to manually update all of the (1000's!) of backlinks by hand, something I
wasn't prepared to do.
That's why this script exists. And if you have switched from Roam to Notion, you should be able to use this script as well
[[...]]
, and replace each of those literal [[...]]
text sections with a
@
mentionFor you math-types out there: you can think of Notion being a directed cyclic
graph, where each vertex is a block and each edge is a child block. Each vertex
gets colored if it has no [[...]]
text contained within it. This script
traverses the graph, coloring each vertex until each vertex has been covered.