Export pages using Roam42

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
  • Markdown
  • HTML

To pull up the converter function, click the Roam42 icon in the top right corner (Roam42 menu button) and select the Converter function from the menu:

Roam42 converter menu option

Alternatively, use the keyboard shortcut Option-m (macOS)/Alt-m (Windows) to directly pull up the converter function.

Let’s have a look at each of the output formats:

Roam42 converter output formats picklist

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.

Roam42 format converter - text with spaces
Click image to enlarge

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.

Roam42 format converter - text with tabs
Click image to enlarge

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.

Roam42 format converter - flat text
Click image to enlarge

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).

Roam42 format converter - Markdown
Click image to enlarge

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).

Roam42 format converter - Markdown flattened
Click image to enlarge

HTML

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).

Roam42 format converter - HTML
Click image to enlarge

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 (-).

Roam42 format converter - HTML flat
Click image to enlarge

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 (…):

Import files menu option

After selecting the file on your drive and uploading it, you get the following confirmation screen:

Import PDF & DOCX SmartBlocks

Now, click the Import files button 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:

PDF & DOCS export instructions

Follow the instructions, then enable the plugin by clicking the Roam JavaScript activation button button.

Trigger the export script by either typing jjpdf or 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:

Export PDF save file prompt

Tags: , , , ,

Was this helpful?