diff --git a/website/docs/blog.md b/website/docs/blog.md index aa61e0bacd66..a0a4bc41ab36 100644 --- a/website/docs/blog.md +++ b/website/docs/blog.md @@ -118,13 +118,13 @@ module.exports = { Accessing the feed: -The feed for RSS can be found at +The feed for RSS can be found at: ```text https://{your-domain}/blog/rss.xml ``` -and for atom +and for Atom: ```text https://{your-domain}/blog/atom.xml @@ -134,9 +134,7 @@ https://{your-domain}/blog/atom.xml ### Blog-only mode -You can run your Docusaurus 2 site without a landing page and instead have your blog's post list page as the index page. Set the `routeBasePath` to be `''` to indicate it's the root path. - -**Note:** Make sure there's no `index.js` page in `src/pages` or else there will be two files mapping to the same route! +You can run your Docusaurus 2 site without a landing page and instead have your blog's post list page as the index page. Set the `routeBasePath` to be `'/'` to indicate it's the root path. ```js {9} title="docusaurus.config.js" module.exports = { @@ -155,6 +153,12 @@ module.exports = { }; ``` +:::note + +Make sure there's no `index.js` page in `src/pages` or else there will be two files mapping to the same route! + +::: + `| +| Language | Syntax | +| ---------- | ------------------------ | +| JavaScript | `/* ... */` and `// ...` | +| JSX | `{/* ... */}` | +| Python | `# ...` | +| HTML | `` | If there's a syntax that is not currently supported, we are open to adding them! Pull requests welcome. @@ -674,7 +682,7 @@ module.exports = { // ... themes: ['@docusaurus/theme-live-codeblock'], // ... -} +}; ``` To use the plugin, create a code block with `live` attached to the language meta string. diff --git a/website/docs/migrating-from-v1-to-v2.md b/website/docs/migrating-from-v1-to-v2.md index b281f50857d8..09b8feae5f2b 100644 --- a/website/docs/migrating-from-v1-to-v2.md +++ b/website/docs/migrating-from-v1-to-v2.md @@ -151,9 +151,9 @@ module.exports = { '@docusaurus/preset-classic', { docs: { - // docs folder path relative to website dir. + // Docs folder path relative to website dir. path: '../docs', - // sidebars file relative to website dir. + // Sidebars file relative to website dir. sidebarPath: require.resolve('./sidebars.json'), }, // ... @@ -231,10 +231,10 @@ module.exports = { src: 'https://docusaurus.io/img/oss_logo.png', href: 'https://opensource.facebook.com/', }, - copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`, // You can also put own HTML here + copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`, // You can also put own HTML here. }, image: 'img/docusaurus.png', - // Equivalent to `docsSideNavCollapsible` + // Equivalent to `docsSideNavCollapsible`. sidebarCollapsible: false, // ... }, @@ -292,7 +292,7 @@ module.exports = { algolia: { apiKey: '47ecd3b21be71c5822571b9f59e52544', indexName: 'docusaurus-2', - algoliaOptions: { ... }, + algoliaOptions: { //... }, }, // ... }, @@ -340,7 +340,7 @@ module.exports = { docs: { // Equivalent to `customDocsPath`. path: 'docs', - // Equivalent to `editUrl` but should point to `website` dir instead of `website/docs` + // Equivalent to `editUrl` but should point to `website` dir instead of `website/docs`. editUrl: 'https://github.com/facebook/docusaurus/edit/master/website', // Equivalent to `docsUrl`. routeBasePath: 'docs', @@ -471,7 +471,7 @@ In Docusaurus 2, the markdown syntax has been changed to [MDX](https://mdxjs.com **Tips**: You might want to use some online tools like [HTML to JSX](https://transform.tools/html-to-jsx) to make the migration easier. -### Language-specific Code Tabs +### Language-specific code tabs Refer to the [multi-language support code blocks](markdown-features.mdx#multi-language-support-code-blocks) section. @@ -502,7 +502,7 @@ my-project └── static ``` -Start the development server and fix any errors +Start the development server and fix any errors: ```bash cd website diff --git a/website/docs/presets.md b/website/docs/presets.md index fd1372cf613f..872be9dc31b7 100644 --- a/website/docs/presets.md +++ b/website/docs/presets.md @@ -5,7 +5,7 @@ title: Presets Presets are collections of plugins and themes. -## Using Presets +## Using presets A preset is usually a npm package, so you install them like other npm packages using npm. @@ -33,7 +33,7 @@ module.exports = { }; ``` -## Presets -> Themes and Plugins +## Presets -> themes and plugins Presets in some way are a shorthand function to add plugins and themes to your docusaurus config. For example, you can specify a preset that includes the following themes and plugins, @@ -66,7 +66,7 @@ module.exports = { This is especially useful when some plugins and themes are intended to be used together. -## Official Presets +## Official presets ### `@docusaurus/preset-classic` diff --git a/website/docs/static-assets.md b/website/docs/static-assets.md index d13b1b5a02ec..35a7c2dabeb2 100644 --- a/website/docs/static-assets.md +++ b/website/docs/static-assets.md @@ -28,17 +28,18 @@ import useBaseUrl from '@docusaurus/useBaseUrl'; Thanks to MDX, you can also use `useBaseUrl` utility function in Markdown files! You'd have to use `` tags instead of the Markdown image syntax though. The syntax is exactly the same as in JSX. -```txt title="my-doc.mdx" +```jsx title="my-doc.mdx" --- id: my-doc title: My Doc --- -import useBaseUrl from '@docusaurus/useBaseUrl'; // Add to the top of the file below the front matter. +// Add to the top of the file below the front matter. +import useBaseUrl from '@docusaurus/useBaseUrl'; ... -Docusaurus with Keytar; +Docusaurus with Keytar ``` You could also just use Markdown image syntax, but you would have to manually maintain the image paths yourself and isn't recommended. diff --git a/website/docs/styling-layout.md b/website/docs/styling-layout.md index e7b26aa627cb..e1bc74fe6454 100644 --- a/website/docs/styling-layout.md +++ b/website/docs/styling-layout.md @@ -187,7 +187,7 @@ Name your stylesheet files with the `.module.scss` suffix (e.g. `welcome.module. } ``` -```javascript +```jsx import styles from './styles.module.scss'; function MyComponent() { diff --git a/website/docs/theme-classic.md b/website/docs/theme-classic.md index 547d1ab11a00..9d3cc36ccb23 100644 --- a/website/docs/theme-classic.md +++ b/website/docs/theme-classic.md @@ -57,16 +57,16 @@ module.exports = { Sometimes you want to announce something in your website. Just for such a case, you can add an announcement bar. This is a non-fixed and dismissable panel above the navbar. -```js {4-9} title="docusaurus.config.js" +```js {4-10} title="docusaurus.config.js" module.exports = { // ... themeConfig: { announcementBar: { - id: 'support_us', // Any value that will identify this message + id: 'support_us', // Any value that will identify this message. content: 'We are looking to revamp our docs, please fill this survey', - backgroundColor: '#fafbfc', // Defaults to `#fff` - textColor: '#091E42', // Defaults to `#000` + backgroundColor: '#fafbfc', // Defaults to `#fff`. + textColor: '#091E42', // Defaults to `#000`. }, // ... }, @@ -86,7 +86,7 @@ import React from 'react'; // highlight-next-line import useThemeContext from '@theme/hooks/useThemeContext'; -const Test = () => { +const Example = () => { // highlight-next-line const {isDarkTheme, setLightTheme, setDarkTheme} = useThemeContext(); @@ -96,7 +96,7 @@ const Test = () => { ## Navbar -### Navbar Title & Logo +### Navbar title & logo You can add a logo and title to the navbar via `themeConfig.navbar`. Logo can be placed in [static folder](static-assets.md). Logo URL is set to base URL of your site by default. Although you can specify your own URL for the logo, if it is an external link, it will open in a new tab. In addition, you can override a value for the target attribute of logo link, it can come in handy if you are hosting docs website in a subdirectory of your main website, and in which case you probably do not need a link in the logo to the main website will open in a new tab. @@ -111,9 +111,9 @@ module.exports = { logo: { alt: 'Site Logo', src: 'img/logo.svg', - srcDark: 'img/logo_dark.svg', // default to logo.src - href: 'https://v2.docusaurus.io/', // default to siteConfig.baseUrl - target: '_self', // by default, this value is calculated based on the `href` attribute (the external link will open in a new tab, all others in the current one) + srcDark: 'img/logo_dark.svg', // Default to `logo.src`. + href: 'https://v2.docusaurus.io/', // Default to `siteConfig.baseUrl`. + target: '_self', // By default, this value is calculated based on the `href` attribute (the external link will open in a new tab, all others in the current one). }, }, // ... @@ -121,7 +121,7 @@ module.exports = { }; ``` -### Navbar Links +### Navbar links You can add links to the navbar via `themeConfig.navbar.links`: @@ -165,7 +165,7 @@ React Router should automatically apply active link styling to links, but you ca Outbound (external) links automatically get `target="_blank" rel="noopener noreferrer"` attributes. -### Navbar Dropdown +### Navbar dropdown Navbar items can also be dropdown items by specifying the `items`, an inner array of navbar links. @@ -213,10 +213,14 @@ module.exports = { }; ``` + + ## CodeBlock Docusaurus uses [Prism React Renderer](https://github.com/FormidableLabs/prism-react-renderer) to highlight code blocks. @@ -238,7 +242,11 @@ module.exports = { }; ``` -**Note:** If you use the line highlighting Markdown syntax, you might need to specify a different highlight background color for the dark mode syntax highlighting theme. Refer to the [docs for guidance](markdown-features.mdx#line-highlighting). +:::note + +If you use the line highlighting Markdown syntax, you might need to specify a different highlight background color for the dark mode syntax highlighting theme. Refer to the [docs for guidance](markdown-features.mdx#line-highlighting). + +::: ### Default language diff --git a/website/docs/using-plugins.md b/website/docs/using-plugins.md index 81f1eed6c584..d5163096033d 100644 --- a/website/docs/using-plugins.md +++ b/website/docs/using-plugins.md @@ -91,7 +91,7 @@ module.exports = function(context, options) { name: 'my-docusaurus-plugin', async loadContent() { ... }, async contentLoaded({content, actions}) { ... }, - /* other lifecycle api */ + /* other lifecycle API */ }; }; ``` @@ -116,7 +116,7 @@ interface LoadContext { #### Return value -The returned object value should implement the [lifecycle APIs](./lifecycle-apis.md). +The returned object value should implement the [lifecycle APIs](lifecycle-apis.md). ## Official plugins @@ -428,7 +428,7 @@ This plugin supports the PNG, GIF and JPG formats only. import Image from '@theme/IdealImage'; import thumbnail from './path/to/img.png'; -// your react code +// your React code // or diff --git a/website/docs/using-themes.md b/website/docs/using-themes.md index 544f93293a66..56e706ab9f84 100644 --- a/website/docs/using-themes.md +++ b/website/docs/using-themes.md @@ -58,7 +58,7 @@ For example, a Docusaurus blog consists of a blog plugin and a blog theme. } ``` -and if you want to use Bootstrap styling, you can swap out the theme with `theme-blog-bootstrap` (fictitious non-existing theme): +And if you want to use Bootstrap styling, you can swap out the theme with `theme-blog-bootstrap` (fictitious non-existing theme): ```js title="docusaurus.config.js" { @@ -125,6 +125,8 @@ This theme provides a `@theme/SearchBar` component that integrates with Algolia npm install --save @docusaurus/theme-search-algolia ``` +This theme also adds search page available at `/search` path with OpenSearch support. + :::tip If you have installed `@docusaurus/preset-classic`, you don't need to install it as a dependency. diff --git a/website/versioned_docs/version-2.0.0-alpha.54/blog.md b/website/versioned_docs/version-2.0.0-alpha.54/blog.md index aa61e0bacd66..b3309c83855b 100644 --- a/website/versioned_docs/version-2.0.0-alpha.54/blog.md +++ b/website/versioned_docs/version-2.0.0-alpha.54/blog.md @@ -134,7 +134,7 @@ https://{your-domain}/blog/atom.xml ### Blog-only mode -You can run your Docusaurus 2 site without a landing page and instead have your blog's post list page as the index page. Set the `routeBasePath` to be `''` to indicate it's the root path. +You can run your Docusaurus 2 site without a landing page and instead have your blog's post list page as the index page. Set the `routeBasePath` to be `'/'` to indicate it's the root path. **Note:** Make sure there's no `index.js` page in `src/pages` or else there will be two files mapping to the same route!