{
  "type": "module",
  "source": "doc/api/generators-section-pages.md",
  "modules": [
    {
      "textRaw": "`section-pages` Generator",
      "name": "`section-pages`_generator",
      "type": "module",
      "desc": "<p>The <code>section-pages</code> generator splits every documented module into per-section pages.\nIt leaves the full module page untouched and adds one extra page for each\nsection next to it:</p>\n<pre><code class=\"language-text\">out/\n├── fs.html                  the complete module page, exactly as before\n└── fs/\n    ├── promises-api.html    ## Promises API\n    ├── FileHandle.html      ### Class: FileHandle, with all of its members\n    ├── fsPromises.readFile.html\n    ├── callback-api.html    ## Callback API\n    ├── readFile.html        ### fs.readFile(path[, options], callback)\n    └── ...\n</code></pre>\n<p>Each chunk page renders like any other page: same layout, sidebar, table of\ncontents, and search. On top of that:</p>\n<ul>\n<li>the sidebar nests the current module's sections under its entry (the module\nitself is repeated as the first item, so the full page stays one click away);</li>\n<li>previous/next links step through the module and its sections in order;</li>\n<li>the meta bar links a chunk back to its place on the full page (\"Part Of\"),\nand its \"View As\" and \"Edit this page\" links point at the module's files;</li>\n<li>links inside a section keep working: fragment links follow the section they\npoint at to whichever page it landed on, and relative links are re-based.</li>\n</ul>\n<pre><code class=\"language-bash\">npx @doc-kit/cli generate -t section-pages -i \"doc/api/*.md\" -o out\n</code></pre>",
      "modules": [
        {
          "textRaw": "How it works",
          "name": "how_it_works",
          "type": "module",
          "desc": "<p><code>section-pages</code> does not render anything itself. It consumes the <code>metadata</code>\ngenerator's entries, and for each module appends copies of the entries of every\nsection, re-homed under the section's own <code>api</code> and <code>path</code> (<code>fs/readFile</code>).\nIt then declares the generators it is delivered through as its\n<a href=\"../../../../docs/creating-generators.html#declaring-a-dependent\"><code>dependent</code></a>s:</p>\n<ul>\n<li><code>html</code>, where it is spliced between <code>metadata</code> and <code>jsx-ast</code>, so the web\ngenerators render the chunk pages as if they had always been there;</li>\n<li><code>sitemap</code>, where it is spliced in front of the generator itself, so the\nchunk pages are listed.</li>\n</ul>\n<pre><code class=\"language-text\">ast → metadata → section-pages → jsx-ast → html\n               └─────────→ sitemap\n</code></pre>\n<p>Requesting <code>-t section-pages</code> on its own therefore produces both. Requested together\nwith either of them (<code>-t html -t section-pages</code>), it only feeds the ones that run.</p>\n<p>Other generators that read <code>metadata</code> — <code>orama-db</code>, <code>llms-txt</code>, and the JSON\noutputs — are deliberately left alone: search results and <code>llms.txt</code> keep\npointing at the full pages, which carry the same anchors, and nothing is\nindexed twice.</p>",
          "displayName": "How it works"
        },
        {
          "textRaw": "What becomes a chunk",
          "name": "what_becomes_a_chunk",
          "type": "module",
          "desc": "<p>Within a module, a new chunk starts at:</p>\n<ul>\n<li>every depth-2 heading (<code>## Callback API</code>, <code>## Notes</code>), and</li>\n<li>every heading up to <code>maxDepth</code> that documents an API entry — a method, class,\nconstructor, event, property, static method, or global (<code>### fs.readFile()</code>).</li>\n</ul>\n<p>Everything else stays in the chunk of the closest heading above it: prose\nsub-sections (<code>#### File descriptors</code>), and — regardless of depth — the members\nof a class, so that a class page lists its whole API (<code>### Class: fs.Dir</code> keeps\n<code>#### dir.close()</code>).</p>\n<p>A section only becomes a chunk when it documents an API entry — its own\nheading, or one nested anywhere below it, is a method, class, constructor,\nevent, property, or static method. Pure prose (<code>## Introduction</code>, <code>## Notes</code>,\nthe whole of \"About this documentation\") reads best in the context of the full\npage, and stays there. A prose-headed section whose sub-sections are API\nentries (<code>## Callback API</code>) is still a chunk, so that the sidebar can nest them\nunder it.</p>\n<p>The module's own introduction (everything before the first depth-2 heading) is\nonly on the full page. Modules that would yield fewer than two chunks — which\nincludes every module that documents no API at all — and modules listed in\n<code>exclude</code>, are left alone.</p>",
          "displayName": "What becomes a chunk"
        },
        {
          "textRaw": "File names",
          "name": "file_names",
          "type": "module",
          "desc": "<p>A chunk's file name comes from its heading. API names keep their case, with the\nmodule's own prefix dropped, so <code>fs.readFile()</code> becomes <code>fs/readFile.html</code> and\n<code>Class: fs.Dir</code> becomes <code>fs/Dir.html</code>; names in another namespace keep it\n(<code>fs/fsPromises.readFile.html</code>). Prose headings are slugged\n(<code>fs/callback-api.html</code>). Duplicates within a module are suffixed\n(<code>close.html</code>, <code>close-2.html</code>), comparing case-insensitively so the output is\nsafe on case-insensitive file systems.</p>\n<p>Heading anchors are unchanged, so <code>fs/readFile.html#fsreadfilepath-options-callback</code>\nand <code>fs.html#fsreadfilepath-options-callback</code> point at the same section.</p>",
          "displayName": "File names"
        },
        {
          "textRaw": "Configuring",
          "name": "configuring",
          "type": "module",
          "desc": "<ul>\n<li><code>maxDepth</code> <code class=\"type\"><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type\" class=\"type-link\">number</a></code> The deepest heading level that may start a chunk.\nHeadings below it always stay with the section above them. <strong>Default:</strong> <code>2</code>,\nwhich only splits at <code>##</code> headings; the tree above is what <code>3</code> produces.</li>\n<li><code>exclude</code> <code class=\"type\"><a href=\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array\" class=\"type-link\">Array</a></code> <code>api</code> names of modules that are never split, on top of the\nmodules that document no API entry. <strong>Default:</strong> <code>[]</code>.</li>\n</ul>\n<pre><code class=\"language-js\">// doc-kit.config.mjs\nexport default {\n  target: ['section-pages'],\n  'section-pages': {\n    // Also split at `###` headings that document an API entry\n    maxDepth: 3,\n    exclude: ['deprecations'],\n  },\n};\n</code></pre>",
          "displayName": "Configuring"
        },
        {
          "textRaw": "Chunk metadata",
          "name": "chunk_metadata",
          "type": "module",
          "desc": "<p>Every entry of a chunk page carries a <code>chunk</code> property describing its origin,\nwhich the <code>html</code> UI uses for its navigation:</p>\n<ul>\n<li><code>api</code> <code class=\"type\"><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type\" class=\"type-link\">string</a></code> The <code>api</code> of the module the chunk was split from (<code>fs</code>).</li>\n<li><code>path</code> <code class=\"type\"><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type\" class=\"type-link\">string</a></code> The <code>path</code> of the module (<code>/fs</code>).</li>\n<li><code>slug</code> <code class=\"type\"><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type\" class=\"type-link\">string</a></code> The section's anchor on the full page.</li>\n<li><code>index</code> <code class=\"type\"><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type\" class=\"type-link\">number</a></code> The chunk's position within the module, in document order.</li>\n<li><code>depth</code> <code class=\"type\"><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type\" class=\"type-link\">number</a></code> The original depth of the chunk's heading.</li>\n</ul>\n<p>The chunk's first entry also gets a <code>title</code> — its sidebar label and page\ntitle (<code>fs.readFile</code>). The <code>html</code> generator exposes every module's section\ntree through the <code>chunks</code> export of\n<a href=\"./html.html#themeconfig-virtual-module\"><code>#theme/config</code></a>, for custom themes.</p>",
          "displayName": "Chunk metadata"
        },
        {
          "textRaw": "Trade-offs",
          "name": "trade-offs",
          "type": "module",
          "desc": "<ul>\n<li>Chunk pages duplicate content that is also on the full page, so the site\nroughly doubles in page count and the build grows accordingly.</li>\n<li>No redirects are generated from <code>fs.html#anchor</code> to a chunk page: the full\npage still exists, so existing links keep working, and both pages share\ntheir anchors.</li>\n<li>Chunk pages do not get <code>.json</code> or <code>.md</code> renderings of their own; their\n\"View As\" links lead to the module's.</li>\n</ul>",
          "displayName": "Trade-offs"
        }
      ],
      "displayName": "`section-pages` Generator"
    }
  ]
}