Skip to content

Command Line Options

Brett Terpstra edited this page Dec 6, 2025 · 1 revision

Command Line Options

Complete reference for all Apex command-line flags.

Basic Options

-h, --help

Display help message and exit.

apex --help

-v, --version

Display version information and exit.

apex --version

-m, --mode MODE

Set processor mode. See Modes for details.

Values:

  • commonmark - Pure CommonMark specification
  • gfm - GitHub Flavored Markdown
  • mmd or multimarkdown - MultiMarkdown compatibility
  • kramdown - Kramdown compatibility
  • unified - All features enabled (default)

Example:

apex --mode gfm document.md

-o, --output FILE

Write output to a file instead of stdout.

apex document.md -o output.html

Output Options

-s, --standalone

Generate a complete HTML document with <html>, <head>, and <body> tags.

apex document.md --standalone

--style FILE

Link to a CSS file in the document head. Requires --standalone.

apex document.md --standalone --style styles.css

--title TITLE

Set the document title. Requires --standalone. Default is "Document".

apex document.md --standalone --title "My Document"

--pretty

Pretty-print HTML with indentation and whitespace.

apex document.md --pretty

Header ID Options

--id-format FORMAT

Set header ID generation format. See Header IDs for details.

Values:

  • gfm - GitHub Flavored Markdown format (default)
  • mmd - MultiMarkdown format
  • kramdown - Kramdown format

Note: Modes automatically set the format. This option is useful to override in unified mode.

apex document.md --id-format mmd

--no-ids

Disable automatic header ID generation.

apex document.md --no-ids

--header-anchors

Generate <a> anchor tags instead of id attributes on headers.

apex document.md --header-anchors

Output:

<!-- Default -->
<h1 id="my-header">My Header</h1>

<!-- With --header-anchors -->
<h1><a id="my-header" href="#my-header">My Header</a></h1>

Table Options

--relaxed-tables

Enable relaxed table parsing (tables without separator rows). Default in unified and kramdown modes.

apex document.md --relaxed-tables

--no-relaxed-tables

Disable relaxed table parsing.

apex document.md --no-relaxed-tables

--no-tables

Disable table support entirely.

apex document.md --no-tables

Feature Flags

--no-footnotes

Disable footnote support.

apex document.md --no-footnotes

--no-smart

Disable smart typography (smart quotes, dashes, ellipsis).

apex document.md --no-smart

--no-math

Disable math support.

apex document.md --no-math

--enable-includes

Enable file inclusion features.

apex document.md --enable-includes

--hardbreaks

Treat newlines as hard breaks (GFM style). Newlines become <br> tags.

apex document.md --hardbreaks

Critic Markup Options

--accept

Accept all Critic Markup changes. Applies all additions, removes all deletions, keeps substitutions.

apex document.md --accept

Behavior:

  • {++add++}add (kept)
  • {--del--} → (removed)
  • {~~old~>new~~}new (kept)
  • {==mark==}mark (markup removed)
  • {>>comment<<} → (removed)

--reject

Reject all Critic Markup changes. Reverts all changes, keeps original text.

apex document.md --reject

Behavior:

  • {++add++} → (removed)
  • {--del--}del (kept)
  • {~~old~>new~~}old (kept)
  • {==mark==}mark (markup removed)
  • {>>comment<<} → (removed)

Input/Output

Reading from stdin

If no file is specified, Apex reads from stdin:

echo "# Hello" | apex
cat document.md | apex > output.html

Writing to stdout

By default, Apex writes to stdout. Use -o or > to redirect:

apex document.md > output.html
apex document.md -o output.html

Combining Options

You can combine multiple options:

# Standalone document with custom title and stylesheet, pretty-printed
apex document.md --standalone --title "Report" --style report.css --pretty

# GFM mode with no header IDs
apex --mode gfm --no-ids document.md

# Unified mode with MMD-style header IDs
apex --mode unified --id-format mmd document.md

Option Precedence

Options are processed in order. Later options override earlier ones:

# This will use GFM mode (unified is default, but --mode gfm overrides)
apex document.md --mode unified --mode gfm

Examples

Blog Post

apex post.md --standalone --title "My Blog Post" --style blog.css --pretty -o post.html

GitHub-Compatible Output

apex README.md --mode gfm --pretty > README.html

Documentation with Custom IDs

apex docs.md --standalone --title "Documentation" --id-format mmd --pretty

Review Document with Critic Markup

# Show all changes
apex draft.md

# Apply all changes (final version)
apex draft.md --accept

# Revert all changes (original version)
apex draft.md --reject

Related

  • Modes - How modes affect available options
  • Header IDs - Header ID generation options
  • Usage - Basic usage examples

Quick Links

Clone this wiki locally