docs: fix website (#9935)

This commit is contained in:
Nikolay Vitkov 2023-03-29 11:37:35 +02:00 committed by GitHub
parent 57e11b320c
commit dcd8818399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 24 deletions

View File

@ -107,8 +107,8 @@ or [managing browsers yourself](https://pptr.dev/api/puppeteer.browserfetcher).
If you are managing browsers yourself, you will need to call If you are managing browsers yourself, you will need to call
[`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) with [`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) with
an an explicit an an explicit
[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions.executablepath) [`executablePath`](https://pptr.dev/api/puppeteer.launchoptions)
(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions.channel) if it's (or [`channel`](https://pptr.dev/api/puppeteer.launchoptions) if it's
installed in a standard location). installed in a standard location).
When using `puppeteer-core`, remember to change the import: When using `puppeteer-core`, remember to change the import:
@ -177,7 +177,7 @@ import puppeteer from 'puppeteer';
Puppeteer launches Chromium in Puppeteer launches Chromium in
[headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome).
To launch a full version of Chromium, set the To launch a full version of Chromium, set the
[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions.headless) [`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions)
option when launching a browser: option when launching a browser:
```ts ```ts

View File

@ -193,7 +193,7 @@ There are two reasons for this:
This means that Puppeteer does not support licensed formats such as AAC or This means that Puppeteer does not support licensed formats such as AAC or
H.264. (However, it is possible to force Puppeteer to use a H.264. (However, it is possible to force Puppeteer to use a
separately-installed version Chrome instead of Chromium via the separately-installed version Chrome instead of Chromium via the
[`executablePath` option to `puppeteer.launch`](./api/puppeteer.launchoptions.executablepath). [`executablePath` option to `puppeteer.launch`](./api/puppeteer.launchoptions).
You should only use this configuration if you need an official release of You should only use this configuration if you need an official release of
Chrome that supports these media formats.) Chrome that supports these media formats.)
- Since Puppeteer (in all configurations) controls a desktop version of - Since Puppeteer (in all configurations) controls a desktop version of

View File

@ -81,7 +81,7 @@ about the ambient environment is needed (in this case, `__dirname`).
#### Enabling experiments #### Enabling experiments
By default, experiments are turned off, but they can be individually turned on By default, experiments are turned off, but they can be individually turned on
using the [`experiments`](../api/puppeteer.configuration.experiments) key. using the [`experiments`](../api/puppeteer.configuration) key.
For example, if you want to enable ARM-native macOS chromium, you can use For example, if you want to enable ARM-native macOS chromium, you can use

View File

@ -23,13 +23,13 @@ before
These methods can be used to debug any situation. These should be used as a These methods can be used to debug any situation. These should be used as a
quick sanity check before diving into more complex methods. quick sanity check before diving into more complex methods.
### Turn off [`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) ### Turn off [`headless`](../api/puppeteer.browserlaunchargumentoptions)
Sometimes it's useful to see what the browser is displaying. Instead of Sometimes it's useful to see what the browser is displaying. Instead of
launching in launching in
[`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) mode, [`headless`](../api/puppeteer.browserlaunchargumentoptions) mode,
launch a full version of the browser with launch a full version of the browser with
[`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) set to [`headless`](../api/puppeteer.browserlaunchargumentoptions) set to
`false`: `false`:
```ts ```ts
@ -38,7 +38,7 @@ const browser = await puppeteer.launch({headless: false});
### Puppeteer "slow-mo" ### Puppeteer "slow-mo"
The [`slowMo`](../api/puppeteer.browserconnectoptions.slowmo) option slows down The [`slowMo`](../api/puppeteer.browserconnectoptions) option slows down
Puppeteer operations by a specified amount of milliseconds. It's another way to Puppeteer operations by a specified amount of milliseconds. It's another way to
help see what's going on. help see what's going on.
@ -55,7 +55,7 @@ const browser = await puppeteer.launch({
Since client code runs in the browser, doing `console.*` in client code will not Since client code runs in the browser, doing `console.*` in client code will not
directly log to Node.js. However, you can [listen](../api/puppeteer.page.on) for directly log to Node.js. However, you can [listen](../api/puppeteer.page.on) for
the [`console`](../api/puppeteer.pageeventobject.console) event which returns a the [`console`](../api/puppeteer.pageeventobject) event which returns a
payload with the logged text. payload with the logged text.
```ts ```ts
@ -66,7 +66,7 @@ await page.evaluate(() => console.log(`url is ${location.href}`));
### Use the debugger in the browser ### Use the debugger in the browser
1. Set [`devtools`](../api/puppeteer.browserlaunchargumentoptions.devtools) to 1. Set [`devtools`](../api/puppeteer.browserlaunchargumentoptions) to
`true` when launching Puppeteer: `true` when launching Puppeteer:
```ts ```ts
@ -98,7 +98,7 @@ to this
[Chromium bug](https://bugs.chromium.org/p/chromium/issues/detail?id=833928), so [Chromium bug](https://bugs.chromium.org/p/chromium/issues/detail?id=833928), so
if you want to try something out, you have to add it to your test file. if you want to try something out, you have to add it to your test file.
1. Set [`headless`](../api/puppeteer.browserlaunchargumentoptions.headless) to 1. Set [`headless`](../api/puppeteer.browserlaunchargumentoptions) to
`false`. `false`.
2. Add `debugger` to any server code you want debugged. For example, 2. Add `debugger` to any server code you want debugged. For example,

View File

@ -107,8 +107,8 @@ or [managing browsers yourself](https://pptr.dev/api/puppeteer.browserfetcher).
If you are managing browsers yourself, you will need to call If you are managing browsers yourself, you will need to call
[`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) with [`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) with
an an explicit an an explicit
[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions.executablepath) [`executablePath`](https://pptr.dev/api/puppeteer.launchoptions)
(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions.channel) if it's (or [`channel`](https://pptr.dev/api/puppeteer.launchoptions) if it's
installed in a standard location). installed in a standard location).
When using `puppeteer-core`, remember to change the import: When using `puppeteer-core`, remember to change the import:
@ -177,7 +177,7 @@ import puppeteer from 'puppeteer';
Puppeteer launches Chromium in Puppeteer launches Chromium in
[headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome).
To launch a full version of Chromium, set the To launch a full version of Chromium, set the
[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions.headless) [`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions)
option when launching a browser: option when launching a browser:
```ts ```ts

View File

@ -3,8 +3,10 @@ import Head from '@docusaurus/Head';
import Link from '@docusaurus/Link'; import Link from '@docusaurus/Link';
import {useHistory} from '@docusaurus/router'; import {useHistory} from '@docusaurus/router';
import {isRegexpStringMatch} from '@docusaurus/theme-common'; import {isRegexpStringMatch} from '@docusaurus/theme-common';
import {useContextualSearchFilters} from '@docusaurus/theme-common'; import {
import {useSearchPage} from '@docusaurus/theme-common/internal'; useContextualSearchFilters,
useSearchLinkCreator,
} from '@docusaurus/theme-common';
import Translate from '@docusaurus/Translate'; import Translate from '@docusaurus/Translate';
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl'; import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
@ -19,9 +21,9 @@ function Hit({hit, children}) {
return <Link to={hit.url}>{children}</Link>; return <Link to={hit.url}>{children}</Link>;
} }
function ResultsFooter({state, onClose}) { function ResultsFooter({state, onClose}) {
const {generateSearchPageLink} = useSearchPage(); const createSearchLink = useSearchLinkCreator();
return ( return (
<Link to={generateSearchPageLink(state.query)} onClick={onClose}> <Link to={createSearchLink(state.query)} onClick={onClose}>
<Translate <Translate
id="theme.SearchBar.seeAll" id="theme.SearchBar.seeAll"
values={{count: state.context.nbHits}} values={{count: state.context.nbHits}}

View File

@ -7,11 +7,9 @@ import {
usePluralForm, usePluralForm,
isRegexpStringMatch, isRegexpStringMatch,
useEvent, useEvent,
useSearchQueryString,
} from '@docusaurus/theme-common'; } from '@docusaurus/theme-common';
import { import {useTitleFormatter} from '@docusaurus/theme-common/internal';
useTitleFormatter,
useSearchPage,
} from '@docusaurus/theme-common/internal';
import Translate, {translate} from '@docusaurus/Translate'; import Translate, {translate} from '@docusaurus/Translate';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout'; import Layout from '@theme/Layout';
@ -128,7 +126,7 @@ function SearchPageContent() {
} = themeConfig; } = themeConfig;
const documentsFoundPlural = useDocumentsFoundPlural(); const documentsFoundPlural = useDocumentsFoundPlural();
const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers(); const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers();
const {searchQuery, setSearchQuery} = useSearchPage(); const [searchQuery, setSearchQuery] = useSearchQueryString();
const initialSearchResultState = { const initialSearchResultState = {
items: [], items: [],
query: null, query: null,