mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 02:37:59 +02:00
chore: update examples for v3.0.0 (#9482)
This commit is contained in:
parent
a456fefca1
commit
b3e16c66f3
24 changed files with 5213 additions and 3537 deletions
2
examples/classic-typescript/docs/intro.md
generated
2
examples/classic-typescript/docs/intro.md
generated
|
@ -14,7 +14,7 @@ Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new
|
||||||
|
|
||||||
### What you'll need
|
### What you'll need
|
||||||
|
|
||||||
- [Node.js](https://nodejs.org/en/download/) version 16.14 or above:
|
- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
|
||||||
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
|
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
|
||||||
|
|
||||||
## Generate a new site
|
## Generate a new site
|
||||||
|
|
|
@ -42,7 +42,7 @@ This is my **first Docusaurus document**!
|
||||||
It is also possible to create your sidebar explicitly in `sidebars.js`:
|
It is also possible to create your sidebar explicitly in `sidebars.js`:
|
||||||
|
|
||||||
```js title="sidebars.js"
|
```js title="sidebars.js"
|
||||||
module.exports = {
|
export default {
|
||||||
tutorialSidebar: [
|
tutorialSidebar: [
|
||||||
'intro',
|
'intro',
|
||||||
// highlight-next-line
|
// highlight-next-line
|
||||||
|
|
|
@ -28,7 +28,7 @@ To navigate seamlessly across versions, add a version dropdown.
|
||||||
Modify the `docusaurus.config.js` file:
|
Modify the `docusaurus.config.js` file:
|
||||||
|
|
||||||
```js title="docusaurus.config.js"
|
```js title="docusaurus.config.js"
|
||||||
module.exports = {
|
export default {
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
navbar: {
|
navbar: {
|
||||||
items: [
|
items: [
|
||||||
|
|
|
@ -11,7 +11,7 @@ Let's translate `docs/intro.md` to French.
|
||||||
Modify `docusaurus.config.js` to add support for the `fr` locale:
|
Modify `docusaurus.config.js` to add support for the `fr` locale:
|
||||||
|
|
||||||
```js title="docusaurus.config.js"
|
```js title="docusaurus.config.js"
|
||||||
module.exports = {
|
export default {
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: 'en',
|
defaultLocale: 'en',
|
||||||
locales: ['en', 'fr'],
|
locales: ['en', 'fr'],
|
||||||
|
@ -43,7 +43,7 @@ Your localized site is accessible at [http://localhost:3000/fr/](http://localhos
|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
|
|
||||||
In development, you can only use one locale at a same time.
|
In development, you can only use one locale at a time.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ To navigate seamlessly across languages, add a locale dropdown.
|
||||||
Modify the `docusaurus.config.js` file:
|
Modify the `docusaurus.config.js` file:
|
||||||
|
|
||||||
```js title="docusaurus.config.js"
|
```js title="docusaurus.config.js"
|
||||||
module.exports = {
|
export default {
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
navbar: {
|
navbar: {
|
||||||
items: [
|
items: [
|
||||||
|
|
139
examples/classic-typescript/docusaurus.config.js
generated
139
examples/classic-typescript/docusaurus.config.js
generated
|
@ -1,139 +0,0 @@
|
||||||
// @ts-check
|
|
||||||
// Note: type annotations allow type checking and IDEs autocompletion
|
|
||||||
|
|
||||||
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
|
||||||
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
|
||||||
|
|
||||||
/** @type {import('@docusaurus/types').Config} */
|
|
||||||
const config = {
|
|
||||||
title: 'My Site',
|
|
||||||
tagline: 'Dinosaurs are cool',
|
|
||||||
favicon: 'img/favicon.ico',
|
|
||||||
|
|
||||||
// Set the production url of your site here
|
|
||||||
url: 'https://your-docusaurus-test-site.com',
|
|
||||||
// Set the /<baseUrl>/ pathname under which your site is served
|
|
||||||
// For GitHub pages deployment, it is often '/<projectName>/'
|
|
||||||
baseUrl: '/',
|
|
||||||
|
|
||||||
// GitHub pages deployment config.
|
|
||||||
// If you aren't using GitHub pages, you don't need these.
|
|
||||||
organizationName: 'facebook', // Usually your GitHub org/user name.
|
|
||||||
projectName: 'docusaurus', // Usually your repo name.
|
|
||||||
|
|
||||||
onBrokenLinks: 'throw',
|
|
||||||
onBrokenMarkdownLinks: 'warn',
|
|
||||||
|
|
||||||
// Even if you don't use internalization, you can use this field to set useful
|
|
||||||
// metadata like html lang. For example, if your site is Chinese, you may want
|
|
||||||
// to replace "en" with "zh-Hans".
|
|
||||||
i18n: {
|
|
||||||
defaultLocale: 'en',
|
|
||||||
locales: ['en'],
|
|
||||||
},
|
|
||||||
|
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
'classic',
|
|
||||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
|
||||||
({
|
|
||||||
docs: {
|
|
||||||
sidebarPath: require.resolve('./sidebars.js'),
|
|
||||||
// Please change this to your repo.
|
|
||||||
// Remove this to remove the "edit this page" links.
|
|
||||||
editUrl:
|
|
||||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
|
||||||
},
|
|
||||||
blog: {
|
|
||||||
showReadingTime: true,
|
|
||||||
// Please change this to your repo.
|
|
||||||
// Remove this to remove the "edit this page" links.
|
|
||||||
editUrl:
|
|
||||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
|
||||||
},
|
|
||||||
theme: {
|
|
||||||
customCss: require.resolve('./src/css/custom.css'),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
themeConfig:
|
|
||||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
|
||||||
({
|
|
||||||
// Replace with your project's social card
|
|
||||||
image: 'img/docusaurus-social-card.jpg',
|
|
||||||
navbar: {
|
|
||||||
title: 'My Site',
|
|
||||||
logo: {
|
|
||||||
alt: 'My Site Logo',
|
|
||||||
src: 'img/logo.svg',
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
type: 'docSidebar',
|
|
||||||
sidebarId: 'tutorialSidebar',
|
|
||||||
position: 'left',
|
|
||||||
label: 'Tutorial',
|
|
||||||
},
|
|
||||||
{to: '/blog', label: 'Blog', position: 'left'},
|
|
||||||
{
|
|
||||||
href: 'https://github.com/facebook/docusaurus',
|
|
||||||
label: 'GitHub',
|
|
||||||
position: 'right',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
style: 'dark',
|
|
||||||
links: [
|
|
||||||
{
|
|
||||||
title: 'Docs',
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
label: 'Tutorial',
|
|
||||||
to: '/docs/intro',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Community',
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
label: 'Stack Overflow',
|
|
||||||
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Discord',
|
|
||||||
href: 'https://discordapp.com/invite/docusaurus',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Twitter',
|
|
||||||
href: 'https://twitter.com/docusaurus',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'More',
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
label: 'Blog',
|
|
||||||
to: '/blog',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'GitHub',
|
|
||||||
href: 'https://github.com/facebook/docusaurus',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
|
|
||||||
},
|
|
||||||
prism: {
|
|
||||||
theme: lightCodeTheme,
|
|
||||||
darkTheme: darkCodeTheme,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = config;
|
|
133
examples/classic-typescript/docusaurus.config.ts
generated
Normal file
133
examples/classic-typescript/docusaurus.config.ts
generated
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
import {themes as prismThemes} from 'prism-react-renderer';
|
||||||
|
import type {Config} from '@docusaurus/types';
|
||||||
|
import type * as Preset from '@docusaurus/preset-classic';
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
|
title: 'My Site',
|
||||||
|
tagline: 'Dinosaurs are cool',
|
||||||
|
favicon: 'img/favicon.ico',
|
||||||
|
|
||||||
|
// Set the production url of your site here
|
||||||
|
url: 'https://your-docusaurus-site.example.com',
|
||||||
|
// Set the /<baseUrl>/ pathname under which your site is served
|
||||||
|
// For GitHub pages deployment, it is often '/<projectName>/'
|
||||||
|
baseUrl: '/',
|
||||||
|
|
||||||
|
// GitHub pages deployment config.
|
||||||
|
// If you aren't using GitHub pages, you don't need these.
|
||||||
|
organizationName: 'facebook', // Usually your GitHub org/user name.
|
||||||
|
projectName: 'docusaurus', // Usually your repo name.
|
||||||
|
|
||||||
|
onBrokenLinks: 'throw',
|
||||||
|
onBrokenMarkdownLinks: 'warn',
|
||||||
|
|
||||||
|
// Even if you don't use internationalization, you can use this field to set
|
||||||
|
// useful metadata like html lang. For example, if your site is Chinese, you
|
||||||
|
// may want to replace "en" with "zh-Hans".
|
||||||
|
i18n: {
|
||||||
|
defaultLocale: 'en',
|
||||||
|
locales: ['en'],
|
||||||
|
},
|
||||||
|
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
'classic',
|
||||||
|
{
|
||||||
|
docs: {
|
||||||
|
sidebarPath: './sidebars.ts',
|
||||||
|
// Please change this to your repo.
|
||||||
|
// Remove this to remove the "edit this page" links.
|
||||||
|
editUrl:
|
||||||
|
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||||
|
},
|
||||||
|
blog: {
|
||||||
|
showReadingTime: true,
|
||||||
|
// Please change this to your repo.
|
||||||
|
// Remove this to remove the "edit this page" links.
|
||||||
|
editUrl:
|
||||||
|
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
customCss: './src/css/custom.css',
|
||||||
|
},
|
||||||
|
} satisfies Preset.Options,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
themeConfig: {
|
||||||
|
// Replace with your project's social card
|
||||||
|
image: 'img/docusaurus-social-card.jpg',
|
||||||
|
navbar: {
|
||||||
|
title: 'My Site',
|
||||||
|
logo: {
|
||||||
|
alt: 'My Site Logo',
|
||||||
|
src: 'img/logo.svg',
|
||||||
|
},
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: 'docSidebar',
|
||||||
|
sidebarId: 'tutorialSidebar',
|
||||||
|
position: 'left',
|
||||||
|
label: 'Tutorial',
|
||||||
|
},
|
||||||
|
{to: '/blog', label: 'Blog', position: 'left'},
|
||||||
|
{
|
||||||
|
href: 'https://github.com/facebook/docusaurus',
|
||||||
|
label: 'GitHub',
|
||||||
|
position: 'right',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
style: 'dark',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
title: 'Docs',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: 'Tutorial',
|
||||||
|
to: '/docs/intro',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Community',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: 'Stack Overflow',
|
||||||
|
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Discord',
|
||||||
|
href: 'https://discordapp.com/invite/docusaurus',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Twitter',
|
||||||
|
href: 'https://twitter.com/docusaurus',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'More',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: 'Blog',
|
||||||
|
to: '/blog',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'GitHub',
|
||||||
|
href: 'https://github.com/facebook/docusaurus',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
|
||||||
|
},
|
||||||
|
prism: {
|
||||||
|
theme: prismThemes.github,
|
||||||
|
darkTheme: prismThemes.dracula,
|
||||||
|
},
|
||||||
|
} satisfies Preset.ThemeConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
27
examples/classic-typescript/package.json
generated
27
examples/classic-typescript/package.json
generated
|
@ -16,18 +16,19 @@
|
||||||
"dev": "docusaurus start"
|
"dev": "docusaurus start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "2.4.3",
|
"@docusaurus/core": "3.0.0",
|
||||||
"@docusaurus/preset-classic": "2.4.3",
|
"@docusaurus/preset-classic": "3.0.0",
|
||||||
"@mdx-js/react": "^1.6.22",
|
"@mdx-js/react": "^3.0.0",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"prism-react-renderer": "^1.3.5",
|
"prism-react-renderer": "^2.1.0",
|
||||||
"react": "^17.0.2",
|
"react": "^18.0.0",
|
||||||
"react-dom": "^17.0.2"
|
"react-dom": "^18.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@docusaurus/module-type-aliases": "2.4.3",
|
"@docusaurus/module-type-aliases": "3.0.0",
|
||||||
"@tsconfig/docusaurus": "^1.0.5",
|
"@docusaurus/tsconfig": "3.0.0",
|
||||||
"typescript": "^4.7.4"
|
"@docusaurus/types": "3.0.0",
|
||||||
|
"typescript": "~5.2.2"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
@ -36,13 +37,13 @@
|
||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
],
|
],
|
||||||
"development": [
|
"development": [
|
||||||
"last 1 chrome version",
|
"last 3 chrome version",
|
||||||
"last 1 firefox version",
|
"last 3 firefox version",
|
||||||
"last 1 safari version"
|
"last 5 safari version"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.14"
|
"node": ">=18.0"
|
||||||
},
|
},
|
||||||
"description": "Docusaurus example project (classic-typescript template)"
|
"description": "Docusaurus example project (classic-typescript template)"
|
||||||
}
|
}
|
||||||
|
|
4
examples/classic-typescript/sandbox.config.json
generated
4
examples/classic-typescript/sandbox.config.json
generated
|
@ -3,8 +3,8 @@
|
||||||
"hardReloadOnChange": true,
|
"hardReloadOnChange": true,
|
||||||
"view": "browser",
|
"view": "browser",
|
||||||
"template": "docusaurus",
|
"template": "docusaurus",
|
||||||
"node": "16",
|
"node": "18",
|
||||||
"container": {
|
"container": {
|
||||||
"node": "16"
|
"node": "18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creating a sidebar enables you to:
|
* Creating a sidebar enables you to:
|
||||||
- create an ordered group of docs
|
- create an ordered group of docs
|
||||||
|
@ -8,11 +10,7 @@
|
||||||
|
|
||||||
Create as many sidebars as you want.
|
Create as many sidebars as you want.
|
||||||
*/
|
*/
|
||||||
|
const sidebars: SidebarsConfig = {
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
||||||
const sidebars = {
|
|
||||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||||
|
|
||||||
|
@ -30,4 +28,4 @@ const sidebars = {
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = sidebars;
|
export default sidebars;
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
import Heading from '@theme/Heading';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
||||||
type FeatureItem = {
|
type FeatureItem = {
|
||||||
|
@ -48,7 +48,7 @@ function Feature({title, Svg, description}: FeatureItem) {
|
||||||
<Svg className={styles.featureSvg} role="img" />
|
<Svg className={styles.featureSvg} role="img" />
|
||||||
</div>
|
</div>
|
||||||
<div className="text--center padding-horiz--md">
|
<div className="text--center padding-horiz--md">
|
||||||
<h3>{title}</h3>
|
<Heading as="h3">{title}</Heading>
|
||||||
<p>{description}</p>
|
<p>{description}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
6
examples/classic-typescript/src/pages/index.tsx
generated
6
examples/classic-typescript/src/pages/index.tsx
generated
|
@ -1,9 +1,9 @@
|
||||||
import React from 'react';
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||||
import Layout from '@theme/Layout';
|
import Layout from '@theme/Layout';
|
||||||
import HomepageFeatures from '@site/src/components/HomepageFeatures';
|
import HomepageFeatures from '@site/src/components/HomepageFeatures';
|
||||||
|
import Heading from '@theme/Heading';
|
||||||
|
|
||||||
import styles from './index.module.css';
|
import styles from './index.module.css';
|
||||||
|
|
||||||
|
@ -12,7 +12,9 @@ function HomepageHeader() {
|
||||||
return (
|
return (
|
||||||
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<h1 className="hero__title">{siteConfig.title}</h1>
|
<Heading as="h1" className="hero__title">
|
||||||
|
{siteConfig.title}
|
||||||
|
</Heading>
|
||||||
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
||||||
<div className={styles.buttons}>
|
<div className={styles.buttons}>
|
||||||
<Link
|
<Link
|
||||||
|
|
2
examples/classic-typescript/tsconfig.json
generated
2
examples/classic-typescript/tsconfig.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
// This file is not used in compilation. It is here just for a nice editor experience.
|
// This file is not used in compilation. It is here just for a nice editor experience.
|
||||||
"extends": "@tsconfig/docusaurus/tsconfig.json",
|
"extends": "@docusaurus/tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "."
|
"baseUrl": "."
|
||||||
}
|
}
|
||||||
|
|
4176
examples/classic-typescript/yarn.lock
generated
4176
examples/classic-typescript/yarn.lock
generated
File diff suppressed because it is too large
Load diff
2
examples/classic/docs/intro.md
generated
2
examples/classic/docs/intro.md
generated
|
@ -14,7 +14,7 @@ Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new
|
||||||
|
|
||||||
### What you'll need
|
### What you'll need
|
||||||
|
|
||||||
- [Node.js](https://nodejs.org/en/download/) version 16.14 or above:
|
- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
|
||||||
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
|
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
|
||||||
|
|
||||||
## Generate a new site
|
## Generate a new site
|
||||||
|
|
|
@ -42,7 +42,7 @@ This is my **first Docusaurus document**!
|
||||||
It is also possible to create your sidebar explicitly in `sidebars.js`:
|
It is also possible to create your sidebar explicitly in `sidebars.js`:
|
||||||
|
|
||||||
```js title="sidebars.js"
|
```js title="sidebars.js"
|
||||||
module.exports = {
|
export default {
|
||||||
tutorialSidebar: [
|
tutorialSidebar: [
|
||||||
'intro',
|
'intro',
|
||||||
// highlight-next-line
|
// highlight-next-line
|
||||||
|
|
|
@ -28,7 +28,7 @@ To navigate seamlessly across versions, add a version dropdown.
|
||||||
Modify the `docusaurus.config.js` file:
|
Modify the `docusaurus.config.js` file:
|
||||||
|
|
||||||
```js title="docusaurus.config.js"
|
```js title="docusaurus.config.js"
|
||||||
module.exports = {
|
export default {
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
navbar: {
|
navbar: {
|
||||||
items: [
|
items: [
|
||||||
|
|
|
@ -11,7 +11,7 @@ Let's translate `docs/intro.md` to French.
|
||||||
Modify `docusaurus.config.js` to add support for the `fr` locale:
|
Modify `docusaurus.config.js` to add support for the `fr` locale:
|
||||||
|
|
||||||
```js title="docusaurus.config.js"
|
```js title="docusaurus.config.js"
|
||||||
module.exports = {
|
export default {
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: 'en',
|
defaultLocale: 'en',
|
||||||
locales: ['en', 'fr'],
|
locales: ['en', 'fr'],
|
||||||
|
@ -43,7 +43,7 @@ Your localized site is accessible at [http://localhost:3000/fr/](http://localhos
|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
|
|
||||||
In development, you can only use one locale at a same time.
|
In development, you can only use one locale at a time.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ To navigate seamlessly across languages, add a locale dropdown.
|
||||||
Modify the `docusaurus.config.js` file:
|
Modify the `docusaurus.config.js` file:
|
||||||
|
|
||||||
```js title="docusaurus.config.js"
|
```js title="docusaurus.config.js"
|
||||||
module.exports = {
|
export default {
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
navbar: {
|
navbar: {
|
||||||
items: [
|
items: [
|
||||||
|
|
26
examples/classic/docusaurus.config.js
generated
26
examples/classic/docusaurus.config.js
generated
|
@ -1,8 +1,10 @@
|
||||||
// @ts-check
|
// @ts-check
|
||||||
// Note: type annotations allow type checking and IDEs autocompletion
|
// `@type` JSDoc annotations allow editor autocompletion and type checking
|
||||||
|
// (when paired with `@ts-check`).
|
||||||
|
// There are various equivalent ways to declare your Docusaurus config.
|
||||||
|
// See: https://docusaurus.io/docs/api/docusaurus-config
|
||||||
|
|
||||||
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
import {themes as prismThemes} from 'prism-react-renderer';
|
||||||
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
|
||||||
|
|
||||||
/** @type {import('@docusaurus/types').Config} */
|
/** @type {import('@docusaurus/types').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
|
@ -11,7 +13,7 @@ const config = {
|
||||||
favicon: 'img/favicon.ico',
|
favicon: 'img/favicon.ico',
|
||||||
|
|
||||||
// Set the production url of your site here
|
// Set the production url of your site here
|
||||||
url: 'https://your-docusaurus-test-site.com',
|
url: 'https://your-docusaurus-site.example.com',
|
||||||
// Set the /<baseUrl>/ pathname under which your site is served
|
// Set the /<baseUrl>/ pathname under which your site is served
|
||||||
// For GitHub pages deployment, it is often '/<projectName>/'
|
// For GitHub pages deployment, it is often '/<projectName>/'
|
||||||
baseUrl: '/',
|
baseUrl: '/',
|
||||||
|
@ -24,9 +26,9 @@ const config = {
|
||||||
onBrokenLinks: 'throw',
|
onBrokenLinks: 'throw',
|
||||||
onBrokenMarkdownLinks: 'warn',
|
onBrokenMarkdownLinks: 'warn',
|
||||||
|
|
||||||
// Even if you don't use internalization, you can use this field to set useful
|
// Even if you don't use internationalization, you can use this field to set
|
||||||
// metadata like html lang. For example, if your site is Chinese, you may want
|
// useful metadata like html lang. For example, if your site is Chinese, you
|
||||||
// to replace "en" with "zh-Hans".
|
// may want to replace "en" with "zh-Hans".
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: 'en',
|
defaultLocale: 'en',
|
||||||
locales: ['en'],
|
locales: ['en'],
|
||||||
|
@ -38,7 +40,7 @@ const config = {
|
||||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
/** @type {import('@docusaurus/preset-classic').Options} */
|
||||||
({
|
({
|
||||||
docs: {
|
docs: {
|
||||||
sidebarPath: require.resolve('./sidebars.js'),
|
sidebarPath: './sidebars.js',
|
||||||
// Please change this to your repo.
|
// Please change this to your repo.
|
||||||
// Remove this to remove the "edit this page" links.
|
// Remove this to remove the "edit this page" links.
|
||||||
editUrl:
|
editUrl:
|
||||||
|
@ -52,7 +54,7 @@ const config = {
|
||||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
customCss: require.resolve('./src/css/custom.css'),
|
customCss: './src/css/custom.css',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -130,10 +132,10 @@ const config = {
|
||||||
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
|
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
|
||||||
},
|
},
|
||||||
prism: {
|
prism: {
|
||||||
theme: lightCodeTheme,
|
theme: prismThemes.github,
|
||||||
darkTheme: darkCodeTheme,
|
darkTheme: prismThemes.dracula,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
export default config;
|
||||||
|
|
23
examples/classic/package.json
generated
23
examples/classic/package.json
generated
|
@ -15,16 +15,17 @@
|
||||||
"dev": "docusaurus start"
|
"dev": "docusaurus start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "2.4.3",
|
"@docusaurus/core": "3.0.0",
|
||||||
"@docusaurus/preset-classic": "2.4.3",
|
"@docusaurus/preset-classic": "3.0.0",
|
||||||
"@mdx-js/react": "^1.6.22",
|
"@mdx-js/react": "^3.0.0",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"prism-react-renderer": "^1.3.5",
|
"prism-react-renderer": "^2.1.0",
|
||||||
"react": "^17.0.2",
|
"react": "^18.0.0",
|
||||||
"react-dom": "^17.0.2"
|
"react-dom": "^18.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@docusaurus/module-type-aliases": "2.4.3"
|
"@docusaurus/module-type-aliases": "3.0.0",
|
||||||
|
"@docusaurus/types": "3.0.0"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
@ -33,13 +34,13 @@
|
||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
],
|
],
|
||||||
"development": [
|
"development": [
|
||||||
"last 1 chrome version",
|
"last 3 chrome version",
|
||||||
"last 1 firefox version",
|
"last 3 firefox version",
|
||||||
"last 1 safari version"
|
"last 5 safari version"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.14"
|
"node": ">=18.0"
|
||||||
},
|
},
|
||||||
"description": "Docusaurus example project"
|
"description": "Docusaurus example project"
|
||||||
}
|
}
|
||||||
|
|
4
examples/classic/sandbox.config.json
generated
4
examples/classic/sandbox.config.json
generated
|
@ -3,8 +3,8 @@
|
||||||
"hardReloadOnChange": true,
|
"hardReloadOnChange": true,
|
||||||
"view": "browser",
|
"view": "browser",
|
||||||
"template": "docusaurus",
|
"template": "docusaurus",
|
||||||
"node": "16",
|
"node": "18",
|
||||||
"container": {
|
"container": {
|
||||||
"node": "16"
|
"node": "18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
examples/classic/sidebars.js
generated
2
examples/classic/sidebars.js
generated
|
@ -30,4 +30,4 @@ const sidebars = {
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = sidebars;
|
export default sidebars;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
import Heading from '@theme/Heading';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
||||||
const FeatureList = [
|
const FeatureList = [
|
||||||
|
@ -42,7 +42,7 @@ function Feature({Svg, title, description}) {
|
||||||
<Svg className={styles.featureSvg} role="img" />
|
<Svg className={styles.featureSvg} role="img" />
|
||||||
</div>
|
</div>
|
||||||
<div className="text--center padding-horiz--md">
|
<div className="text--center padding-horiz--md">
|
||||||
<h3>{title}</h3>
|
<Heading as="h3">{title}</Heading>
|
||||||
<p>{description}</p>
|
<p>{description}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
6
examples/classic/src/pages/index.js
generated
6
examples/classic/src/pages/index.js
generated
|
@ -1,10 +1,10 @@
|
||||||
import React from 'react';
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||||
import Layout from '@theme/Layout';
|
import Layout from '@theme/Layout';
|
||||||
import HomepageFeatures from '@site/src/components/HomepageFeatures';
|
import HomepageFeatures from '@site/src/components/HomepageFeatures';
|
||||||
|
|
||||||
|
import Heading from '@theme/Heading';
|
||||||
import styles from './index.module.css';
|
import styles from './index.module.css';
|
||||||
|
|
||||||
function HomepageHeader() {
|
function HomepageHeader() {
|
||||||
|
@ -12,7 +12,9 @@ function HomepageHeader() {
|
||||||
return (
|
return (
|
||||||
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<h1 className="hero__title">{siteConfig.title}</h1>
|
<Heading as="h1" className="hero__title">
|
||||||
|
{siteConfig.title}
|
||||||
|
</Heading>
|
||||||
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
||||||
<div className={styles.buttons}>
|
<div className={styles.buttons}>
|
||||||
<Link
|
<Link
|
||||||
|
|
4160
examples/classic/yarn.lock
generated
4160
examples/classic/yarn.lock
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue