To follow this article, you need to have the Roam42 roam/js plugin installed.
Click here for instructions on how to install Roam42.
Export to text, Markdown, and HTML using the converter function
Out of the box, Roam42 offers the following formats to export pages to:
- Plain text
To pull up the converter function, click the Roam42 icon in the top right corner () and select the Converter function from the menu:
Alternatively, use the keyboard shortcut
Alt-m (Windows) to directly pull up the converter function.
Let’s have a look at each of the output formats:
Text with space indentation
When choosing this option, nested child blocks have two spaced in front of them. Many apps use preceding spaces to determine hierarchy.
Text with tab indentation
Similar to the option above, but with tabs instead of spaces, is the Text with tab indentation option. Again, many apps (like Roam) use preceding tabs to determine hierarchy between blocks/paragraphs.
Text with no indentation
If you want to strip the page of all hierarchy and have a plain text file with all blocks on the same level, choose this option.
GitHub Flavored Markdown
One of the most popular plain text formats that allows for simple markup is the Markdown format. The ‘GitHub Flavored’ variant is the de facto standard that’s supported but almost all Markdown app, like Obsidian, Ulysses, and many more. This option adds a dash to all nested child blocks, indicating a list (bullet).
Github Flavored Markdown – flatten
This option is similar to the one above, with the difference that child blocks appear on the same level as their parents and therefore don’t have the dash attached (indicating a list).
This option is similar to the Markdown export, with the exception that the markup of text is with HTML instead of Markdown. This format comes in handy when you want to paste the page into an HTML editor (for example a code editor or an online blog).
HTML after Markdown Flattening
This option first uses the
Markdown - flatten function (in the background) before converting it to HTML. Like the Markdown option, it ‘unnests’ all child blocks and strips them from their list attribute (-).
Export to PDF and DOCX using SmartBlocks
The community around Roam42 has created SmartBlocks that enable us to export pages to .pdf and .docx (Microsoft Word) formats. While still in development, you can download the test version here.
After downloading and extracting the .json file inside the .zip file, you have to import the .json file into Roam. To do this, choose the Import Files option from the menu (…):
After selecting the file on your drive and uploading it, you get the following confirmation screen:
Now, click the button and navigate the newly created PDF & DOCX Export page.
On the page containing the export to PDF and DOCX SmartBlock, you find instructions on how to configure the plugin:
Follow the instructions, then enable the plugin by clicking the button.
Trigger the export script by either typing
jjdocx in any block on the page and selecting the SmartBlock to run. After a few seconds, you get a prompt to save the file. Automatically, the name of the page is given to the file: