This repository defines the public filter directory for the Apex Markdown processor. It is consumed by the Apex CLI when you use:
--install-plugin ID(for plugins)--filter ID/--filters(for AST filters)
The file apex-filters.json describes available AST filters that can be
installed into ~/.config/apex/filters and then enabled at runtime. Each entry
may optionally specify path (e.g. "src/code-includes.lua") to install
only that file from a repository instead of the whole repo.
Currently defined filters:
-
title
- Description: Adds a level‑1 header at the top of the document based on
the document title (
meta.title) if one is not already present. - Repo:
https://github.com/ApexMarkdown/apex-filter-title - Language: Ruby
- Description: Adds a level‑1 header at the top of the document based on
the document title (
-
delink
- Description: Converts links to plain text by stripping the hyperlink target but preserving the link text.
- Repo:
https://github.com/ApexMarkdown/apex-filter-delink - Language: Python
-
uppercase
- Description: Converts all plain text in the document to uppercase.
- Repo:
https://github.com/ApexMarkdown/apex-filter-uppercase - Language: Lua
-
unwrap
- Description: Unwraps elements starting with
<(e.g. paragraphs into raw HTML blocks); also unwraps single-image paragraphs to bare<img>. - Repo:
https://github.com/ApexMarkdown/apex-filter-unwrap - Language: Lua (requires
dkjson)
- Description: Unwraps elements starting with
You can install filters directly from the central directory using:
apex --install-filter title
apex --install-filter delinkThis clones the corresponding repositories under:
$XDG_CONFIG_HOME/apex/filters(if set), or~/.config/apex/filters
You can also install a filter manually by placing its executable into:
- macOS/Linux:
$XDG_CONFIG_HOME/apex/filters(if set), or~/.config/apex/filters
For example:
mkdir -p ~/.config/apex/filters
cp path/to/title.rb ~/.config/apex/filters/title
chmod +x ~/.config/apex/filters/titleThen run Apex with:
apex --filter title input.md > output.html
apex --filter delink input.md > output.html
apex --filters input.md > output.html # run all installed filtersFilter tests live in tests/. From the repo root, run:
./tests/run_filter_tests.shSee tests/README.md for requirements and how to add tests for new filters.
To propose a new filter for this directory:
-
Fork this repository (apex-filters).
-
Update
apex-filters.jsonwith your filter’s entry:id,title,description,author,homepage, andrepo(andrequiresif it has dependencies, e.g. Lua rocks). Optionally addpath: if the filter is a single file inside the repo (e.g. in a multi-filter repository), setpathto that path (e.g."src/code-includes.lua"). The CLI will clone the repo to a temporary directory, copy only that file into~/.config/apex/filters/<id>, then remove the clone. Withoutpath, the entire repo is cloned into~/.config/apex/filters/<id>/. -
Add tests:
- Add a fixture under
tests/fixtures/<id>.md: a small Markdown file that demonstrates the filter (input that the filter changes in a visible way). - Add one or more tests in
tests/run_filter_tests.sh: define atest_<id>()function that asserts the filter’s HTML output (see existing filters for examples).
- Add a fixture under
-
Open a pull request with:
- A short description of what the filter does.
- A note on how you tested it (e.g. “Ran
./tests/run_filter_tests.shandapex --filter <id> sample.md”).
Maintainers will review the JSON entry, fixture, and tests before merging.