-
-
Notifications
You must be signed in to change notification settings - Fork 6
Using Apex with Jekyll
Note: This integration is untested. The documentation below serves as a placeholder until it has been tried on real Jekyll sites. If you try it, I'd love your feedback -- please open an issue or comment at ApexMarkdown/apex-ruby/issues.
You can use the apex gem as Jekyll's Markdown converter instead of Kramdown, without monkey-patching. Jekyll's converter system lets you register a custom converter and select it in _config.yml.
In your Jekyll project's Gemfile:
gem "apex-ruby"Then run:
bundle installEnsure cmark-gfm is installed on your system so the gem can build.
Create a file in your Jekyll _plugins directory (e.g. _plugins/apex_converter.rb):
# _plugins/apex_converter.rb
require "apex"
module Jekyll
class ApexConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ %r!^\.(markdown|md|mkd|mkdn)$!i
end
def output_ext(ext)
".html"
end
def convert(content)
# use mode: kramdown for Kramdown compatibility (limits functionality)
Apex::Document.markdown_to_html(content, mode: :unified)
end
end
endJekyll loads any .rb files in _plugins/. This converter runs for .markdown and .md (and the other matched extensions) and uses Apex with unified mode (covers Kramdown, CommonMark, and more syntax). Use mode: :kramdown for behavior closer to Kramdown.
Tell Jekyll to use this converter for Markdown:
markdown: ApexConverterUse the same name as your converter class. You do not need to reference or patch Kramdown; Jekyll will use your converter instead of the default.
To drive Apex options from _config.yml, read a config key in the converter:
def convert(content)
opts = @config["apex"] || {}
mode = (opts["mode"] || "kramdown").to_sym
Apex::Document.markdown_to_html(content, mode: mode, **opts.reject { |k, _| k == "mode" })
endThen in _config.yml:
markdown: ApexConverter
apex:
mode: kramdown
enable_tables: true
generate_header_ids: trueFeedback: This flow has not been validated on a full Jekyll site. If you try it, please share your experience or report issues at ApexMarkdown/apex-ruby/issues.
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
- Callouts - All supported callout formats and flag requirements
- Tables - Complete table syntax reference including rowspan, colspan, alignment, and captions
- Inline Attribute Lists - IALs and ALDs guide with examples
- Modes - Understanding processor modes
-
Quarto Mode - Pandoc/Quarto markdown (
--mode quarto) - Command Line Options - All CLI flags explained
-
Rendering Markdown in the Terminal - Terminal output formats (
-t terminal,-t terminal256),--width,--theme, and theming -
Generating Man Pages - Generate man pages from Markdown using
apex -t man -
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