From 0047db28965e48c2ea371bc0a46c632b1eb4ca25 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Thu, 28 May 2020 08:58:04 +0300 Subject: [PATCH] docs(v2): delete alpha.43 --- .../version-2.0.0-alpha.43/blog.md | 162 ---- .../version-2.0.0-alpha.43/cli.md | 88 --- .../version-2.0.0-alpha.43/configuration.md | 145 ---- .../version-2.0.0-alpha.43/contributing.md | 190 ----- .../version-2.0.0-alpha.43/creating-pages.md | 79 -- .../version-2.0.0-alpha.43/deployment.md | 148 ---- .../design-principles.md | 30 - .../version-2.0.0-alpha.43/docusaurus-core.md | 161 ---- .../docusaurus.config.js.md | 304 -------- .../version-2.0.0-alpha.43/installation.md | 102 --- .../version-2.0.0-alpha.43/introduction.md | 112 --- .../version-2.0.0-alpha.43/lifecycle-apis.md | 431 ----------- .../markdown-features.mdx | 488 ------------ .../migrating-from-v1-to-v2.md | 694 ------------------ .../version-2.0.0-alpha.43/presets.md | 145 ---- .../version-2.0.0-alpha.43/search.md | 52 -- .../version-2.0.0-alpha.43/sidebar.md | 244 ------ .../version-2.0.0-alpha.43/static-assets.md | 59 -- .../version-2.0.0-alpha.43/styling-layout.md | 129 ---- .../version-2.0.0-alpha.43/theme-classic.md | 151 ---- .../version-2.0.0-alpha.43/using-plugins.md | 419 ----------- .../version-2.0.0-alpha.43/using-themes.md | 180 ----- .../version-2.0.0-alpha.43/versioning.md | 155 ---- .../version-2.0.0-alpha.43-sidebars.json | 132 ---- website/versions.json | 3 +- 25 files changed, 1 insertion(+), 4802 deletions(-) delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/blog.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/cli.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/configuration.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/contributing.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/creating-pages.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/deployment.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/design-principles.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/docusaurus-core.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/docusaurus.config.js.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/installation.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/introduction.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/lifecycle-apis.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/markdown-features.mdx delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/migrating-from-v1-to-v2.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/presets.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/search.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/sidebar.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/static-assets.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/styling-layout.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/theme-classic.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/using-plugins.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/using-themes.md delete mode 100644 website/versioned_docs/version-2.0.0-alpha.43/versioning.md delete mode 100644 website/versioned_sidebars/version-2.0.0-alpha.43-sidebars.json diff --git a/website/versioned_docs/version-2.0.0-alpha.43/blog.md b/website/versioned_docs/version-2.0.0-alpha.43/blog.md deleted file mode 100644 index 1b84ecdbdf..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/blog.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -id: blog -title: Blog ---- - -## Initial setup - -To setup your site's blog, start by creating a `blog` directory. - -Then, add a navbar link to your blog within `docusaurus.config.js`: - -```js -links: [ - ... - {to: 'blog', label: 'Blog', position: 'left'}, // or position: 'right' - ... -] -``` - -## Adding posts - -To publish in the blog, create a file within the blog directory with a formatted name of `YYYY-MM-DD-my-blog-post-title.md`. The post date is extracted from the file name. - -For example, at `my-website/blog/2019-09-05-hello-docusaurus-v2.md`: - -```yml ---- -title: Welcome Docusaurus v2 -author: Joel Marcey -author_title: Co-creator of Docusaurus 1 -author_url: https://github.com/JoelMarcey -author_image_url: https://graph.facebook.com/611217057/picture/?height=200&width=200 -authorURL: https://github.com/JoelMarcey -tags: [hello, docusaurus-v2] ---- -Welcome to this blog. This blog is created with [**Docusaurus 2 alpha**](https://v2.docusaurus.io/). - - - -This is my first post on Docusaurus 2. - -A whole bunch of exploration to follow. -``` - -## Header options - -The only required field is `title`; however, we provide options to add author information to your blog post as well along with other options. - -- `author` - The author name to be displayed. -- `author_url` - The URL that the author's name will be linked to. This could be a GitHub, Twitter, Facebook profile URL, etc. -- `author_image_url` - The URL to the author's thumbnail image. -- `author_title` - A description of the author. -- `title` - The blog post title. -- `tags` - A list of strings to tag to your post. - -## Summary truncation - -Use the `` marker in your blog post to represent what will be shown as the summary when viewing all published blog posts. Anything above `` will be part of the summary. For example: - -```yml ---- -title: Truncation Example ---- -All this will be part of the blog post summary. - -Even this. - - - -But anything from here on down will not be. - -Not this. - -Or this. -``` - -## Feed - -You can generate RSS/ Atom feed by passing feedOptions. - -```ts -feedOptions?: { - type: 'rss' | 'atom' | 'all'; - title?: string; - description?: string; - copyright: string; - language?: string; // possible values: http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes -}; -``` - -Example usage: - -```js {9-12} -// docusaurus.config.js -module.exports = { - // ... - presets: [ - [ - '@docusaurus/preset-classic', - { - blog: { - feedOptions: { - type: 'all', - copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`, - }, - }, - }, - ], - ], -}; -``` - -Accessing the feed: - -The feed for RSS can be found at - -```text -https://{your-domain}/blog/rss.xml -``` - -and for atom - -```text -https://{your-domain}/blog/atom.xml -``` - -## Advanced topics - -### 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! - -```js {10} -// docusaurus.config.js -module.exports = { - // ... - presets: [ - [ - '@docusaurus/preset-classic', - { - blog: { - path: './blog', - routeBasePath: '/', // Set this value to '/'. - }, - }, - ], - ], -}; -``` - - diff --git a/website/versioned_docs/version-2.0.0-alpha.43/cli.md b/website/versioned_docs/version-2.0.0-alpha.43/cli.md deleted file mode 100644 index 87324205f0..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/cli.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -id: cli -title: CLI ---- - -Docusaurus provides a set of scripts to help you generate, serve, and deploy your website. - -Once your website is generated, your website package will contain the Docusaurus scripts that you may invoke with your package manager: - -```json -// package.json -{ - // ... - "scripts": { - "start": "docusaurus start", - "build": "docusaurus build", - "swizzle": "docusaurus swizzle", - "deploy": "docusaurus deploy" - } -} -``` - -## Docusaurus CLI commands - -Below is a list of Docusaurus CLI commands and their usages: - - - -### `docusaurus start` - -Builds and serves the static site with [Webpack Dev Server](https://webpack.js.org/configuration/dev-server). - -**options** - -| Options | Default | Description | -| --- | --- | --- | -| `--port` | `3000` | Specifies the port of the dev server | -| `--host` | `localhost` | Specify a host to use. E.g., if you want your server to be accessible externally, you can use `--host 0.0.0.0` | -| `--hot-only` | `false` | Enables Hot Module Replacement without page refresh as fallback in case of build failures. More information [here](https://webpack.js.org/configuration/dev-server/#devserverhotonly). | -| `--no-open` | `false` | Do not open automatically the page in the browser. | - -### `docusaurus build` - -Compiles your site for production. - -**options** - -| Options | Default | Description | -| --- | --- | --- | -| `--bundle-analyzer` | | Analyze your bundle with [bundle analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) | - -### `docusaurus swizzle` - -> ⚠️ We would like to discourage swizzling of components until we've minimally reached a Beta stage. The components APIs have been changing rapidly and are likely to keep changing until we reach Beta. Stick with the default appearance for now if possible to save yourself some potential pain in future. - -Swizzle any Docusaurus Theme components with your own component with `docusaurus swizzle`. - -```shell -docusaurus swizzle [componentName] [siteDir] -``` - -**params** - -- `themeName`: name of the theme you are using -- `swizzleComponent`: name of the component to be swizzled - -Running the above command will copy the relevant theme files to your site folder. You may then make any changes to it and Docusaurus will use it instead of the one provided from the theme. - -To unswizzle a component, simply delete the files of the swizzled component. - - - -To learn more about swizzling, check [here](#). - -### `docusaurus deploy` - -Deploys your site with [GitHub Pages](https://pages.github.com/). diff --git a/website/versioned_docs/version-2.0.0-alpha.43/configuration.md b/website/versioned_docs/version-2.0.0-alpha.43/configuration.md deleted file mode 100644 index 3b9a289a42..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/configuration.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -id: configuration -title: Configuration ---- - -Docusaurus has a unique take on configurations. We encourage you to congregate information of your site into one place. We will guard the fields of this file, and facilitate making this data object accessible across your site. - -Keeping a well-maintained `docusaurus.config.js` helps you, your collaborators, and your open source contributors be able to focus on documentation while still being able to customize fields. - -## What goes into `docusaurus.config.js`? - -You should not have to write your `docusaurus.config.js` from scratch even if you are developing your site. All templates come with a `docusaurus.config.js` at root that includes the necessary data for the initial site. - -However, it can be helpful if you have a high-level understanding of how the configurations are designed and implemented. - -The high-level overview of Docusaurus configuration can be categorized into: - -- [Site Metadata](#site-metadata) -- [Deployment Configurations](#deployment-configurations) -- [Theme, Plugin, and Preset Configurations](#theme-plugin-and-preset-configurations) -- [Custom Configurations](#custom-configurations) - -For exact reference to each of the configurable fields, you may refer to [**docusaurus.config.js API reference**](docusaurus.config.js.md). - -### Site metadata - -Site metadata contains the essential global metadata such as `title`, `url`, `baseUrl` and `favicon`. - -They are used in a number of places such as your site's title and headings, browser tab icon, social sharing (Facebook, Twitter) information or even to generate the correct path to serve your static files. - -### Deployment configurations - -Deployment configurations such as `projectName` and `organizationName` are used when you deploy your site with Docusaurus' `deploy` command. - -It is recommended to check the [deployment docs](deployment.md) for more information. - -### Theme, plugin, and preset configurations - -List the installed [themes](using-themes.md), [plugins](using-plugins.md), and [presets](presets.md) for your site in the `themes`, `plugins`, and `presets` fields, respectively. These are typically npm packages: - -```js -// docusaurus.config.js -module.exports = { - // ... - plugins: [ - '@docusaurus/plugin-content-blog', - '@docusaurus/plugin-content-pages', - ], - themes: ['@docusaurus/theme-classic'], -}; -``` - -They can also be loaded from local directories: - -```js -// docusaurus.config.js -const path = require('path'); - -module.exports = { - // ... - themes: [path.resolve(__dirname, '/path/to/docusaurus-local-theme')], -}; -``` - -To specify options for a plugin or theme, replace the name of the plugin or theme in the config file with an array containing the name and an options object: - -```js -// docusaurus.config.js -module.exports = { - // ... - plugins: [ - [ - '@docusaurus/plugin-content-blog', - { - path: 'blog', - routeBasePath: 'blog', - include: ['*.md', '*.mdx'], - // ... - }, - ], - '@docusaurus/plugin-content-pages', - ], -}; -``` - -To specify options for a plugin or theme that is bundled in a preset, pass the options through the `presets` field. In this example, `docs` refers to `@docusaurus/plugin-content-docs` and `theme` refers to `@docusaurus/theme-classic`. - -```js -//docusaurus.config.js -module.exports = { - // ... - presets: [ - [ - '@docusaurus/preset-classic', - { - docs: { - sidebarPath: require.resolve('./sidebars.js'), - }, - theme: { - customCss: require.resolve('./src/css/custom.css'), - }, - }, - ], - ], -}; -``` - -For further help configuring themes, plugins, and presets, see [Using Themes](using-themes.md), [Using Plugins](using-plugins.md), and [Using Presets](presets.md). - -### Custom configurations - -Docusaurus guards `docusaurus.config.js` from unknown fields. To add a custom field, define it on `customFields` - -Example: - -```js {3-6} -// docusaurus.config.js -module.exports = { - customFields: { - image: '', - keywords: [], - }, -}; -``` - -## Accessing configuration from components - -Your configuration object will be made available to all the components of your site. And you may access them via React context as `siteConfig`. - -Basic Example: - -```jsx {2,5-6} -import React from 'react'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; - -const Hello = () => { - const context = useDocusaurusContext(); - const {siteConfig = {}} = context; - const {title, tagline} = siteConfig; - - return
{`${title} · ${tagline}`}
; -}; -``` - -> If you just want to use those fields on the client side, you could create your own JS files and import them as ES6 modules, there is no need to put them in `docusaurus.config.js`. diff --git a/website/versioned_docs/version-2.0.0-alpha.43/contributing.md b/website/versioned_docs/version-2.0.0-alpha.43/contributing.md deleted file mode 100644 index b0d825e050..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/contributing.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -id: contributing -title: Contributing ---- - -[Docusaurus 2](https://v2.docusaurus.io) is currently under alpha development. We have [early adopters who already started using it](/showcase). We are now welcoming contributors to collaborate on the next Docusaurus. - -The [Open Source Guides](https://opensource.guide/) website has a collection of resources for individuals, communities, and companies who want to learn how to run and contribute to an open source project. Contributors and people new to open source alike will find the following guides especially useful: - -- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) -- [Building Welcoming Communities](https://opensource.guide/building-community/) - -## [Code of Conduct](https://code.fb.com/codeofconduct) - -Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated. - -## Get involved - -There are many ways to contribute to Docusaurus, and many of them do not involve writing any code. Here's a few ideas to get started: - -- Start using Docusaurus 2! Go through the [Getting Started](installation.md) guides. Does everything work as expected? If not, we're always looking for improvements. Let us know by [opening an issue](#reporting-new-issues). -- Look through the [v2.0 issues](https://github.com/facebook/docusaurus/labels/v2). If you find an issue you would like to fix, [open a pull request](#your-first-pull-request). Issues tagged as [_Good first issue_](https://github.com/facebook/docusaurus/labels/Good%20first%20issue) are a good place to get started. -- Help us making the docs better. File an issue if you find anything that is confusing or can be improved. We also have [an umbrella issue for v2 docs](https://github.com/facebook/docusaurus/issues/1640) where we are planning and working on all v2 docs. You may adopt a doc piece there to work on. -- Take a look at the [features requested](https://github.com/facebook/docusaurus/labels/enhancement) by others in the community and consider opening a pull request if you see something you want to work on. - -Contributions are very welcome. If you think you need help planning your contribution, please ping us on Twitter at [@docusaurus](https://twitter.com/docusaurus) and let us know you are looking for a bit of help. - -### Join our Discord channel - -To participate in Docusaurus 2 dev, join the [#docusaurus-2-dev](https://discord.gg/Je6Ash6) channel. - -## Our development process - -Docusaurus uses [GitHub](https://github.com/facebook/docusaurus) as its source of truth. The core team will be working directly there. All changes will be public from the beginning. - -When a change made on GitHub is approved, it will be checked by our continuous integration system, CircleCI. - -### Reporting new issues - -When [opening a new issue](https://github.com/facebook/docusaurus/issues/new/choose), always make sure to fill out the issue template. **This step is very important!** Not doing so may result in your issue not managed in a timely fashion. Don't take this personally if this happens, and feel free to open a new issue once you've gathered all the information required by the template. - -- **One issue, one bug:** Please report a single bug per issue. -- **Provide reproduction steps:** List all the steps necessary to reproduce the issue. The person reading your bug report should be able to follow these steps to reproduce your issue with minimal effort. - -### Reporting bugs - -We use [GitHub Issues](https://github.com/facebook/docusaurus/issues) for our public bugs. If you would like to report a problem, take a look around and see if someone already opened an issue about it. If you a are certain this is a new, unreported bug, you can submit a [bug report](#reporting-new-issues). - -If you have questions about using Docusaurus, contact the Docusaurus Twitter account at [@docusaurus](https://twitter.com/docusaurus), and we will do our best to answer your questions. - -You can also file issues as [feature requests or enhancements](https://github.com/facebook/docusaurus/labels/feature). If you see anything you'd like to be implemented, create an issue with [feature template](https://raw.githubusercontent.com/facebook/docusaurus/master/.github/ISSUE_TEMPLATE/feature.md) - -### Reporting security bugs - -Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page. - -## Working on Docusaurus code - -### Installation - -1. Ensure you have [Yarn](https://yarnpkg.com/) installed -2. After cloning the repository, run `yarn install` in the root of the repository -3. To start a local development server serving the Docusaurus docs, go into the `website` directory and run `yarn start` - -### Semantic commit messages - -See how a minor change to your commit message style can make you a better programmer. - -Format: `(): ` - -`` is optional - -**Example** - -``` -feat: allow overriding of webpack config -^--^ ^------------^ -| | -| +-> Summary in present tense. -| -+-------> Type: chore, docs, feat, fix, refactor, style, or test. -``` - -The various types of commits: - -- `feat`: (new feature for the user, not a new feature for build script) -- `fix`: (bug fix for the user, not a fix to a build script) -- `docs`: (changes to the documentation) -- `style`: (formatting, missing semi colons, etc; no production code change) -- `refactor`: (refactoring production code, eg. renaming a variable) -- `test`: (adding missing tests, refactoring tests; no production code change) -- `chore`: (updating grunt tasks etc; no production code change) - -Use lower case not title case! - -### Code conventions - -#### Style guide - -[Prettier](https://prettier.io) will catch most styling issues that may exist in your code. You can check the status of your code styling by simply running `npm run prettier`. - -However, there are still some styles that Prettier cannot pick up. - -#### General - -- **Most important: Look around.** Match the style you see used in the rest of the project. This includes formatting, naming files, naming things in code, naming things in documentation. -- "Attractive" - -#### Documentation - -- Do not wrap lines at 80 characters - configure your editor to soft-wrap when editing documentation. - -## Pull requests - -### Your first pull request - -So you have decided to contribute code back to upstream by opening a pull request. You've invested a good chunk of time, and we appreciate it. We will do our best to work with you and get the PR looked at. - -Working on your first Pull Request? You can learn how from this free video series: - -[**How to Contribute to an Open Source Project on GitHub**](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github) - -We have a list of [beginner friendly issues](https://github.com/facebook/docusaurus/labels/good%20first%20issue) to help you get your feet wet in the Docusaurus codebase and familiar with our contribution process. This is a great place to get started. - -### Proposing a change - -If you would like to request a new feature or enhancement but are not yet thinking about opening a pull request, you can also file an issue with [feature template](https://github.com/facebook/docusaurus/issues/new?template=feature.md). - -If you intend to change the public API (e.g., something in `docusaurus.config.js`), or make any non-trivial changes to the implementation, we recommend filing an issue with [proposal template](https://github.com/facebook/docusaurus/issues/new?template=proposal.md) and including `[Proposal]` in the title. This lets us reach an agreement on your proposal before you put significant effort into it. These types of issues should be rare. - -If you're only fixing a bug, it's fine to submit a pull request right away but we still recommend to file an issue detailing what you're fixing. This is helpful in case we don't accept that specific fix but want to keep track of the issue. - -### Sending a pull request - -Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it. It is recommended to follow this [commit message style](#semantic-commit-messages). - -Please make sure the following is done when submitting a pull request: - -1. Fork [the repository](https://github.com/facebook/docusaurus) and create your branch from `master`. -1. Add the copyright notice to the top of any code new files you've added. -1. Describe your [test plan](#test-plan) in your pull request description. Make sure to [test your changes](https://github.com/facebook/docusaurus/blob/master/admin/testing-changes-on-Docusaurus-itself.md)! -1. Make sure your code lints (`yarn prettier && yarn lint`). -1. Make sure your Jest tests pass (`yarn test`). -1. If you haven't already, [sign the CLA](https://code.facebook.com/cla). - -All pull requests should be opened against the `master` branch. - -#### Test plan - -A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI. - -- If you've changed APIs, update the documentation. - -#### Breaking changes - -When adding a new breaking change, follow this template in your pull request: - -```md -### New breaking change here - -- **Who does this affect**: -- **How to migrate**: -- **Why make this breaking change**: -- **Severity (number of people affected x effort)**: -``` - -#### Copyright header for source code - -Copy and paste this to the top of your new file(s): - -```js -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -``` - -#### Contributor License Agreement (CLA) - -In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, the Facebook GitHub Bot will reply with a link to the CLA form. You may also [complete your CLA here](https://code.facebook.com/cla). - -### What happens next? - -The core Docusaurus team will be monitoring for pull requests. Do help us by keeping pull requests consistent by following the guidelines above. - -## License - -By contributing to Docusaurus, you agree that your contributions will be licensed under its MIT license. diff --git a/website/versioned_docs/version-2.0.0-alpha.43/creating-pages.md b/website/versioned_docs/version-2.0.0-alpha.43/creating-pages.md deleted file mode 100644 index e8dbc01d25..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/creating-pages.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -id: creating-pages -title: Creating Pages ---- - -In this section, we will learn about creating ad-hoc pages in Docusaurus using React. This is most useful for creating one-off standalone pages like a showcase page, playground page or support page. - -## Adding a new page - - - -In the `/src/pages/` directory, create a file called `hello.js` with the following contents: - -```jsx -import React from 'react'; -import Layout from '@theme/Layout'; - -function Hello() { - return ( - -
-

- Edit pages/hello.js and save to reload. -

-
-
- ); -} - -export default Hello; -``` - -Once you save the file, the development server will automatically reload the changes. Now open http://localhost:3000/hello, you will see the new page you just created. - -Each page doesn't come with any styling. You will need to import the `Layout` component from `@theme/Layout` and wrap your contents within that component if you want the navbar and/or footer to appear. - -## Routing - -If you are familiar with other static site generators like Jekyll and Next, this routing approach will feel familiar to you. Any JavaScript file you create under `/src/pages/` directory will be automatically converted to a website page, following the `/src/pages/` directory hierarchy. For example: - -- `/src/pages/index.js` → `` -- `/src/pages/foo.js` → `/foo` -- `/src/pages/foo/test.js` → `/foo/test` -- `/src/pages/foo/index.js` → `/foo/` - -In this component-based development era, it is encouraged to co-locate your styling, markup and behavior together into components. Each page is a component, and if you need to customize your page design with your own styles, we recommend co-locating your styles with the page component in its own directory. For example, to create a "Support" page, you could do one of the following: - -- Add a `/src/pages/support.js` file -- Create a `/src/pages/support/` directory and a `/src/pages/support/index.js` file. - -The latter is preferred as it has the benefits of letting you put files related to the page within that directory. For e.g. a CSS module file (`styles.module.css`) with styles meant to only be used on the "Support" page. **Note:** this is merely a recommended directory structure and you will still need to manually import the CSS module file within your component module (`support/index.js`). - -```sh -my-website -├── src -│ └── pages -│ ├── styles.module.css -│ ├── index.js -│ └── support -│ ├── index.js -│ └── styles.module.css -. -``` - -## Using React - -React is used as the UI library to create pages. Every page component should export a React component and you can leverage on the expressiveness of React to build rich and interactive content. - - diff --git a/website/versioned_docs/version-2.0.0-alpha.43/deployment.md b/website/versioned_docs/version-2.0.0-alpha.43/deployment.md deleted file mode 100644 index f12cf898b7..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/deployment.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -id: deployment -title: Deployment ---- - -To build the static files of your website for production, run: - -```bash npm2yarn -npm run build -``` - -Once it finishes, you should see the production build under the `build/` directory. - -You can deploy your site to static site hosting services such as [ZEIT Now](https://zeit.co/now), [GitHub Pages](https://pages.github.com/), [Netlify](https://www.netlify.com/), and [Render](https://render.com/static-sites). Docusaurus sites are statically rendered so they work without JavaScript too! - -## Deploying to ZEIT Now - -Deploying your Docusaurus project to [ZEIT Now](https://zeit.co/now) will provide you with [various benefits](https://zeit.co/now) in the areas of performance and ease of use. - -Most importantly, however, deploying a Docusaurus project only takes a couple seconds: - -1. First, install their [command-line interface](https://zeit.co/download): - -```bash -npm i -g now -``` - -2. Run a single command inside the root directory of your project: - -```bash -now -``` - -**That's all.** Your docs will automatically be deployed. - -Now you can connect your site to [GitHub](https://zeit.co/github) or [GitLab](https://zeit.co/gitlab) to automatically receive a new deployment every time you push a commit. - -## Deploying to GitHub Pages - -Docusaurus provides a easy way to publish to GitHub Pages. - -### `docusaurus.config.js` settings - -First, modify your `docusaurus.config.js` and add the required params: - -| Name | Description | -| --- | --- | -| `organizationName` | The GitHub user or organization that owns the repository. If you are the owner, it is your GitHub username. In the case of Docusaurus, it is "_facebook_" which is the GitHub organization that owns Docusaurus. | -| `projectName` | The name of the GitHub repository. For example, the repository name for Docusaurus is "docusaurus", so the project name is "docusaurus". | -| `url` | URL for your GitHub Page's user/organization page. This is commonly https://_username_.github.io. | -| `baseUrl` | Base URL for your project. For projects hosted on GitHub pages, it follows the format "/_projectName_/". For https://github.com/facebook/docusaurus, `baseUrl` is `/docusaurus/`. | - -In case you want to use your custom domain for GitHub Pages, create a `CNAME` file in the `static` directory. Anything within the `static` directory will be copied to the root of the `build` directory for deployment. - -You may refer to GitHub Pages' documentation [User, Organization, and Project Pages](https://help.github.com/en/articles/user-organization-and-project-pages) for more details. - -Example: - -```jsx {3-6} -module.exports = { - ... - url: 'https://endiliey.github.io', // Your website URL - baseUrl: '/', - projectName: 'endiliey.github.io', - organizationName: 'endiliey' - ... -} -``` - -### Environment settings - -Specify the Git user as an environment variable. - -| Name | Description | -| --- | --- | -| `GIT_USER` | The username for a GitHub account that has commit access to this repo. For your own repositories, this will usually be your GitHub username. The specified `GIT_USER` must have push access to the repository specified in the combination of `organizationName` and `projectName`. | - -There are two more optional parameters that are set as environment variables: - -| Name | Description | -| --- | --- | -| `USE_SSH` | Set to `true` to use SSH instead of the default HTTPS for the connection to the GitHub repo. | -| `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `master`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. | - -### Deploy - -Finally, to deploy your site to GitHub Pages, run: - -**Bash** - -```bash -GIT_USER= yarn deploy -``` - -**Windows** - -```batch -cmd /C "set "GIT_USER=" && yarn deploy" -``` - - - -## Deploying to Netlify - -To deploy your Docusaurus 2 sites to [Netlify](https://www.netlify.com/), first make sure the following options are properly configured: - -```js {3-4} -// docusaurus.config.js -module.exports = { - url: 'https://docusaurus-2.netlify.com', // url to your site with no trailing slash - baseUrl: '/', // base directory of your site relative to your repo -}; -``` - -Then, [create your site with Netlify](https://app.netlify.com/start). - -While you set up the site, specify the build commands and directories as follows: - -- build command: `npm run build` -- build directory: `build` - -If you did not configure these build options, you may still go to "Site settings" -> "Build and deploy" after your site is created. - -Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `master`. - -## Deploying to Render - -Render offers [free static site hosting](https://render.com/docs/static-sites) with fully managed SSL, custom domains, a global CDN and continuous auto deploys from your Git repo. Deploy your app in just a few minutes by following these steps. - -1. Create a new **Web Service** on Render, and give Render permission to access your Docusaurus repo. - -2. Select the branch to deploy. The default is `master`. - -3. Enter the following values during creation. - - | Field | Value | - | --------------------- | ------------- | - | **Environment** | `Static Site` | - | **Build Command** | `yarn build` | - | **Publish Directory** | `build` | - -That's it! Your app will be live on your Render URL as soon as the build finishes. diff --git a/website/versioned_docs/version-2.0.0-alpha.43/design-principles.md b/website/versioned_docs/version-2.0.0-alpha.43/design-principles.md deleted file mode 100644 index 05d13d38b7..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/design-principles.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: design-principles -title: Design Principles ---- - -> :warning: _This section is a work in progress._ - -- **Little to learn** - Docusaurus should be easy to learn and use as the API is quite small. Most things will still be achievable by users, even if it takes them more code and more time to write. Not having abstractions is better than having the wrong abstractions, and we don't want users to have to hack around the wrong abstractions. Mandatory talk - [Minimal API Surface Area](https://www.youtube.com/watch?v=4anAwXYqLG8). -- **Intuitive** - Users will not feel overwhelmed when looking at the project directory of a Docusaurus project or adding new features. It should look intuitive and easy to build on top of, using approaches they are familiar with. -- **Layered architecture** - The separations of concerns between each layer of our stack (content/theming/styling) should be clear - well-abstracted and modular. -- **Sensible defaults** - Common and popular performance optimizations and configurations will be done for users but they are given the option to override them. -- **No vendor-lock in** - Users are not required to use the default plugins or CSS, although they are highly encouraged to. Certain core lower-level infra level pieces like React Loadable, React Router cannot be swapped because we do default performance optimization on them. But not higher level ones, such as choice of Markdown engines, CSS frameworks, CSS methodology will be entirely up to users. - -## How Docusaurus works - - - -We believe that as developers, knowing how a library works is helpful in allowing us to become better at using it. Hence we're dedicating effort into explaining the architecture and various components of Docusaurus with the hope that users reading it will gain a deeper understanding of the tool and be even more proficient in using it. - - diff --git a/website/versioned_docs/version-2.0.0-alpha.43/docusaurus-core.md b/website/versioned_docs/version-2.0.0-alpha.43/docusaurus-core.md deleted file mode 100644 index 48343885f6..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/docusaurus-core.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -id: docusaurus-core -title: Docusaurus Client API -sidebar_label: Client API ---- - -Docusaurus provides some API on client that can be helpful when building your site. - -## `Head` - -This reusable React component will manage all of your changes to the document head. It takes plain HTML tags and outputs plain HTML tags and is beginner-friendly. It is a wrapper around [React Helmet](https://github.com/nfl/react-helmet). - -Usage Example: - -```jsx {2,6,11} -import React from 'react'; -import Head from '@docusaurus/Head'; - -const MySEO = () => ( - <> - - - - My Title - - - -); -``` - -Nested or latter components will override duplicate usages: - -```jsx {2,5,8,11} - - - My Title - - - - - - Nested Title - - - - -``` - -Outputs - -```html - - Nested Title - - -``` - -## `Link` - -This component enables linking to internal pages as well as a powerful performance feature called preloading. Preloading is used to prefetch resources so that the resources are fetched by the time the user navigates with this component. We use an `IntersectionObserver` to fetch a low-priority request when the `` is in the viewport and then use an `onMouseOver` event to trigger a high-priority request when it is likely that a user will navigate to the requested resource. - -The component is a wrapper around react-router’s `` component that adds useful enhancements specific to Docusaurus. All props are passed through to react-router’s `` component. - -```jsx {2,7} -import React from 'react'; -import Link from '@docusaurus/Link'; - -const Page = () => ( -
-

- Check out my blog! -

-

- {/* Note that external links still use `a` tags. */} - Follow me on Twitter! -

-
-); -``` - -### `to`: string - -The target location to navigate to. Example: `/docs/introduction`. - -```jsx - -``` - -### `activeClassName`: string - -The class to give the `` when it is active. The default given class is `active`. This will be joined with the `className` prop. - -```jsx {1} - - FAQs - -``` - -## `useDocusaurusContext` - -React Hooks to access Docusaurus Context. Context contains `siteConfig` object from [docusaurus.config.js](docusaurus.config.js.md). - -```ts -interface DocusaurusContext { - siteConfig?: DocusaurusConfig; -} -``` - -Usage example: - -```jsx {2,5} -import React from 'react'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; - -const Test = () => { - const context = useDocusaurusContext(); - const {siteConfig = {}} = context; - const {title} = siteConfig; - - return

{title}

; -}; -``` - -## `useBaseUrl` - -React Hook to automatically prepend `baseUrl` to a string automatically. This is particularly useful if you don't want to hardcode your baseUrl. - -Example usage: - -```jsx {3,11} -import React, {useEffect} from 'react'; -import Link from '@docusaurus/Link'; -import useBaseUrl from '@docusaurus/useBaseUrl'; - -function Help() { - return ( -
-

Browse the docs

-

- Learn more about Docusaurus using the{' '} - official documentation -

-
- ); -} -``` - -## `Redirect` - -Rendering a `` will navigate to a new location. The new location will override the current location in the history stack, like server-side redirects (HTTP 3xx) do. You can refer to [React Router's Redirect documentation](https://reacttraining.com/react-router/web/api/Redirect) for more info on available props. - -Example usage: - -```jsx {2,5} -import React from 'react'; -import {Redirect} from '@docusaurus/router'; - -function Home() { - return ; -} -``` diff --git a/website/versioned_docs/version-2.0.0-alpha.43/docusaurus.config.js.md b/website/versioned_docs/version-2.0.0-alpha.43/docusaurus.config.js.md deleted file mode 100644 index d0b3a622d4..0000000000 --- a/website/versioned_docs/version-2.0.0-alpha.43/docusaurus.config.js.md +++ /dev/null @@ -1,304 +0,0 @@ ---- -id: docusaurus.config.js -title: docusaurus.config.js -description: API reference for Docusaurus configuration file. ---- - -## Overview - -`docusaurus.config.js` contains configurations for your site and is placed in the root directory of your site. - -## Required fields - -### `title` - -- Type: `string` - -Title for your website. - -```js -// docusaurus.config.js -module.exports = { - title: 'Docusaurus', -}; -``` - -### `tagline` - -- Type: `string` - -The tagline for your website. - -```js -// docusaurus.config.js -module.exports = { - tagline: - 'Docusaurus makes it easy to maintain Open Source documentation websites.', -}; -``` - -### `favicon` - -- Type: `string` - -URL for site favicon. Example: - -```js -// docusaurus.config.js -module.exports = { - favicon: 'https://v2.docusaurus.io/favicon.ico', -}; -``` - -You can also use the favicon URL relative to the `static` directory of your site. For example, your site has the following directory structure: - -```bash -. -├── README.md -├ # ... other files in root directory -└─ static - └── img - └── favicon.ico -``` - -So you can refer it like below: - -```js -// docusaurus.config.js -module.exports = { - favicon: 'img/favicon.ico', -}; -``` - -### `url` - -- Type: `string` - -URL for your website. This can also be considered the top-level hostname. For example, `https://facebook.github.io` is the URL of https://facebook.github.io/metro/, and `https://docusaurus.io` is the URL for https://docusaurus.io. This field is related to the [baseUrl](#baseurl) field. - -```js -// docusaurus.config.js -module.exports = { - url: 'https://docusaurus.io', -}; -``` - -### `baseUrl` - -- Type: `string` - -Base URL for your site. This can also be considered the path after the host. For example, `/metro/` is the baseUrl of https://facebook.github.io/metro/. For URLs that have no path, the baseUrl should be set to `/`. This field is related to the [url](#url) field. - -```js -// docusaurus.config.js -module.exports = { - baseUrl: '/', -}; -``` - -## Optional fields - -### `organizationName` - -- Type: `string` - -The GitHub user or organization that owns the repository. Used by the deployment command. - -```js -// docusaurus.config.js -module.exports = { - // Docusaurus's organization is facebook - organizationName: 'facebook', -}; -``` - -### `projectName` - -- Type: `string` - -The name of the GitHub repository. Used by the deployment command. - -```js -// docusaurus.config.js -module.exports = { - projectName: 'docusaurus', -}; -``` - -### `githubHost` - -- Type: `string` - -The hostname of your server. Useful if you are using GitHub Enterprise. - -```js -// docusaurus.config.js -module.exports = { - githubHost: 'github.com', -}; -``` - -### `themeConfig` - -- Type: `Object` - - - -An object containing data needed by the theme you use. - -For Docusaurus' default theme _classic_, we use `themeConfig` to customize your navbar and footer links: - -Example: - -```js -// docusaurus.config.js -module.exports = { - themeConfig: { - navbar: { - title: 'Site Title', - logo: { - alt: 'Site Logo', - src: 'img/logo.svg', - }, - links: [ - { - to: 'docs/docusaurus.config.js', - label: 'docusaurus.config.js', - position: 'left', - }, - // ... other links - ], - }, - footer: { - style: 'dark', - links: [ - { - title: 'Docs', - items: [ - { - label: 'Docs', - to: 'docs/doc1', - }, - ], - }, - // ... other links - ], - logo: { - alt: 'Facebook Open Source Logo', - src: 'https://docusaurus.io/img/oss_logo.png', - }, - copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`, - }, - }, -}; -``` - -### `plugins` - - - -- Type: `any[]` - -```js -// docusaurus.config.js -module.exports = { - plugins: [], -}; -``` - -### `themes` - - - -- Type: `any[]` - -```js -// docusaurus.config.js -module.exports = { - themes: [], -}; -``` - -### `presets` - - - -- Type: `any[]` - -```js -// docusaurus.config.js -module.exports = { - presets: [], -}; -``` - -### `customFields` - -Docusaurus guards `docusaurus.config.js` from unknown fields. To add a custom field, define it on `customFields` - -- Type: `Object` - -```jsx -// docusaurus.config.js -module.exports = { - customFields: { - admin: 'endi', - superman: 'lol', - }, -}; -``` - -Attempting to add unknown field in the config will lead to error in build time: - -```bash -Error: The field(s) 'foo', 'bar' are not recognized in docusaurus.config.js -``` - -### `scripts` - -An array of scripts to load. The values can be either strings or plain objects of attribute-value maps. The `