Tinderbox Forum

Preview your Tinderbox notes using Marked – export code edition

Have you ever wished you could write in Tinderbox, and preview your notes using Marked? Now you can!

This document demonstrates how.

How to Use It

  1. Install Marked
  2. Create a note and assign it the Note prototype
  3. Check the $ExternalPreview box at the top of your note

When you change your note $Text, switch to a different tab and back to trigger a refresh.

If you close the Marked preview window, it won’t come back automatically. Quit Marked, and it should launch again in a moment.

Tinderbox Export Code

You can still use Tinderbox export code! Rich text just works. How cool is that?

You can ^include^ notes:

^include("include this")^

See? This note got included.

You can make smart lists:

*  smart lists are smart
*  smart lists are lists
  • smart lists are smart
  • smart lists are lists

Note Links

You can link between Tinderbox notes. The links will exist only in Tinderbox, so you can navigate quickly between notes. They won’t appear in the exported Markdown.

Markdown Formatting

You can use Markdown formatting in your notes:

> "Ain't life grand?" -[Bonnie & Clyde](https://getyarn.io/yarn-clip/2c54d716-79f3-44b6-8fc5-fada974f20d7)

“Ain’t life grand?” -Bonnie & Clyde


Some Markdown syntax conflicts with Tinderbox export code. For example, you might expect ##### This code to produce a Markdown header. However, that same syntax is used for smart lists. Check it out:

  1. I was expecting a header but got a list instead!

When this happens, you can use the ^value^ tag to bypass Tinderbox’s export parsing:

^value("##### Now this is a Markdown header!")^
Now this is a Markdown header!

Special Prototypes

You may have noticed some pre-loaded prototypes in this document. I created them to assist with my writing.

  • Note is a simple note – it renders its $Text directly, or its $Name if there is no $Text.
  • Section is a note that renders its $Name as a header, followed by its $Text. It intelligently renders its header level according to its depth in the outline.
  • Cut does not render as part of the exported markdown. It lets you keep a note in the Tinderbox outline without rendering it.
  • PAGE BREAK forces a page break when exporting from Marked to PDF.

All notes render their children. The rendering is done by the plain text template.


I like to write by composing chunks of text into larger structures. I want to see those structures in outline format, and control how they appear when they export.

These prototypes allow me to write in chunks of text, and arrange them into structures. I can represent a series of paragraphs with the Note prototype. If I want that chunk to render with a header, I assign it the Section prototype.

Refreshing Structured Notes

If you’re just working in a single note, you can trigger a Marked refresh by navigating away from the note and back to it. If, however, you are composing your note from a set of notes (either by using ^include^ or building up an outline), then changes to other notes won’t trigger a refresh. In those cases, you need to navigate to the parent note – the one that gets exported to Marked.

I do that by creating a new tab for the parent note, and then switching to it and switching back to the note I’m currently editing.

Under the Hood

You can find the main action code in Preview in Marked. The Note prototype has an edict to run it. The action code creates a temporary file and writes the note $Text to the file, then tells Marked to preview the temporary file if it’s not already previewing it.

(It seems as though Tinderbox doesn’t trigger an edict run when the $Text changes)

The action code uses lsof to determine whether the file is open, and Marked doesn’t release the file until it quits completely. This is why you have to quit Marked if you’ve closed the preview window.

Try it out: markdown-preview-power.tbx (107.2 KB)

1 Like