-
Notifications
You must be signed in to change notification settings - Fork 2
Examples
Brett Terpstra edited this page Dec 6, 2025
·
1 revision
Practical examples of using Apex for common tasks.
apex document.md > output.htmlecho "# Hello World" | apexGenerate a complete blog post with custom styling:
apex post.md \
--standalone \
--title "My Blog Post" \
--style blog.css \
--pretty \
-o post.htmlCreate documentation with table of contents:
<!--TOC-->
# Introduction
...
# Getting Started
...
# API Reference
...apex docs.md --standalone --title "Documentation" --prettyConvert README for GitHub preview:
apex README.md --mode gfm --pretty > README.htmlDraft with changes:
# Document
This is {++new text++} and {--old text--}.
{~~old~>new~~} substitution.Review mode (show all changes):
apex draft.md > review.htmlAccept all changes (final version):
apex draft.md --accept > final.htmlReject all changes (original):
apex draft.md --reject > original.htmlUsing wiki links and relaxed tables:
# Wiki Documentation
See [[Getting Started]] for details.
## Data Table
one | two | three
1 | 2 | 3
4 | 5 | 6apex wiki.md --mode unified --prettyDocument with mathematical equations:
# Math Examples
Inline: $E = mc^2$
Display:
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$apex math.md --standalone --title "Math Examples"Using metadata and variables:
---
title: Report
author: John Doe
date: 2025-12-06
---
# [%title]
By [%author] on [%date]
Content here...apex report.md --mode mmd --standaloneWith IAL attributes and relaxed tables:
# Header {: #custom-id .class}
one | two
1 | 2apex doc.md --mode kramdown --pretty#include <apex/apex.h>
#include <stdio.h>
#include <string.h>
int main() {
const char *markdown =
"# Hello\n\n"
"This is **bold** and a [[WikiLink]].\n\n"
"Math: $E = mc^2$\n";
apex_options opts = apex_options_default();
opts.pretty = true;
char *html = apex_markdown_to_html(markdown, strlen(markdown), &opts);
if (html) {
printf("%s\n", html);
apex_free_string(html);
return 0;
}
return 1;
}#import "NSString+Apex.h"
- (NSString *)convertMarkdownToHTML:(NSString *)markdown {
return [NSString convertWithApex:markdown];
}
- (NSString *)convertWithGFM:(NSString *)markdown {
return [NSString convertWithApex:markdown mode:@"gfm"];
}Process multiple files:
for file in *.md; do
apex "$file" -o "${file%.md}.html"
doneCombine with other tools:
# Preprocess with sed, then convert
sed 's/OLD/NEW/g' input.md | apex > output.html
# Convert and post-process
apex input.md | sed 's/<h1>/<h1 class="title">/g' > output.html- Usage - More usage patterns
- Syntax - Syntax examples
- Command Line Options - All available options
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
- Modes - Understanding processor modes
- Command Line Options - All CLI flags explained
- Header IDs - How header IDs are generated
- C API - Programmatic API documentation
- Xcode Integration - Using Apex in Xcode projects
- Examples - Practical usage examples
- Troubleshooting - Common issues and solutions
- Credits - Acknowledgments and links to related projects