Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions docs-md/api/index.md

This file was deleted.

27 changes: 16 additions & 11 deletions scripts/md-generate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,35 @@ const SOURCE_DIR_URL =
if (!fs.existsSync(OUTPUT_DIR)) {
fs.mkdirSync(OUTPUT_DIR);
}

/**
* Get all method paths from src/
* Create path as src/method/method.ts
*/
const getDirectories = async (source) =>
(await readdir(source, { withFileTypes: true }))
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);

const methodDirectory = await getDirectories('src/');
console.log('🍉debuu ~ methodDirectory:', methodDirectory);

// generate the _category_.json for docusaurus again
// fs.writeFileSync(
// `${OUTPUT_DIR}/_category_.json`,
// JSON.stringify({
// type: 'category',
// label: 'API',
// position: 2,
// link: {
// type: 'generated-index',
// description: 'API reference for available methods.',
// slug: '/api',
// },
// items: ['api'],
// })
// );

/**
* Get all method paths from src/
* Create path as src/method/method.ts
*/
const getDirectories = async (source) =>
(await readdir(source, { withFileTypes: true }))
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);

const methodDirectory = await getDirectories('src/');

/**
* Loop each directory to generate markdown
*/
Expand Down
17 changes: 15 additions & 2 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@ import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
*/
const sidebars: SidebarsConfig = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }],

tutorialSidebar: [
'getting-started',
{
type: 'category',
label: 'API',
items: [{ type: 'autogenerated', dirName: 'api' }],
link: {
type: 'generated-index',
slug: '/api',
title: 'API Reference',
description: 'Complete list of available API methods.',
},
},
'changelog',
],
// But you can create a sidebar manually
/*
tutorialSidebar: [
Expand Down
Loading