{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.1.json","id":"generators-legacy-json","path":"/generators/legacy-json","type":"module","module":"generators-legacy-json","title":"Legacy JSON","introducedIn":null,"sourceLink":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `legacy-json` generator writes Node.js's legacy JSON format: one JSON file\nper source file, as Node.js's original documentation tooling wrote it next to\neach HTML page, with descriptions in HTML. It exists for Node.js and the tools\nthat read those files; for API data of your own, use the\n[`json` generator](https://doc-kit.nodejs.org/generators/json), whose format a\nversioned schema describes.","summary":"The `legacy-json` generator writes Node.js's legacy JSON format: one JSON file per source file, as Node.js's original documentation tooling wrote it next to each HTML page, with descriptions in HTML. It exists for Node.js and the tools that read those files; for API data of your own, use the `json` generator, whose format a versioned schema describes.","examples":[],"children":[{"kind":"section","id":"usage","name":"Usage","title":"Usage","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"From the root of a Node.js checkout:\n\n```bash\nnpx @doc-kit/cli generate -t legacy-json -i \"doc/api/*.md\" -o out\n```\n\nThe files keep the input's directory layout, from where the glob starts:\n`doc/api/fs.md` becomes `out/fs.json`.","summary":"From the root of a Node.js checkout:","examples":[{"language":"bash","displayName":null,"code":"npx @doc-kit/cli generate -t legacy-json -i \"doc/api/*.md\" -o out"}],"children":[]},{"kind":"section","id":"configuring","name":"Configuring","title":"Configuring","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"* `sourceURL` {string} The `source` each file records. `{path}` is the file's\n  `api` identifier with `.md` (`fs.md`), and is the only placeholder.\n  **Default:** `'doc/api/{path}'`.\n\nIt also reads the\n[global options](https://doc-kit.nodejs.org/configuration#global-options).\nWithout an `output`, the files only go to\n[`legacy-json-all`](https://doc-kit.nodejs.org/generators/legacy-json-all).\n\nThe descriptions render Markdown with a fixed set of plugins, so a `markdown`\nsection for this generator is ignored with a warning.","summary":"It also reads the global options. Without an `output`, the files only go to `legacy-json-all`.","examples":[],"children":[]},{"kind":"section","id":"what-a-file-holds","name":"What a file holds","title":"What a file holds","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"For this page:\n\n```md displayName=\"doc/api/kittens.md\"\n# Kittens\n\n<!--introduced_in=v1.0.0-->\n\n> [Stability: 2](documentation.html#stability-index) - Stable\n\nEverything about `Kitten` objects.\n\n## Class: `Kitten`\n\n<!-- YAML\nadded: v1.0.0\n-->\n\nA small cat.\n\n### `kitten.meow([volume])`\n\n- `volume` {number} How loud. **Default:** `1`.\n- Returns: {boolean}\n\nMakes the kitten meow.\n```\n\n`legacy-json` writes:\n\n```json displayName=\"out/kittens.json\"\n{\n  \"type\": \"module\",\n  \"source\": \"doc/api/kittens.md\",\n  \"modules\": [\n    {\n      \"textRaw\": \"Kittens\",\n      \"name\": \"kittens\",\n      \"introduced_in\": \"v1.0.0\",\n      \"type\": \"module\",\n      \"stability\": 2,\n      \"stabilityText\": \"Stable\",\n      \"desc\": \"<p>Everything about <code>Kitten</code> objects.</p>\",\n      \"classes\": [\n        {\n          \"textRaw\": \"Class: `Kitten`\",\n          \"name\": \"Kitten\",\n          \"type\": \"class\",\n          \"meta\": { \"added\": [\"v1.0.0\"], \"changes\": [] },\n          \"desc\": \"<p>A small cat.</p>\",\n          \"methods\": [\n            {\n              \"textRaw\": \"`kitten.meow([volume])`\",\n              \"name\": \"meow\",\n              \"type\": \"method\",\n              \"signatures\": [\n                {\n                  \"params\": [\n                    {\n                      \"textRaw\": \"`volume` {number} How loud. **Default:** `1`.\",\n                      \"name\": \"volume\",\n                      \"type\": \"number\",\n                      \"default\": \"`1`\",\n                      \"desc\": \"How loud.\",\n                      \"optional\": true\n                    }\n                  ],\n                  \"return\": {\n                    \"textRaw\": \"Returns: {boolean}\",\n                    \"name\": \"return\",\n                    \"type\": \"boolean\"\n                  }\n                }\n              ],\n              \"desc\": \"<p>Makes the kitten meow.</p>\"\n            }\n          ]\n        }\n      ],\n      \"displayName\": \"Kittens\"\n    }\n  ]\n}\n```\n\n* The file is a `module` with the `source` from `sourceURL`. Its first heading\n  is the first entry of its `modules`.\n* Each heading becomes a section in its parent, under a key for its kind:\n  `modules` for plain headings, `classes`, `methods`, `properties`, `events`,\n  `classMethods`, `signatures` for constructors, and `miscs`, `globals` and\n  `vars` for headings typed so.\n* A section has its heading as `textRaw`, a `name`, its `type`, and `desc`,\n  its content rendered to HTML. `meta` holds its `added`, `deprecated`,\n  `removed`, `napiVersion` and `changes`, and `stability` and `stabilityText`\n  its stability index. Keys a section has no value for are left out.\n* The typed list under a heading is parsed out of `desc`: a method's\n  parameters and return value go in `signatures`, an event's arguments in\n  `params`, and a property's first item gives its `type` and `default`. A\n  constructor, under its class's `signatures`, carries its `params` itself.","summary":"For this page:","examples":[{"language":"md","displayName":"doc/api/kittens.md","code":"# Kittens\n\n<!--introduced_in=v1.0.0-->\n\n> [Stability: 2](documentation.html#stability-index) - Stable\n\nEverything about `Kitten` objects.\n\n## Class: `Kitten`\n\n<!-- YAML\nadded: v1.0.0\n-->\n\nA small cat.\n\n### `kitten.meow([volume])`\n\n- `volume` {number} How loud. **Default:** `1`.\n- Returns: {boolean}\n\nMakes the kitten meow."},{"language":"json","displayName":"out/kittens.json","code":"{\n  \"type\": \"module\",\n  \"source\": \"doc/api/kittens.md\",\n  \"modules\": [\n    {\n      \"textRaw\": \"Kittens\",\n      \"name\": \"kittens\",\n      \"introduced_in\": \"v1.0.0\",\n      \"type\": \"module\",\n      \"stability\": 2,\n      \"stabilityText\": \"Stable\",\n      \"desc\": \"<p>Everything about <code>Kitten</code> objects.</p>\",\n      \"classes\": [\n        {\n          \"textRaw\": \"Class: `Kitten`\",\n          \"name\": \"Kitten\",\n          \"type\": \"class\",\n          \"meta\": { \"added\": [\"v1.0.0\"], \"changes\": [] },\n          \"desc\": \"<p>A small cat.</p>\",\n          \"methods\": [\n            {\n              \"textRaw\": \"`kitten.meow([volume])`\",\n              \"name\": \"meow\",\n              \"type\": \"method\",\n              \"signatures\": [\n                {\n                  \"params\": [\n                    {\n                      \"textRaw\": \"`volume` {number} How loud. **Default:** `1`.\",\n                      \"name\": \"volume\",\n                      \"type\": \"number\",\n                      \"default\": \"`1`\",\n                      \"desc\": \"How loud.\",\n                      \"optional\": true\n                    }\n                  ],\n                  \"return\": {\n                    \"textRaw\": \"Returns: {boolean}\",\n                    \"name\": \"return\",\n                    \"type\": \"boolean\"\n                  }\n                }\n              ],\n              \"desc\": \"<p>Makes the kitten meow.</p>\"\n            }\n          ]\n        }\n      ],\n      \"displayName\": \"Kittens\"\n    }\n  ]\n}"}],"children":[]}]}