2023-07-26 –, 32-123
The MarkdownAST.jl package provides the APIs to work with Markdown documents in an abstract syntax tree (AST) representation. It positions itself as an interface package between packages that can generate the AST (e.g. parsers), and code that consumes it (e.g. renders).
The MarkdownAST.jl package provides the APIs to work with Markdown documents in an abstract syntax tree (AST) representation.
The aim is to have a universal interface package between parsers and other packages that can generate the AST, and code that consumes ASTs (e.g. to analyze, render, or transform it).
In addition to the data structures used to represent the ASTs, it also has a library of functions to create and modify ASTs. It is also compatible with AbstractTrees.jl, particularly useful for different kinds of tree traversal.
While the core package itself only supports representing CommonMark and Julia Flavored Markdown documents, the design of the AST data structure is more general than that.
Users can define their own document elements (i.e. types of nodes in the AST) that have semantics that is different from the pre-existing ones.
This can be used to implement Markdown extensions, or even more general nodes, but still take advantage of the types and functions provided by the package.
Current users:
- Documenter.jl uses MarkdownAST internally to represent the Markdown document it processes.
- CommonMark.jl can parse Markdown documents into MarkdownAST AST.
Acknowledgments: the basic data structure is derived from the implementation in Michael Hatherly's CommonMark package.
Morten has been one of the maintainers Documenter.jl and the JuliaDocs package ecosystem. He works as a software engineer at JuliaHub.
GitHub: @mortenpi