A MyST publication starts as a Markdown file on an author’s machine and ends as a page on a frontend like thestacks.org[1]. Raven builds the MyST AST from that source when a frontend requests it, and caches the result. The frontend then renders the AST. MyST is one of The Stacks’ two source formats. The Google Docs format has a separate authoring path.
Push. The
ravenCLI sends the file’s text. Raven’s MyST importer (importers/mystmd/) reads the frontmatter into the publication’s fields, and Raven stores the rest of the file as the body.Build. When a frontend asks for the AST, Raven parses the stored source content and builds it into an AST.[2] Frontends get page AST from Raven’s v1 API.
Render. thestacks.org renders the AST with
myst-to-react.
How Raven builds the AST¶
Raven doesn’t run myst build.
Instead, it calls mystmd’s parser and transforms directly (backend-ts/src/lib/myst/).
It also adds a few transforms of its own, such as numbering citations to match the publication’s reference list.
Raven stores the source rather than the AST, as it does for Google Docs publications. This reuses the storage Raven already has, and allows the AST’s structure to change as mystmd’s parser evolves.
Google Docs publications¶
Publications imported from Google Docs or created in the web editor take a different path.
Editing a MyST publication in the web editor keeps it MyST, and Raven rebuilds its AST from the edited text.
Raven’s imports API (POST /api/v1/imports) fetches the Google Doc and converts it with the @raven/importer-google-docs-markdown package.
Raven stores the result as the body, in the Google Docs format (a flavor of Markdown that uses Google Docs directives).
Raven doesn’t build an AST for these publications - the frontend parses and renders the Markdown itself.