mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-04 20:02:54 +02:00
feat(core): support TypeScript + ESM configuration (#9317)
Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
336a44f3ea
commit
45f1a669b5
126 changed files with 2054 additions and 914 deletions
|
@ -38,7 +38,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
// highlight-start
|
||||
colorMode: {
|
||||
|
@ -80,7 +80,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
// highlight-next-line
|
||||
image: 'img/docusaurus.png',
|
||||
|
@ -109,7 +109,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
// highlight-next-line
|
||||
metadata: [{name: 'twitter:card', content: 'summary'}],
|
||||
|
@ -142,7 +142,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
// highlight-start
|
||||
announcementBar: {
|
||||
|
@ -209,7 +209,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
title: 'Site Title',
|
||||
|
@ -236,7 +236,7 @@ module.exports = {
|
|||
You can add items to the navbar via `themeConfig.navbar.items`.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
// highlight-start
|
||||
|
@ -311,7 +311,7 @@ In addition to the fields above, you can specify other arbitrary attributes that
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -368,7 +368,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -422,7 +422,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -471,7 +471,7 @@ Use this navbar item type if your sidebar is updated often and the order is not
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -490,7 +490,7 @@ module.exports = {
|
|||
```
|
||||
|
||||
```js title="sidebars.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
tutorial: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
|
@ -537,7 +537,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -580,7 +580,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -625,7 +625,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -668,7 +668,7 @@ However, with this special navbar item type, you can change the default location
|
|||
```
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -704,7 +704,7 @@ You can also render your own HTML markup inside a navbar item using this navbar
|
|||
```
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
|
@ -726,7 +726,7 @@ module.exports = {
|
|||
You can enable this cool UI feature that automatically hides the navbar when a user starts scrolling down the page, and show it again when the user scrolls up.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
// highlight-next-line
|
||||
|
@ -743,7 +743,7 @@ You can set the static Navbar style without disabling the theme switching abilit
|
|||
Currently, there are two possible style options: `dark` and `primary` (based on the `--ifm-color-primary` color). You can see the styles preview in the [Infima documentation](https://infima.dev/docs/components/navbar/).
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
// highlight-next-line
|
||||
|
@ -799,14 +799,14 @@ By default, we use [Palenight](https://github.com/FormidableLabs/prism-react-ren
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
const {themes} = require('prism-react-renderer');
|
||||
import {themes as prismThemes} from 'prism-react-renderer';
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
prism: {
|
||||
// highlight-start
|
||||
theme: themes.github,
|
||||
darkTheme: themes.dracula,
|
||||
theme: prismThemes.github,
|
||||
darkTheme: prismThemes.dracula,
|
||||
// highlight-end
|
||||
},
|
||||
},
|
||||
|
@ -826,7 +826,7 @@ You can set a default language for code blocks if no language is added after the
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
prism: {
|
||||
// highlight-next-line
|
||||
|
@ -860,7 +860,7 @@ Accepted fields:
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
// highlight-start
|
||||
footer: {
|
||||
|
@ -917,7 +917,7 @@ Accepted fields of each `FooterItem`:
|
|||
Example multi-column configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
footer: {
|
||||
// highlight-start
|
||||
links: [
|
||||
|
@ -969,7 +969,7 @@ A simple footer just has a list of `FooterItem`s displayed in a row.
|
|||
Example simple configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
footer: {
|
||||
// highlight-start
|
||||
links: [
|
||||
|
@ -1018,7 +1018,7 @@ You can adjust the default table of contents via `themeConfig.tableOfContents`.
|
|||
Example configuration:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
export default {
|
||||
themeConfig: {
|
||||
// highlight-start
|
||||
tableOfContents: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue