diff --git a/docs/website/package.json b/docs/website/package.json index a21a8b5e84..1e5bd1bc55 100644 --- a/docs/website/package.json +++ b/docs/website/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "docusaurus": "docusaurus", - "start": "PYTHONPATH=. poetry run pydoc-markdown && node tools/preprocess_docs.js && node tools/update_version_env.js && docusaurus start", + "start": "node tools/preprocess_docs.js && node tools/update_version_env.js && docusaurus start", "watch-snippets": "node tools/update_snippets.js --watch", "build": "PYTHONPATH=. poetry run pydoc-markdown && node tools/preprocess_docs.js && node tools/update_version_env.js && docusaurus build", "build:netlify": "PYTHONPATH=. pydoc-markdown && node tools/preprocess_docs.js && node tools/update_version_env.js && docusaurus build --out-dir build/docs", @@ -13,7 +13,8 @@ "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", - "update-snippets": "node tools/update_snippets.js" + "update-snippets": "node tools/update_snippets.js", + "generate-api-reference": "PYTHONPATH=. poetry run pydoc-markdown" }, "dependencies": { "@docusaurus/core": "2.4.1", diff --git a/docs/website/sidebars.js b/docs/website/sidebars.js index 703b5a94f9..2bc4caa85c 100644 --- a/docs/website/sidebars.js +++ b/docs/website/sidebars.js @@ -10,6 +10,7 @@ */ // @ts-check +const fs = require('fs'); /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { @@ -289,7 +290,6 @@ const sidebars = { keywords: ['reference'], }, items: [ - require("./docs_processed/api_reference/sidebar.json"), 'reference/installation', 'reference/command-line-interface', 'reference/telemetry', @@ -304,6 +304,15 @@ const sidebars = { ] }; +// inject api reference if it exists +if (fs.existsSync('./docs_processed/api_reference/sidebar.json')) { + for (const item of sidebars.tutorialSidebar) { + if (item.label === 'Reference') { + item.items.splice(0,0,require("./docs_processed/api_reference/sidebar.json")); + } + } +} + // on the master branch link to devel and vice versa if (process.env.IS_MASTER_BRANCH) { sidebars.tutorialSidebar.push( {