Skip to content

Migrate documents from one pandoc AST schema to another

License

Notifications You must be signed in to change notification settings

pandoc/ast-migrator

Repository files navigation

ast-migrator

GitHub CI Build status Hackage Stackage Lts Stackage Nightly BSD-3-Clause license

Migrate documents from one pandoc AST schema to another.

Usage

The ast-migrator binary can be used as a compatibility helper for pandoc filters.

The following example assumes that my-filter expects the older pandoc API version 1.20, while pandoc has been updated and uses API version 1.22 internally. Without touching the original filter, we can no longer use the --filter options in this situation.

pandoc --filter=my-filter ...

Instead, pandoc's JSON must explicitly be converted and be passed to the filter:

pandoc --to=json ... \
  | ast-migrator --to=1.20 \
  | my-filter \
  | ast-migrator --from=1.20 \
  | pandoc ...

This will convert the JSON representation into a format palatable by the filter, and then later back into the format expected by pandoc.

For better handling the tool can be added to the filter itself; this makes the explicit piping unnecessary.

About

Migrate documents from one pandoc AST schema to another

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  
  •  

Packages

No packages published