Skip to content

ApexMarkdown/apex-filter-title

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Apex Title Filter

Ruby JSON filter for the Apex Markdown processor, compatible with Pandoc-style filters (docs).

This filter:

  • Looks for a document title in Pandoc JSON metadata (meta.title).
  • If the first block is not already a level‑1 header (Header 1), prepends an H1 using that title.

The transformation is:

  • Input: Pandoc JSON document (Pandoc object) on stdin.
  • Output: Modified Pandoc JSON document on stdout.

Script

The main filter implementation lives in title.rb:

./title.rb < in.json > out.json

It expects a full Pandoc‑style JSON document as produced by:

pandoc -t json input.md | ./title.rb | pandoc -f json -t html

or, when used via Apex:

apex --filter title input.md > output.html

Installation for Apex

  1. Ensure the script is executable:

    chmod +x title.rb
  2. Install it into your Apex filters directory:

    mkdir -p ~/.config/apex/filters
    cp title.rb ~/.config/apex/filters/title
  3. Run Apex with the filter enabled:

    apex --filter title input.md > output.html

To run all installed filters in the directory:

apex --filters input.md > output.html

You can also combine this with other filters (e.g., delink) simply by having multiple executables in ~/.config/apex/filters and/or using multiple --filter NAME arguments.

About

Filters for Apex

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages