qlmarkdown_cli Reference Guide

Overview

qlmarkdown_cli is the command-line interface bundled with QLMarkdown, a macOS Quick Look plugin that renders Markdown files natively in Finder. The CLI converts .md files to formatted HTML directly from the terminal — useful for automation, batch processing, and scripting pipelines. It uses the same rendering engine as the QLMarkdown macOS app, so all extensions (emoji, math, syntax highlighting, tables) are accessible from the command line.


Installation

Step 1 — Install QLMarkdown via Homebrew:

brew install --cask qlmarkdown

Step 2 — Remove macOS quarantine (required for unsigned apps):

xattr -r -d com.apple.quarantine /Applications/QLMarkdown.app

Step 3 — Create a system-wide symlink:

sudo ln -s /Applications/QLMarkdown.app/Contents/Resources/qlmarkdown_cli /usr/local/bin/qlmarkdown_cli

After this, qlmarkdown_cli --help should work from any directory.

Verify Markdown content type recognition:

touch /tmp/test.md && mdls -name kMDItemContentType /tmp/test.md && rm /tmp/test.md
# Expected: kMDItemContentType = "net.daringfireball.markdown"

Basic Usage

qlmarkdown_cli [-o <file|dir>] [-v] <file> [..]
ArgumentDescription
<file>One or more .md source files to process
-o <file/dir>Output destination. A directory creates <source>.html inside it. The output file is always overwritten. Omit to print to stdout.
-vVerbose mode (only valid with -o)
-hShow help and exit

Quick Examples

# Print rendered HTML to terminal
qlmarkdown_cli README.md
 
# Save to a specific file
qlmarkdown_cli README.md -o output.html
 
# Batch convert all .md files into ./html/
qlmarkdown_cli -o ./html/ *.md

Rendering Options

These flags override the QLMarkdown app settings. Unspecified options fall back to the GUI app configuration.

FlagValuesDescription
--footnoteson/offParse Markdown footnote syntax
--hard-breakon/offRender soft breaks as hard <br> line breaks
--no-soft-breakon/offRender soft breaks as spaces
--raw-htmlon/offAllow raw HTML and unsafe links
--smart-quoteson/offConvert straight quotes to curly quotes
--validate-utf8on/offValidate UTF-8 encoding before parsing
--codeon/offShow raw plain text instead of rendered HTML
--appearancelight/darkForce light or dark theme in output
--abouton/offShow/hide a QLMarkdown footer in the output
--debugon/offInject debug information into the HTML output

Extensions

ExtensionValuesDescription
--autolinkon/offAuto-convert bare URLs and emails to clickable links
--emojiimage/font/offRender :shortcodes: as image or font emoji
--github-mentionson/offConvert @username to a GitHub profile link
--heads-anchoron/offAdd anchor links to all headings
--highlighton/offHighlight text wrapped in ==double equals==
--inline-imageson/offEmbed images as Base64 directly in the HTML
--mathon/offRender LaTeX math expressions
--tableon/offEnable GFM pipe tables
--tag-filteron/offStrip dangerous HTML tags like <script>
--taskliston/offRender - [ ] / - [x] as checkboxes
--strikethroughsingle/double/offUse single or double tilde for strikethrough
--syntax-highlighton/offSyntax-color content inside fenced code blocks
--subon/offFormat ~subscript~ text
--supon/offFormat ^superscript^ text
--yamlrmd/qmd/all/offRender YAML front matter header

Common Workflows

Full-featured single file export:

qlmarkdown_cli --table on --syntax-highlight on --emoji image --math on README.md -o README.html

Safe batch export (strip dangerous HTML, embed images):

qlmarkdown_cli --tag-filter on --inline-images on -o ./export/ docs/*.md

Dark-themed output for a personal site:

qlmarkdown_cli --appearance dark --heads-anchor on -o site/ *.md

Key Notes

  • When processing multiple files, -o must point to a directory, not a single file.
  • The sudo symlink step is required because /usr/local/bin is root-owned on macOS with SIP enabled.
  • --inline-images produces a fully self-contained HTML file with no external image dependencies.
  • All unspecified rendering options inherit from the QLMarkdown GUI app preferences — configure your defaults there.