QuickLook Preview

QuickLook Preview (macOS)

mbr includes a QuickLook extension for macOS, allowing you to preview markdown - and plain text files - directly in Finder.

What is QuickLook?

QuickLook is a macOS feature that provides instant file previews. Press Space on any file in Finder to see its contents without opening an application.

With mbr’s QuickLook extension, markdown files render as formatted HTML instead of plain text.

Features

Plain Text Previews

The extension previews plain text as well as markdown. Which path a file takes is decided by its extension:

FileRendered as
.md, .markdown, .mkd, .mkdn, .mdown, .mdwn, .mdtxt, .mdtext, .mdocFull markdown
Anything listed in your markdown_extensions configFull markdown
A source file mbr ships a grammar for (.rs, .py, .json, .ts, .go, .rb, .sh, .nix, .sql, .yaml, .css, .xml, …)Verbatim, syntax highlighted
Everything else (.txt, .log, unknown extensions, files with no extension)Verbatim, monospace

Verbatim means verbatim: whitespace, tabs and every literal character are preserved exactly, and markdown syntax in a .txt file stays as typed rather than being parsed. Long lines scroll horizontally instead of wrapping, so what you see matches what is on disk.

Markdown extensions are the union of the built-in list above and your markdown_extensions setting. The built-in list is always honored, so a .mkdn file previews as markdown even in a repository whose config only publishes .md.

Limits

Previews are meant to be instant, so two caps apply:

CapValueEffect
Bytes read1 MBLonger files are cut off and the preview says “Preview truncated at 1024 KB”
Bytes highlighted256 KBLarger files still render, just without syntax highlighting

Files that are not valid UTF-8 (a latin-1 log, say) are decoded leniently: undecodable bytes become the Unicode replacement character rather than failing the preview. Empty files produce an empty preview.

File Types mbr Registers For

Installing MBR.app registers these claims with macOS Launch Services:

ClaimRankConsequence
Markdown (net.daringfireball.markdown, plus the nine extensions above)Defaultmbr becomes the default app for markdown files, replacing your previous default
Plain text (public.plain-text)Alternatembr appears under “Open With” for text files but does not displace your text editor

Both are registered as a Viewer, never an Editor: mbr renders the file it is given and never claims the ability to edit it in place.

If you would rather keep your existing markdown app as the default, change it back in Finder: select a markdown file, Get Info (Cmd+I), pick your app under “Open with”, and click Change All. That user choice outranks any app’s declared handler rank.

macOS itself declares no markdown type, so MBR.app also carries a UTImportedTypeDeclarations entry for net.daringfireball.markdown. Without it, .md files would resolve to an anonymous dynamic type and no UTI-based claim - including the QuickLook one - could match.

public.plain-text is a supertype, so the plain-text claim is broader than .txt: source code conforms to it, which brings in roughly ninety extensions (.c, .py, .rb, .sh, .swift, .js, .java, …) plus .log, .csv and .tsv. It does not cover .json, .yaml, .css, .html or .xml (which conform to public.text directly rather than to public.plain-text), nor extensions macOS declares no type for at all, such as .rs, .toml and .nix. Those files still preview correctly when opened through mbr; they just do not route to mbr automatically from Finder.

Installation

The QuickLook extension is bundled with the macOS app.

Automatic Registration

  1. Download and install MBR.app
  2. Launch the app once
  3. The extension registers automatically

Manual Registration

If the extension doesn’t appear:

# List registered QuickLook preview extensions
pluginkit -mv -p com.apple.quicklook.preview | grep mbr

# Reload QuickLook
qlmanage -r
qlmanage -r cache

Do not use qlmanage -m plugins to check for mbr. That command lists only the legacy .qlgenerator bundles under /System/Library/QuickLook; it shows no modern app extension at all, so it prints nothing for mbr — or for Apparency, Fantastical or any other working .appex — whether or not the extension is installed and working. pluginkit is the only tool that sees app extensions.

The extension registers with the system when the containing app is launched from a real install location. Launching MBR.app out of /nix/store, a build output directory, or a disk image does not register it: macOS only tracks extensions for apps under /Applications (or ~/Applications). Move the app first, then launch it once.

Verify Installation

  1. Open Finder
  2. Navigate to a folder with .md files
  3. Select a markdown file
  4. Press Space

You should see rendered markdown instead of plain text.

How It Works

flowchart LR
    FINDER[Finder] --> QL[QuickLook System]
    QL --> EXT[mbr Extension]
    EXT --> PARSE[Parse Markdown]
    PARSE --> RENDER[Render HTML]
    RENDER --> PREVIEW[Preview Window]

The extension:

  1. Receives the file path from QuickLook
  2. Searches upward for .mbr/ configuration folder
  3. Parses markdown with full extension support
  4. Renders HTML with inlined CSS/JS (self-contained)
  5. Attaches the local files the page references (images, video, PDFs)
  6. Returns the preview to Finder

Configuration

The QuickLook extension respects your repository’s .mbr/ configuration:

Custom Theme

Your theme.css applies to QuickLook previews:

/* .mbr/theme.css */
:root {
  --pico-primary: #8B5CF6;
}

Custom User Styles

Additional styles from user.css are included:

/* .mbr/user.css */
h1 { border-bottom: 2px solid var(--pico-primary); }

Differences from Full App

The QuickLook preview is simplified compared to the full mbr experience:

FeatureQuickLookFull App
Markdown renderingYesYes
Syntax highlightingYesYes
Mermaid diagramsYesYes
NavigationNoYes
SearchNoYes
Live reloadNoYes
Link followingLimitedYes

Images and Other Local Assets

A QuickLook preview is a single self-contained document, so any local file it shows has to travel with it. Two consequences:

In QuickLook:

Troubleshooting

Extension Not Working

If markdown files show as plain text:

  1. Verify registration (+ means elected for use):

    pluginkit -mv -p com.apple.quicklook.preview | grep -i mbr
    

    Nothing listed? Launch MBR.app once from /Applications. See Manual Registration — and note that qlmanage -m plugins cannot answer this question.

  2. Reset QuickLook:

    qlmanage -r
    qlmanage -r cache
    
  3. Check the extension is not being rejected:

    log show --last 5m --info --debug | grep "mis-configured plugin"
    

    plug-ins must be sandboxed means the extension was signed without the com.apple.security.app-sandbox entitlement. PlugInKit refuses to load it and reports nothing to the user. Confirm the shipped bundle kept its entitlements:

    codesign -d --entitlements - /Applications/MBR.app/Contents/PlugIns/MBRPreview.appex
    
  4. Check for a crash:

    ls ~/Library/Logs/DiagnosticReports | grep MBRPreview
    

    If the extension crashes, QuickLook silently falls back to the system plain-text preview — the symptom is identical to not being installed.

  5. Check for conflicts: other extensions claiming public.plain-text (which markdown conforms to) may take precedence. List all of them with pluginkit -mv -p com.apple.quicklook.preview, and disable one with pluginkit -e ignore -i <identifier> (restore with -e default).

Text Files Preview With the System Renderer

For .txt and source files, mbr’s extension competes with the previewer built into macOS, and both claim public.plain-text. If you get Apple’s plain preview instead of mbr’s, confirm the extension is enabled in System Settings -> General -> Login Items & Extensions -> Quick Look, then reset the cache with qlmanage -r && qlmanage -r cache.

Wrong Default App for Markdown

Installing mbr makes it the default opener for markdown files. To hand that back to another app, select a markdown file in Finder, press Cmd+I, choose the app under “Open with”, and click Change All.

Slow Previews

Large files or complex diagrams may slow previews:

  1. Files over 1MB may take longer
  2. Many Mermaid diagrams add processing time
  3. External resources (if any) require network

Wrong Styling

If styles don’t match expectations:

  1. Verify .mbr/ folder is in parent directory
  2. Check CSS syntax in theme.css / user.css
  3. Reset QuickLook cache: qlmanage -r cache

Extension Disabled by macOS

If macOS disables the extension:

  1. Open System PreferencesPrivacy & Security
  2. Look for mbr in the security prompts
  3. Allow the extension to run

Removing the Extension

To uninstall the QuickLook extension:

The extension lives inside MBR.app and is not separately installable, so there is no standalone plugin file to delete — removing the app removes the extension. To keep the app but stop it previewing, either turn it off in System Settings → General → Login Items & Extensions → Quick Look, or:

# Find where it is registered
pluginkit -mv -p com.apple.quicklook.preview | grep mbr

# Stop macOS using it (reversible with -e default)
pluginkit -e ignore -i com.zmre.mbr.MBRPreview

# Reload QuickLook
qlmanage -r && qlmanage -r cache

Or simply delete MBR.app from Applications.