From 0866ee9217e5e0b60e1c5f604e3576fb2604a3d5 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Mon, 22 Aug 2022 23:38:15 +0800 Subject: docs: searchable api (#1253) --- docs/.vitepress/config.ts | 5 + docs/api/.gitignore | 8 ++ docs/api/ApiIndex.vue | 240 ++++++++++++++++++++++++++++++++++++++++++++++ docs/api/api-types.ts | 26 +++++ docs/api/index.md | 12 +++ 5 files changed, 291 insertions(+) create mode 100644 docs/api/ApiIndex.vue create mode 100644 docs/api/api-types.ts create mode 100644 docs/api/index.md (limited to 'docs') diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 44a1ec79..87733d59 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -84,6 +84,11 @@ export default defineConfig({ nav: [ { text: 'Guide', link: '/guide/' }, + { + text: 'API', + activeMatch: `^/api/`, + link: '/api/', + }, { text: 'Ecosystem', items: [{ text: 'StackBlitz ', link: 'https://fakerjs.dev/new' }], diff --git a/docs/api/.gitignore b/docs/api/.gitignore index 3d5066c5..fc720b3c 100644 --- a/docs/api/.gitignore +++ b/docs/api/.gitignore @@ -1,3 +1,11 @@ +# Markdown *.md +!index.md !localization.md + +# TypeScript +*.ts +!api-types.ts + +# JSON *.json diff --git a/docs/api/ApiIndex.vue b/docs/api/ApiIndex.vue new file mode 100644 index 00000000..0846d9f2 --- /dev/null +++ b/docs/api/ApiIndex.vue @@ -0,0 +1,240 @@ + + + + + + + diff --git a/docs/api/api-types.ts b/docs/api/api-types.ts new file mode 100644 index 00000000..f5dcd659 --- /dev/null +++ b/docs/api/api-types.ts @@ -0,0 +1,26 @@ +// These interfaces are copied over from https://github.com/vuejs/docs/blob/main/src/api/api.data.ts + +/** + * Represents a link to e.g. a Faker-Module method within the API search index page. + */ +export interface APIHeader { + anchor: string; + text: string; +} + +/** + * Represents a container for e.g. a Faker-Module within the API search index page. + */ +export interface APIItem { + text: string; + link: string; + headers: APIHeader[]; +} + +/** + * Represents a whole section within the API search index page. + */ +export interface APIGroup { + text: string; + items: APIItem[]; +} diff --git a/docs/api/index.md b/docs/api/index.md new file mode 100644 index 00000000..d962f905 --- /dev/null +++ b/docs/api/index.md @@ -0,0 +1,12 @@ +--- +layout: page +title: API Reference +sidebar: false +footer: false +--- + + + + -- cgit v1.2.3