create-docusaurus-openapi-docs 0.0.0-1235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin/index.js +36 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +191 -0
- package/package.json +48 -0
- package/templates/default/blog/2019-05-28-first-blog-post.md +12 -0
- package/templates/default/blog/2019-05-29-long-blog-post.md +44 -0
- package/templates/default/blog/2021-08-01-mdx-blog-post.mdx +20 -0
- package/templates/default/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
- package/templates/default/blog/2021-08-26-welcome/index.md +25 -0
- package/templates/default/blog/authors.yml +17 -0
- package/templates/default/docs/intro.md +49 -0
- package/templates/default/docs/petstore/add-pet.ParamsDetails.json +19 -0
- package/templates/default/docs/petstore/add-pet.RequestSchema.json +288 -0
- package/templates/default/docs/petstore/add-pet.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/add-pet.api.mdx +45 -0
- package/templates/default/docs/petstore/create-user.RequestSchema.json +345 -0
- package/templates/default/docs/petstore/create-user.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/create-user.api.mdx +45 -0
- package/templates/default/docs/petstore/create-users-with-array-input.RequestSchema.json +348 -0
- package/templates/default/docs/petstore/create-users-with-array-input.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/create-users-with-array-input.api.mdx +47 -0
- package/templates/default/docs/petstore/create-users-with-list-input.RequestSchema.json +348 -0
- package/templates/default/docs/petstore/create-users-with-list-input.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/create-users-with-list-input.api.mdx +47 -0
- package/templates/default/docs/petstore/delete-order.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/delete-order.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/delete-order.StatusCodes.json +6 -0
- package/templates/default/docs/petstore/delete-order.api.mdx +49 -0
- package/templates/default/docs/petstore/delete-pet.ParamsDetails.json +18 -0
- package/templates/default/docs/petstore/delete-pet.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/delete-pet.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/delete-pet.api.mdx +43 -0
- package/templates/default/docs/petstore/delete-user.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/delete-user.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/delete-user.StatusCodes.json +6 -0
- package/templates/default/docs/petstore/delete-user.api.mdx +45 -0
- package/templates/default/docs/petstore/find-pets-by-status.ParamsDetails.json +21 -0
- package/templates/default/docs/petstore/find-pets-by-status.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/find-pets-by-status.StatusCodes.json +522 -0
- package/templates/default/docs/petstore/find-pets-by-status.api.mdx +51 -0
- package/templates/default/docs/petstore/find-pets-by-tags.ParamsDetails.json +12 -0
- package/templates/default/docs/petstore/find-pets-by-tags.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/find-pets-by-tags.StatusCodes.json +522 -0
- package/templates/default/docs/petstore/find-pets-by-tags.api.mdx +55 -0
- package/templates/default/docs/petstore/get-inventory.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/get-inventory.StatusCodes.json +15 -0
- package/templates/default/docs/petstore/get-inventory.api.mdx +43 -0
- package/templates/default/docs/petstore/get-order-by-id.ParamsDetails.json +16 -0
- package/templates/default/docs/petstore/get-order-by-id.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/get-order-by-id.StatusCodes.json +127 -0
- package/templates/default/docs/petstore/get-order-by-id.api.mdx +49 -0
- package/templates/default/docs/petstore/get-pet-by-id.ParamsDetails.json +12 -0
- package/templates/default/docs/petstore/get-pet-by-id.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/get-pet-by-id.StatusCodes.json +517 -0
- package/templates/default/docs/petstore/get-pet-by-id.api.mdx +49 -0
- package/templates/default/docs/petstore/get-user-by-name.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/get-user-by-name.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/get-user-by-name.StatusCodes.json +683 -0
- package/templates/default/docs/petstore/get-user-by-name.api.mdx +47 -0
- package/templates/default/docs/petstore/login-user.ParamsDetails.json +18 -0
- package/templates/default/docs/petstore/login-user.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/login-user.StatusCodes.json +29 -0
- package/templates/default/docs/petstore/login-user.api.mdx +43 -0
- package/templates/default/docs/petstore/logout-user.RequestSchema.json +1 -0
- package/templates/default/docs/petstore/logout-user.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/logout-user.api.mdx +39 -0
- package/templates/default/docs/petstore/new-pet.RequestSchema.json +260 -0
- package/templates/default/docs/petstore/new-pet.StatusCodes.json +7 -0
- package/templates/default/docs/petstore/new-pet.api.mdx +45 -0
- package/templates/default/docs/petstore/pet.tag.mdx +15 -0
- package/templates/default/docs/petstore/place-order.RequestSchema.json +96 -0
- package/templates/default/docs/petstore/place-order.StatusCodes.json +133 -0
- package/templates/default/docs/petstore/place-order.api.mdx +43 -0
- package/templates/default/docs/petstore/schemas/cat.Schema.json +224 -0
- package/templates/default/docs/petstore/schemas/cat.schema.mdx +30 -0
- package/templates/default/docs/petstore/sidebar.ts +180 -0
- package/templates/default/docs/petstore/store.tag.mdx +15 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.2.json +28 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.3.json +28 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.4.json +25 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.5.json +20 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.RequestSchema.json +27 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.2.json +21 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.3.json +17 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.4.json +9 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.5.json +9 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.StatusCodes.json +20 -0
- package/templates/default/docs/petstore/subscribe-to-the-store-events.api.mdx +120 -0
- package/templates/default/docs/petstore/swagger-petstore-yaml.info.mdx +249 -0
- package/templates/default/docs/petstore/update-pet-with-form.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/update-pet-with-form.RequestSchema.json +22 -0
- package/templates/default/docs/petstore/update-pet-with-form.StatusCodes.json +1 -0
- package/templates/default/docs/petstore/update-pet-with-form.api.mdx +49 -0
- package/templates/default/docs/petstore/update-pet.ParamsDetails.json +19 -0
- package/templates/default/docs/petstore/update-pet.RequestSchema.json +288 -0
- package/templates/default/docs/petstore/update-pet.StatusCodes.json +7 -0
- package/templates/default/docs/petstore/update-pet.api.mdx +43 -0
- package/templates/default/docs/petstore/update-user.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/update-user.RequestSchema.json +345 -0
- package/templates/default/docs/petstore/update-user.StatusCodes.json +6 -0
- package/templates/default/docs/petstore/update-user.api.mdx +45 -0
- package/templates/default/docs/petstore/upload-file.ParamsDetails.json +11 -0
- package/templates/default/docs/petstore/upload-file.RequestSchema.json +10 -0
- package/templates/default/docs/petstore/upload-file.StatusCodes.json +20 -0
- package/templates/default/docs/petstore/upload-file.api.mdx +43 -0
- package/templates/default/docs/petstore/user.tag.mdx +15 -0
- package/templates/default/docs/tutorial-basics/_category_.json +8 -0
- package/templates/default/docs/tutorial-basics/congratulations.md +23 -0
- package/templates/default/docs/tutorial-basics/create-a-blog-post.md +36 -0
- package/templates/default/docs/tutorial-basics/create-a-document.md +55 -0
- package/templates/default/docs/tutorial-basics/create-a-page.md +45 -0
- package/templates/default/docs/tutorial-basics/deploy-your-site.md +31 -0
- package/templates/default/docs/tutorial-basics/markdown-features.mdx +145 -0
- package/templates/default/docs/tutorial-extras/_category_.json +7 -0
- package/templates/default/docs/tutorial-extras/manage-docs-versions.md +57 -0
- package/templates/default/docs/tutorial-extras/translate-your-site.md +90 -0
- package/templates/default/docusaurus.config.ts +273 -0
- package/templates/default/examples/petstore.yaml +1271 -0
- package/templates/default/gitignore +21 -0
- package/templates/default/package.json +44 -0
- package/templates/default/sidebars.ts +37 -0
- package/templates/default/src/components/HomepageFeatures/index.js +64 -0
- package/templates/default/src/components/HomepageFeatures/styles.module.css +11 -0
- package/templates/default/src/css/custom.css +77 -0
- package/templates/default/src/pages/index.js +42 -0
- package/templates/default/src/pages/index.module.css +23 -0
- package/templates/default/src/pages/markdown-page.md +7 -0
- package/templates/default/static/.nojekyll +0 -0
- package/templates/default/static/img/docusaurus.png +0 -0
- package/templates/default/static/img/favicon.ico +0 -0
- package/templates/default/static/img/logo.svg +1 -0
- package/templates/default/static/img/tutorial/docsVersionDropdown.png +0 -0
- package/templates/default/static/img/tutorial/localeDropdown.png +0 -0
- package/templates/default/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/templates/default/static/img/undraw_docusaurus_react.svg +170 -0
- package/templates/default/static/img/undraw_docusaurus_tree.svg +40 -0
- package/templates/default/tsconfig.json +10 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
tags:
|
|
4
|
+
- test
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Create a Page
|
|
8
|
+
|
|
9
|
+
Add **Markdown or React** files to `src/pages` to create a **standalone page**:
|
|
10
|
+
|
|
11
|
+
- `src/pages/index.js` -> `localhost:3000/`
|
|
12
|
+
- `src/pages/foo.md` -> `localhost:3000/foo`
|
|
13
|
+
- `src/pages/foo/bar.js` -> `localhost:3000/foo/bar`
|
|
14
|
+
|
|
15
|
+
## Create your first React Page
|
|
16
|
+
|
|
17
|
+
Create a file at `src/pages/my-react-page.js`:
|
|
18
|
+
|
|
19
|
+
```jsx title="src/pages/my-react-page.js"
|
|
20
|
+
import React from "react";
|
|
21
|
+
import Layout from "@theme/Layout";
|
|
22
|
+
|
|
23
|
+
export default function MyReactPage() {
|
|
24
|
+
return (
|
|
25
|
+
<Layout>
|
|
26
|
+
<h1>My React page</h1>
|
|
27
|
+
<p>This is a React page</p>
|
|
28
|
+
</Layout>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
A new page is now available at `http://localhost:3000/my-react-page`.
|
|
34
|
+
|
|
35
|
+
## Create your first Markdown Page
|
|
36
|
+
|
|
37
|
+
Create a file at `src/pages/my-markdown-page.md`:
|
|
38
|
+
|
|
39
|
+
```mdx title="src/pages/my-markdown-page.md"
|
|
40
|
+
# My Markdown page
|
|
41
|
+
|
|
42
|
+
This is a Markdown page
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A new page is now available at `http://localhost:3000/my-markdown-page`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 5
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Deploy your site
|
|
6
|
+
|
|
7
|
+
Docusaurus is a **static-site-generator** (also called **[Jamstack](https://jamstack.org/)**).
|
|
8
|
+
|
|
9
|
+
It builds your site as simple **static HTML, JavaScript and CSS files**.
|
|
10
|
+
|
|
11
|
+
## Build your site
|
|
12
|
+
|
|
13
|
+
Build your site **for production**:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The static files are generated in the `build` folder.
|
|
20
|
+
|
|
21
|
+
## Deploy your site
|
|
22
|
+
|
|
23
|
+
Test your production build locally:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm run serve
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The `build` folder is now served at `http://localhost:3000/`.
|
|
30
|
+
|
|
31
|
+
You can now deploy the `build` folder **almost anywhere** easily, **for free** or very small cost (read the **[Deployment Guide](https://docusaurus.io/docs/deployment)**).
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 4
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Markdown Features
|
|
6
|
+
|
|
7
|
+
Docusaurus supports **[Markdown](https://daringfireball.net/projects/markdown/syntax)** and a few **additional features**.
|
|
8
|
+
|
|
9
|
+
## Front Matter
|
|
10
|
+
|
|
11
|
+
Markdown documents have metadata at the top called [Front Matter](https://jekyllrb.com/docs/front-matter/):
|
|
12
|
+
|
|
13
|
+
```text title="my-doc.md"
|
|
14
|
+
// highlight-start
|
|
15
|
+
---
|
|
16
|
+
id: my-doc-id
|
|
17
|
+
title: My document title
|
|
18
|
+
description: My document description
|
|
19
|
+
slug: /my-custom-url
|
|
20
|
+
---
|
|
21
|
+
// highlight-end
|
|
22
|
+
|
|
23
|
+
## Markdown heading
|
|
24
|
+
|
|
25
|
+
Markdown text with [links](./hello.md)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Links
|
|
29
|
+
|
|
30
|
+
Regular Markdown links are supported, using url paths or relative file paths.
|
|
31
|
+
|
|
32
|
+
```md
|
|
33
|
+
Let's see how to [Create a page](/create-a-page).
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```md
|
|
37
|
+
Let's see how to [Create a page](./create-a-page.md).
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Result:** Let's see how to [Create a page](./create-a-page.md).
|
|
41
|
+
|
|
42
|
+
## Images
|
|
43
|
+
|
|
44
|
+
Regular Markdown images are supported.
|
|
45
|
+
|
|
46
|
+
Add an image at `static/img/docusaurus.png` and display it in Markdown:
|
|
47
|
+
|
|
48
|
+
```md
|
|
49
|
+

|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+

|
|
53
|
+
|
|
54
|
+
## Code Blocks
|
|
55
|
+
|
|
56
|
+
Markdown code blocks are supported with Syntax highlighting.
|
|
57
|
+
|
|
58
|
+
```jsx title="src/components/HelloDocusaurus.js"
|
|
59
|
+
function HelloDocusaurus() {
|
|
60
|
+
return (
|
|
61
|
+
<h1>Hello, Docusaurus!</h1>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```jsx title="src/components/HelloDocusaurus.js"
|
|
67
|
+
function HelloDocusaurus() {
|
|
68
|
+
return <h1>Hello, Docusaurus!</h1>;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Admonitions
|
|
73
|
+
|
|
74
|
+
Docusaurus has a special syntax to create admonitions and callouts:
|
|
75
|
+
|
|
76
|
+
:::tip My tip
|
|
77
|
+
|
|
78
|
+
Use this awesome feature option
|
|
79
|
+
|
|
80
|
+
:::
|
|
81
|
+
|
|
82
|
+
:::danger Take care
|
|
83
|
+
|
|
84
|
+
This action is dangerous
|
|
85
|
+
|
|
86
|
+
:::
|
|
87
|
+
|
|
88
|
+
:::tip My tip
|
|
89
|
+
|
|
90
|
+
Use this awesome feature option
|
|
91
|
+
|
|
92
|
+
:::
|
|
93
|
+
|
|
94
|
+
:::danger Take care
|
|
95
|
+
|
|
96
|
+
This action is dangerous
|
|
97
|
+
|
|
98
|
+
:::
|
|
99
|
+
|
|
100
|
+
## MDX and React Components
|
|
101
|
+
|
|
102
|
+
[MDX](https://mdxjs.com/) can make your documentation more **interactive** and allows using any **React components inside Markdown**:
|
|
103
|
+
|
|
104
|
+
```jsx
|
|
105
|
+
export const Highlight = ({children, color}) => (
|
|
106
|
+
<span
|
|
107
|
+
style={{
|
|
108
|
+
backgroundColor: color,
|
|
109
|
+
borderRadius: '20px',
|
|
110
|
+
color: '#fff',
|
|
111
|
+
padding: '10px',
|
|
112
|
+
cursor: 'pointer',
|
|
113
|
+
}}
|
|
114
|
+
onClick={() => {
|
|
115
|
+
alert(`You clicked the color ${color} with label ${children}`)
|
|
116
|
+
}}>
|
|
117
|
+
{children}
|
|
118
|
+
</span>
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !
|
|
122
|
+
|
|
123
|
+
This is <Highlight color="#1877F2">Facebook blue</Highlight> !
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
export const Highlight = ({ children, color }) => (
|
|
127
|
+
<span
|
|
128
|
+
style={{
|
|
129
|
+
backgroundColor: color,
|
|
130
|
+
borderRadius: "20px",
|
|
131
|
+
color: "#fff",
|
|
132
|
+
padding: "10px",
|
|
133
|
+
cursor: "pointer",
|
|
134
|
+
}}
|
|
135
|
+
onClick={() => {
|
|
136
|
+
alert(`You clicked the color ${color} with label ${children}`);
|
|
137
|
+
}}
|
|
138
|
+
>
|
|
139
|
+
{children}
|
|
140
|
+
</span>
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !
|
|
144
|
+
|
|
145
|
+
This is <Highlight color="#1877F2">Facebook blue</Highlight> !
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
tags:
|
|
4
|
+
- test
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Manage Docs Versions
|
|
8
|
+
|
|
9
|
+
Docusaurus can manage multiple versions of your docs.
|
|
10
|
+
|
|
11
|
+
## Create a docs version
|
|
12
|
+
|
|
13
|
+
Release a version 1.0 of your project:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run docusaurus docs:version 1.0
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The `docs` folder is copied into `versioned_docs/version-1.0` and `versions.json` is created.
|
|
20
|
+
|
|
21
|
+
Your docs now have 2 versions:
|
|
22
|
+
|
|
23
|
+
- `1.0` at `http://localhost:3000/docs/` for the version 1.0 docs
|
|
24
|
+
- `current` at `http://localhost:3000/docs/next/` for the **upcoming, unreleased docs**
|
|
25
|
+
|
|
26
|
+
## Add a Version Dropdown
|
|
27
|
+
|
|
28
|
+
To navigate seamlessly across versions, add a version dropdown.
|
|
29
|
+
|
|
30
|
+
Modify the `docusaurus.config.js` file:
|
|
31
|
+
|
|
32
|
+
```js title="docusaurus.config.js"
|
|
33
|
+
module.exports = {
|
|
34
|
+
themeConfig: {
|
|
35
|
+
navbar: {
|
|
36
|
+
items: [
|
|
37
|
+
// highlight-start
|
|
38
|
+
{
|
|
39
|
+
type: "docsVersionDropdown",
|
|
40
|
+
},
|
|
41
|
+
// highlight-end
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The docs version dropdown appears in your navbar:
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
## Update an existing version
|
|
53
|
+
|
|
54
|
+
It is possible to edit versioned docs in their respective folder:
|
|
55
|
+
|
|
56
|
+
- `versioned_docs/version-1.0/hello.md` updates `http://localhost:3000/docs/hello`
|
|
57
|
+
- `docs/hello.md` updates `http://localhost:3000/docs/next/hello`
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 2
|
|
3
|
+
tags:
|
|
4
|
+
- test
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Translate your site
|
|
8
|
+
|
|
9
|
+
Let's translate `docs/intro.md` to French.
|
|
10
|
+
|
|
11
|
+
## Configure i18n
|
|
12
|
+
|
|
13
|
+
Modify `docusaurus.config.js` to add support for the `fr` locale:
|
|
14
|
+
|
|
15
|
+
```js title="docusaurus.config.js"
|
|
16
|
+
module.exports = {
|
|
17
|
+
i18n: {
|
|
18
|
+
defaultLocale: "en",
|
|
19
|
+
locales: ["en", "fr"],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Translate a doc
|
|
25
|
+
|
|
26
|
+
Copy the `docs/intro.md` file to the `i18n/fr` folder:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/
|
|
30
|
+
|
|
31
|
+
cp docs/intro.md i18n/fr/docusaurus-plugin-content-docs/current/intro.md
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Translate `i18n/fr/docusaurus-plugin-content-docs/current/intro.md` in French.
|
|
35
|
+
|
|
36
|
+
## Start your localized site
|
|
37
|
+
|
|
38
|
+
Start your site on the French locale:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm run start -- --locale fr
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Your localized site is accessible at `http://localhost:3000/fr/` and the `Getting Started` page is translated.
|
|
45
|
+
|
|
46
|
+
:::caution
|
|
47
|
+
|
|
48
|
+
In development, you can only use one locale at a same time.
|
|
49
|
+
|
|
50
|
+
:::
|
|
51
|
+
|
|
52
|
+
## Add a Locale Dropdown
|
|
53
|
+
|
|
54
|
+
To navigate seamlessly across languages, add a locale dropdown.
|
|
55
|
+
|
|
56
|
+
Modify the `docusaurus.config.js` file:
|
|
57
|
+
|
|
58
|
+
```js title="docusaurus.config.js"
|
|
59
|
+
module.exports = {
|
|
60
|
+
themeConfig: {
|
|
61
|
+
navbar: {
|
|
62
|
+
items: [
|
|
63
|
+
// highlight-start
|
|
64
|
+
{
|
|
65
|
+
type: "localeDropdown",
|
|
66
|
+
},
|
|
67
|
+
// highlight-end
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The locale dropdown now appears in your navbar:
|
|
75
|
+
|
|
76
|
+

|
|
77
|
+
|
|
78
|
+
## Build your localized site
|
|
79
|
+
|
|
80
|
+
Build your site for a specific locale:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm run build -- --locale fr
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or build your site to include all the locales at once:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm run build
|
|
90
|
+
```
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// Note: type annotations allow type checking and IDEs autocompletion
|
|
3
|
+
|
|
4
|
+
import type * as Preset from "@docusaurus/preset-classic";
|
|
5
|
+
import type { Config } from "@docusaurus/types";
|
|
6
|
+
import type * as Plugin from "@docusaurus/types/src/plugin";
|
|
7
|
+
import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs";
|
|
8
|
+
|
|
9
|
+
const config: Config = {
|
|
10
|
+
future: {
|
|
11
|
+
faster: true,
|
|
12
|
+
v4: true,
|
|
13
|
+
},
|
|
14
|
+
title: "My Site",
|
|
15
|
+
tagline: "Dinosaurs are cool",
|
|
16
|
+
url: "https://your-docusaurus-test-site.com",
|
|
17
|
+
baseUrl: "/",
|
|
18
|
+
onBrokenLinks: "throw",
|
|
19
|
+
favicon: "img/favicon.ico",
|
|
20
|
+
|
|
21
|
+
markdown: {
|
|
22
|
+
hooks: {
|
|
23
|
+
onBrokenMarkdownLinks: "warn",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
// GitHub pages deployment config.
|
|
28
|
+
// If you aren't using GitHub pages, you don't need these.
|
|
29
|
+
organizationName: "facebook", // Usually your GitHub org/user name.
|
|
30
|
+
projectName: "docusaurus", // Usually your repo name.
|
|
31
|
+
|
|
32
|
+
presets: [
|
|
33
|
+
[
|
|
34
|
+
"classic",
|
|
35
|
+
{
|
|
36
|
+
docs: {
|
|
37
|
+
sidebarPath: "./sidebars.ts",
|
|
38
|
+
// Please change this to your repo.
|
|
39
|
+
// Remove this to remove the "edit this page" links.
|
|
40
|
+
editUrl:
|
|
41
|
+
"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
|
|
42
|
+
docItemComponent: "@theme/ApiItem", // Derived from docusaurus-theme-openapi
|
|
43
|
+
},
|
|
44
|
+
blog: {
|
|
45
|
+
showReadingTime: true,
|
|
46
|
+
// Please change this to your repo.
|
|
47
|
+
// Remove this to remove the "edit this page" links.
|
|
48
|
+
editUrl:
|
|
49
|
+
"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
|
|
50
|
+
onInlineAuthors: "ignore",
|
|
51
|
+
onUntruncatedBlogPosts: "ignore",
|
|
52
|
+
},
|
|
53
|
+
theme: {
|
|
54
|
+
customCss: "./src/css/custom.css",
|
|
55
|
+
},
|
|
56
|
+
} satisfies Preset.Options,
|
|
57
|
+
],
|
|
58
|
+
],
|
|
59
|
+
|
|
60
|
+
themeConfig: {
|
|
61
|
+
docs: {
|
|
62
|
+
sidebar: {
|
|
63
|
+
hideable: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
navbar: {
|
|
67
|
+
title: "My Site",
|
|
68
|
+
logo: {
|
|
69
|
+
alt: "My Site Logo",
|
|
70
|
+
src: "img/logo.svg",
|
|
71
|
+
},
|
|
72
|
+
items: [
|
|
73
|
+
{
|
|
74
|
+
type: "doc",
|
|
75
|
+
docId: "intro",
|
|
76
|
+
position: "left",
|
|
77
|
+
label: "Tutorial",
|
|
78
|
+
},
|
|
79
|
+
{ to: "/blog", label: "Blog", position: "left" },
|
|
80
|
+
{
|
|
81
|
+
label: "Petstore API",
|
|
82
|
+
position: "left",
|
|
83
|
+
to: "/docs/category/petstore-api",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
href: "https://github.com/facebook/docusaurus",
|
|
87
|
+
label: "GitHub",
|
|
88
|
+
position: "right",
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
footer: {
|
|
93
|
+
style: "dark",
|
|
94
|
+
links: [
|
|
95
|
+
{
|
|
96
|
+
title: "Docs",
|
|
97
|
+
items: [
|
|
98
|
+
{
|
|
99
|
+
label: "Tutorial",
|
|
100
|
+
to: "/docs/intro",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: "Community",
|
|
106
|
+
items: [
|
|
107
|
+
{
|
|
108
|
+
label: "Stack Overflow",
|
|
109
|
+
href: "https://stackoverflow.com/questions/tagged/docusaurus",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: "Discord",
|
|
113
|
+
href: "https://discordapp.com/invite/docusaurus",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: "Twitter",
|
|
117
|
+
href: "https://twitter.com/docusaurus",
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: "More",
|
|
123
|
+
items: [
|
|
124
|
+
{
|
|
125
|
+
label: "Blog",
|
|
126
|
+
to: "/blog",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: "GitHub",
|
|
130
|
+
href: "https://github.com/facebook/docusaurus",
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
|
|
136
|
+
},
|
|
137
|
+
prism: {
|
|
138
|
+
additionalLanguages: [
|
|
139
|
+
"ruby",
|
|
140
|
+
"csharp",
|
|
141
|
+
"php",
|
|
142
|
+
"java",
|
|
143
|
+
"powershell",
|
|
144
|
+
"json",
|
|
145
|
+
"bash",
|
|
146
|
+
"dart",
|
|
147
|
+
"objectivec",
|
|
148
|
+
"r",
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
languageTabs: [
|
|
152
|
+
{
|
|
153
|
+
highlight: "python",
|
|
154
|
+
language: "python",
|
|
155
|
+
logoClass: "python",
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
highlight: "bash",
|
|
159
|
+
language: "curl",
|
|
160
|
+
logoClass: "curl",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
highlight: "csharp",
|
|
164
|
+
language: "csharp",
|
|
165
|
+
logoClass: "csharp",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
highlight: "go",
|
|
169
|
+
language: "go",
|
|
170
|
+
logoClass: "go",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
highlight: "javascript",
|
|
174
|
+
language: "nodejs",
|
|
175
|
+
logoClass: "nodejs",
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
highlight: "ruby",
|
|
179
|
+
language: "ruby",
|
|
180
|
+
logoClass: "ruby",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
highlight: "php",
|
|
184
|
+
language: "php",
|
|
185
|
+
logoClass: "php",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
highlight: "java",
|
|
189
|
+
language: "java",
|
|
190
|
+
logoClass: "java",
|
|
191
|
+
variant: "unirest",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
highlight: "powershell",
|
|
195
|
+
language: "powershell",
|
|
196
|
+
logoClass: "powershell",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
highlight: "dart",
|
|
200
|
+
language: "dart",
|
|
201
|
+
logoClass: "dart",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
highlight: "javascript",
|
|
205
|
+
language: "javascript",
|
|
206
|
+
logoClass: "javascript",
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
highlight: "c",
|
|
210
|
+
language: "c",
|
|
211
|
+
logoClass: "c",
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
highlight: "objective-c",
|
|
215
|
+
language: "objective-c",
|
|
216
|
+
logoClass: "objective-c",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
highlight: "ocaml",
|
|
220
|
+
language: "ocaml",
|
|
221
|
+
logoClass: "ocaml",
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
highlight: "r",
|
|
225
|
+
language: "r",
|
|
226
|
+
logoClass: "r",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
highlight: "swift",
|
|
230
|
+
language: "swift",
|
|
231
|
+
logoClass: "swift",
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
highlight: "kotlin",
|
|
235
|
+
language: "kotlin",
|
|
236
|
+
logoClass: "kotlin",
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
highlight: "rust",
|
|
240
|
+
language: "rust",
|
|
241
|
+
logoClass: "rust",
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
} satisfies Preset.ThemeConfig,
|
|
245
|
+
|
|
246
|
+
plugins: [
|
|
247
|
+
[
|
|
248
|
+
"docusaurus-plugin-openapi-docs",
|
|
249
|
+
{
|
|
250
|
+
id: "openapi",
|
|
251
|
+
docsPluginId: "classic",
|
|
252
|
+
config: {
|
|
253
|
+
petstore: {
|
|
254
|
+
specPath: "examples/petstore.yaml",
|
|
255
|
+
outputDir: "docs/petstore",
|
|
256
|
+
downloadUrl:
|
|
257
|
+
"https://raw.githubusercontent.com/PaloAltoNetworks/docusaurus-template-openapi-docs/main/examples/petstore.yaml",
|
|
258
|
+
sidebarOptions: {
|
|
259
|
+
groupPathsBy: "tag",
|
|
260
|
+
categoryLinkSource: "tag",
|
|
261
|
+
},
|
|
262
|
+
} satisfies OpenApiPlugin.Options,
|
|
263
|
+
} satisfies Plugin.PluginOptions,
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
],
|
|
267
|
+
|
|
268
|
+
themes: ["docusaurus-theme-openapi-docs"],
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export default async function createConfig() {
|
|
272
|
+
return config;
|
|
273
|
+
}
|