MarkdownAST.jl: abstract syntax tree interface for Markdown

07/26/2023, 8:10 PM — 8:20 PM UTC
32-123

Abstract:

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).

Description:

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.

Platinum sponsors

JuliaHub

Gold sponsors

ASML

Silver sponsors

Pumas AIQuEra Computing Inc.Relational AIJeffrey Sarnoff

Bronze sponsors

Jolin.ioBeacon Biosignals

Academic partners

NAWA

Local partners

Postmates

Fiscal Sponsor

NumFOCUS