Skip to content

jacobio/tbx-markdown

Repository files navigation

An Enhanced Markdown Prototype for Tinderbox

Caution

This installer will replace/update the built-in Markdown prototype in your Tinderbox document. Any customizations you have made to the existing Markdown prototype may be overwritten.

A one-line installer that adds an enhanced Markdown writing environment to any Tinderbox document — with syntax highlighting, GitHub-styled preview, and HTML export. Includes Mermaid diagrams, MathJax math rendering, and Prism code highlighting out of the box.

If MultiMarkdown (mmd) is installed, the prototype uses it for HTML preview with sed post-processing fixes. Otherwise, it falls back to Tinderbox's built-in CommonMark parser.

Install

Option A: Download the Tinderbox File

Download install-tbx-markdown.tbx and open it in Tinderbox. It contains one note with the installer action code — just copy-and-paste into any Tinderbox to add the enhanced Markdown prototype.

Option B: Using a Stamp

Open any Tinderbox document, create a stamp with the following action code, and run it:

action(runCommand("curl -s https://raw.githubusercontent.com/jacobio/tbx-markdown/main/install.tbxc"));

All components are fetched from this repo at install time. Either method is safe to re-run.

What Gets Installed

Component Path Purpose
Prototypes /Prototypes/Markdown Markdown writing prototype with syntax highlighting and preview
/Prototypes/Code Code/asset export prototype (raw text, no HTML markup)
Highlighter /Hints/Highlighters/Markdown Syntax highlighting for headings, bold, italic, links, code, etc.
Templates /Templates/Text Only Plain text export (used by Code prototype)
/Templates/HTML MD and Children Full HTML page with Prism, MathJax, and Mermaid support
Assets /Assets/Custom Styles Your CSS overrides (edit to customize)
README /README (Markdown) In-document documentation

Mermaid, MathJax, and Prism

The HTML template includes CDN-loaded support for:

  • Mermaid — Diagrams and flowcharts. Use a fenced code block with the mermaid language tag. Automatically respects light/dark mode.
  • MathJax — Math rendering. Use \(...\) for inline math and \[...\] or $$...$$ for display math.
  • Prism — Syntax highlighting for code blocks. Use fenced code blocks with a language tag (e.g., ```javascript). Includes copy-to-clipboard and GitHub-themed light/dark styles.

These work in both Preview and HTML export with no additional setup.

MultiMarkdown Detection

The installer checks for mmd on your system by sourcing ~/.zprofile before running which mmd, with fallbacks to known Homebrew paths (/opt/homebrew/bin/mmd, /usr/local/bin/mmd) and system paths (/usr/bin/mmd). If found, it sets $HTMLPreviewCommand to pipe through mmd with sed post-processing that fixes links to internal and exported notes:

  • Leading slashes in href attributes
  • Spacing after closing anchor tags
  • Bold/italic formatting around links

If mmd is not found, the prototype uses Tinderbox's built-in "CommonMark" parser.

Prerequisites

Installing MultiMarkdown

MultiMarkdown can be installed via Homebrew:

brew install multimarkdown

After installing, verify it works:

mmd --version

If you install MultiMarkdown after running the installer, just re-run the stamp to update the prototype.

Repo Structure

tbx-markdown/
├── install-tbx-markdown.tbx # Tinderbox file with installer stamp
├── install.tbxc             # Main installer (fetched by the one-liner)
├── highlighters/
│   └── markdown.tbxc        # Syntax highlighter definitions
├── templates/
│   ├── html-md.html         # HTML page export template
│   └── html-md-item.html    # HTML child item template
├── assets/
│   └── custom-styles.css    # Custom CSS overrides
├── config/
│   └── sed-fixes.sh         # sed pipeline for mmd post-processing
├── readme-markdown.md       # In-document README (installed into Tinderbox)
└── LICENSE

Credits

License

MIT

About

A custom Markdown implementation for Tinderbox

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors