{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.1.json","id":"generators-ast","path":"/generators/ast","type":"module","module":"generators-ast","title":"Parsing Markdown","introducedIn":null,"sourceLink":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `ast` stage reads your Markdown and MDX files and parses each one into a\nsyntax tree. Every output built from Markdown starts here, and it's where\nglobal remark plugins run. Any target built from Markdown runs it first, once\nper run, so you rarely name it. The trees then go to the\n[API entries](https://doc-kit.nodejs.org/generators/metadata) stage.","summary":"The `ast` stage reads your Markdown and MDX files and parses each one into a syntax tree. Every output built from Markdown starts here, and it's where global remark plugins run. Any target built from Markdown runs it first, once per run, so you rarely name it. The trees then go to the API entries stage.","examples":[],"children":[{"kind":"section","id":"configuring","name":"Configuring","title":"Configuring","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"`ast` has no options of its own. It parses the files `input` matches, minus\nthose `ignore` matches (see\n[Global options](https://doc-kit.nodejs.org/configuration#global-options)).\nSet them in an `ast` section for this stage to read different files than the\nothers. It runs the remark plugins in `global.markdown` and `ast.markdown`;\nsee [Markdown plugins](https://doc-kit.nodejs.org/configuration#markdown-plugins).\n\nFiles ending in `.mdx` are parsed as MDX, all others as Markdown, unless the\nfile's frontmatter sets `mdx` (see\n[MDX pages](https://doc-kit.nodejs.org/writing-docs#mdx-pages)).","summary":"`ast` has no options of its own. It parses the files `input` matches, minus those `ignore` matches (see Global options). Set them in an `ast` section for this stage to read different files than the others. It runs the remark plugins in `global.markdown` and `ast.markdown`; see Markdown plugins.","examples":[],"children":[]},{"kind":"section","id":"page-paths","name":"Page paths","title":"Page paths","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"A file's page path is its path relative to the base of the pattern that\nmatched it (the directories before the first wildcard), without its extension.\nWith `docs/**/*.md`, `docs/guide/install.md` becomes `/guide/install`, which\nthe [website](https://doc-kit.nodejs.org/generators/html) writes as\n`guide/install.html`.","summary":"A file's page path is its path relative to the base of the pattern that matched it (the directories before the first wildcard), without its extension. With `docs/**/*.md`, `docs/guide/install.md` becomes `/guide/install`, which the website writes as `guide/install.html`.","examples":[],"children":[]},{"kind":"section","id":"what-it-produces","name":"What it produces","title":"What it produces","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"A [generator of your own](https://doc-kit.nodejs.org/creating-generators#input-and-output)\nwith `dependsOn: '@doc-kit/core/ast'` receives every file in one array, each\nas an object with:\n\n* `tree` {Object} The file's [mdast](https://github.com/syntax-tree/mdast)\n  syntax tree (a `Root` node), after every plugin ran.\n* `path` {string} Its page path, such as `/guide/install`.\n* `mdx` {boolean} Whether it was parsed as MDX.\n\nFiles arrive in the order their chunks finish, not the order of `input`. Most\ngenerators depend on `@doc-kit/core/metadata` instead, to get the API entries\nbuilt from these trees.","summary":"A generator of your own with `dependsOn: '@doc-kit/core/ast'` receives every file in one array, each as an object with:","examples":[],"children":[]}]}