docs(v2): use explicit heading IDs (#4460)

This commit is contained in:
Alexey Pyltsyn 2021-03-19 13:00:41 +03:00 committed by GitHub
parent 962c3748ea
commit 291a72fbae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
162 changed files with 1435 additions and 1435 deletions

View file

@ -6,13 +6,13 @@ slug: '/api/plugins/@docusaurus/plugin-pwa'
Docusaurus Plugin to add PWA support using [Workbox](https://developers.google.com/web/tools/workbox). This plugin generates a [Service Worker](https://developers.google.com/web/fundamentals/primers/service-workers) in production build only, and allows you to create fully PWA-compliant documentation site with offline and installation support.
## Installation
## Installation {#installation}
```bash npm2yarn
npm install --save @docusaurus/plugin-pwa
```
## Configuration
## Configuration {#configuration}
Create a [PWA manifest](https://web.dev/add-manifest/) at `./static/manifest.json`.
@ -53,7 +53,7 @@ module.exports = {
};
```
## Progressive Web App
## Progressive Web App {#progressive-web-app}
Having a service worker installed is not enough to make your application a PWA. You'll need to at least include a [Web App Manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) and have the correct tags in `<head>` ([Options > pwaHead](#pwahead)).
@ -61,7 +61,7 @@ After deployment, you can use [Lighthouse](https://developers.google.com/web/too
For a more exhaustive list of what it takes for your site to be a PWA, refer to the [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist)
## App installation support
## App installation support {#app-installation-support}
If your browser supports it, you should be able to install a Docusaurus site as an app.
@ -73,7 +73,7 @@ App installation requires the https protocol and a valid manifest.
:::
## Offline mode (precaching)
## Offline mode (precaching) {#offline-mode-precaching}
We enable users to browse a Docusaurus site offline, by using service-worker precaching.
@ -95,9 +95,9 @@ Offline mode / precaching requires downloading all the static assets of the site
:::
## Options
## Options {#options}
### `debug`
### `debug` {#debug}
- Type: `boolean`
- Default: `false`
@ -109,7 +109,7 @@ Turn debug mode on:
- Unoptimized SW file output
- Source maps
### `offlineModeActivationStrategies`
### `offlineModeActivationStrategies` {#offlinemodeactivationstrategies}
- Type: `Array<'appInstalled' | 'mobile' | 'saveData'| 'queryString' | 'always'>`
- Default: `['appInstalled','queryString','standalone']`
@ -139,7 +139,7 @@ The [`standalone` strategy](https://petelepage.com/blog/2019/07/is-my-pwa-instal
:::
### `injectManifestConfig`
### `injectManifestConfig` {#injectmanifestconfig}
[Workbox options](https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-build#.injectManifest) to pass to `workbox.injectManifest()`. This gives you control over which assets will be precached, and be available offline.
@ -170,7 +170,7 @@ module.exports = {
};
```
### `reloadPopup`
### `reloadPopup` {#reloadpopup}
- Type: `string | false`
- Default: `'@theme/PwaReloadPopup'`
@ -191,7 +191,7 @@ The default theme includes an implementation for the reload popup and uses [Infi
![pwa_reload.gif](/img/pwa_reload.gif)
### `pwaHead`
### `pwaHead` {#pwahead}
- Type: `Array<{ tagName: string } & Record<string,string>>`
- Default: `[]`
@ -258,7 +258,7 @@ module.exports = {
};
```
### `swCustom`
### `swCustom` {#swcustom}
- Type: `string | undefined`
- Default: `undefined`
@ -291,7 +291,7 @@ export default function swCustom(params) {
The module should have a `default` function export, and receives some params.
### `swRegister`
### `swRegister` {#swregister}
- Type: `string | false`
- Default: `'docusaurus-plugin-pwa/src/registerSW.js'`
@ -300,7 +300,7 @@ Adds an entry before the Docusaurus app so that registration can happen before t
Passing `false` will disable registration entirely.
## Manifest example
## Manifest example {#manifest-example}
The Docusaurus site manifest can serve as an inspiration: