-
-
Notifications
You must be signed in to change notification settings - Fork 5
Usage
This page covers basic usage patterns for Apex.
Convert a Markdown file to HTML:
apex input.md > output.htmlcat document.md | apex > output.htmlOr:
echo "# Hello" | apexFor cleaning up Markdown before processing, you can pipe through md-fixup:
md-fixup input.md | apex > output.htmlmd-fixup can fix common Markdown issues and apply search-and-replace transformations before Apex processes the document.
apex input.md -o output.htmlSpecify a processor mode with --mode:
# Unified mode (default - all features)
apex document.md
# GFM mode
apex --mode gfm document.md
# Kramdown mode
apex --mode kramdown document.md
# MultiMarkdown mode
apex --mode mmd document.md
# CommonMark mode
apex --mode commonmark document.mdSee Modes for details on what each mode supports.
Generate a complete HTML document with <html>, <head>, and <body> tags:
apex document.md --standaloneapex document.md --standalone --title "My Document"apex document.md --standalone --style styles.css --title "My Document"Format HTML with indentation and whitespace:
apex document.md --prettyBy default, Apex generates header IDs automatically using GFM rules:
# My HeaderBecomes:
<h1 id="my-header">My Header</h1># GFM format (default)
apex document.md --id-format gfm
# MultiMarkdown format
apex document.md --id-format mmd
# Kramdown format
apex document.md --id-format kramdownapex document.md --no-idsGenerate <a> anchor tags instead of id attributes:
apex document.md --header-anchorsSee Header IDs for complete details.
| Header 1 | Header 2 |
| -------- | -------- |
| Cell 1 | Cell 2 |In unified and kramdown modes, relaxed tables are enabled by default:
one | two
1 | 2No separator row required! To disable:
apex document.md --no-relaxed-tablesShow all changes with HTML markup:
apex document.mdApply all additions, remove all deletions:
apex document.md --acceptRevert all changes, keep original text:
apex document.md --rejectDisable specific features:
# Disable tables
apex document.md --no-tables
# Disable footnotes
apex document.md --no-footnotes
# Disable smart typography
apex document.md --no-smart
# Disable math
apex document.md --no-mathApex settings can be controlled from three places:
- Per-document metadata (YAML/MultiMarkdown/Pandoc front matter in the document itself)
- External metadata files passed with
--meta-file - A global configuration file at
$XDG_CONFIG_HOME/apex/config.yml(or~/.config/apex/config.ymlwhenXDG_CONFIG_HOMEis not set)
If you do not pass --meta-file, Apex will automatically load config.yml from the XDG or ~/.config path when it exists, as if you had passed it via --meta-file. See Configuration for a complete list of available keys, example config files, and details on precedence between config files, document metadata, and command-line flags.
apex post.md --standalone --title "My Blog Post" --style blog.css > post.htmlapex document.md --pretty --standalone --title "Documentation" > docs.htmlapex --mode gfm document.md > output.htmlFor using Apex in your own applications, see the C API documentation.
For Xcode integration, see Xcode Integration.
Copyright 2025 Brett Terpstra, All Rights Reserved | MIT License
- Getting Started - Your first steps with Apex
- Installation - How to build and install Apex
- Usage - Basic usage examples
- Syntax - Complete syntax reference for unified mode
- Tables - Complete table syntax reference including rowspan, colspan, alignment, and captions
- Inline Attribute Lists - IALs and ALDs guide with examples
- Modes - Understanding processor modes
- Command Line Options - All CLI flags explained
-
Multi-file Documents - Combining multiple files with
--combine,--mmd-merge, and includes - Citations - Citations and bibliography guide
- Indices - Index generation with mmark and TextIndex syntax
-
Metadata Transforms - Transform metadata values with
[%key:transform] - Integrating with Pandoc - Use Apex with Pandoc for DOCX, PDF, and more
- Using Apex with Jekyll - Use the apex-ruby gem as Jekyll’s Markdown converter (untested; feedback welcome)
- Header IDs - How header IDs are generated
- C API - Programmatic API documentation
- Writing Tests - How to add tests for new features
- Xcode Integration - Using Apex in Xcode projects
- Examples - Practical usage examples
- Plugins - Plugin system, examples, and recipes
- Filters - AST filters (Pandoc-style JSON), examples, and usage
- Troubleshooting - Common issues and solutions
- Credits - Acknowledgments and links to related projects