mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-31 01:47:17 +02:00
Merge branch 'main' into ozaki/showcase
This commit is contained in:
commit
01657b0744
249 changed files with 24910 additions and 3445 deletions
2
.github/workflows/argos.yml
vendored
2
.github/workflows/argos.yml
vendored
|
@ -41,7 +41,7 @@ jobs:
|
|||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Build website fast
|
||||
run: yarn build:website:fast
|
||||
run: yarn build:website:fast --dev
|
||||
|
||||
- name: Take Argos screenshots
|
||||
run: yarn argos:screenshot
|
||||
|
|
2
.github/workflows/build-perf.yml
vendored
2
.github/workflows/build-perf.yml
vendored
|
@ -43,7 +43,7 @@ jobs:
|
|||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Track build size changes
|
||||
uses: preactjs/compressed-size-action@8119d3d31b6e57b167e09c81dfa877eada3bcb35 # v2
|
||||
uses: preactjs/compressed-size-action@f780fd104362cfce9e118f9198df2ee37d12946c # v2
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build-script: build:website:en
|
||||
|
|
2
.github/workflows/dependency-review.yml
vendored
2
.github/workflows/dependency-review.yml
vendored
|
@ -15,4 +15,4 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Dependency Review
|
||||
uses: actions/dependency-review-action@5bbc3ba658137598168acb2ab73b21c432dd411b # 4.2.5
|
||||
uses: actions/dependency-review-action@e58c696e52cac8e62d61cc21fda89565d71505d7 # 4.3.1
|
||||
|
|
117
CHANGELOG.md
117
CHANGELOG.md
|
@ -1,4 +1,119 @@
|
|||
# Docusaurus 2 Changelog
|
||||
# Docusaurus Changelog
|
||||
|
||||
## 3.3.2 (2024-05-03)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-module-type-aliases`, `docusaurus`
|
||||
- [#10103](https://github.com/facebook/docusaurus/pull/10103) fix(core): do not recreate ReactDOM Root, fix React warning on hot reload ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### Committers: 1
|
||||
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
|
||||
## 3.3.1 (2024-05-03)
|
||||
|
||||
Failed release
|
||||
|
||||
## 3.3.0 (2024-05-03)
|
||||
|
||||
#### :rocket: New Feature
|
||||
|
||||
- `docusaurus-plugin-sitemap`
|
||||
- [#10083](https://github.com/facebook/docusaurus/pull/10083) feat: add createSitemapItems hook ([@johnnyreilly](https://github.com/johnnyreilly))
|
||||
- `docusaurus-mdx-loader`, `docusaurus-types`, `docusaurus`
|
||||
- [#10064](https://github.com/facebook/docusaurus/pull/10064) feat(core): add new site config option `siteConfig.markdown.anchors.maintainCase` ([@iAdramelk](https://github.com/iAdramelk))
|
||||
- `docusaurus`
|
||||
- [#9767](https://github.com/facebook/docusaurus/pull/9767) feat(cli): docusaurus deploy should support a --target-dir option ([@SandPod](https://github.com/SandPod))
|
||||
- `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-plugin-debug`, `docusaurus-types`, `docusaurus`
|
||||
- [#10042](https://github.com/facebook/docusaurus/pull/10042) feat(core): simplify plugin API, support route.props ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-pages`, `docusaurus-theme-classic`, `docusaurus-theme-common`
|
||||
- [#10032](https://github.com/facebook/docusaurus/pull/10032) feat(pages): add LastUpdateAuthor & LastUpdateTime & editUrl ([@OzakIOne](https://github.com/OzakIOne))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
||||
- `docusaurus-cssnano-preset`, `docusaurus-utils`, `docusaurus`
|
||||
- [#10092](https://github.com/facebook/docusaurus/pull/10092) chore: Upgrade svgr / svgo / cssnano ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-classic`
|
||||
- [#10091](https://github.com/facebook/docusaurus/pull/10091) fix(theme): `<Tabs>` props should allow overriding defaults ([@gagdiez](https://github.com/gagdiez))
|
||||
- [#10080](https://github.com/facebook/docusaurus/pull/10080) fix(theme): `<Admonition>` should render properly without heading/icon ([@andrmaz](https://github.com/andrmaz))
|
||||
- `docusaurus`
|
||||
- [#10090](https://github.com/facebook/docusaurus/pull/10090) fix(core): `docusaurus serve` redirects should include the site `/baseUrl/` prefix ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-module-type-aliases`, `docusaurus-preset-classic`, `docusaurus-theme-classic`, `docusaurus-theme-live-codeblock`, `docusaurus`
|
||||
- [#10079](https://github.com/facebook/docusaurus/pull/10079) fix: handle React v18.3 warnings ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-translations`
|
||||
- [#10070](https://github.com/facebook/docusaurus/pull/10070) fix(theme-translations): add missing theme translations for pt-BR ([@h3nr1ke](https://github.com/h3nr1ke))
|
||||
- [#10051](https://github.com/facebook/docusaurus/pull/10051) fix(theme-translations): correct label for tip admonition in italian ([@tomsotte](https://github.com/tomsotte))
|
||||
- `docusaurus-theme-search-algolia`
|
||||
- [#10048](https://github.com/facebook/docusaurus/pull/10048) fix(algolia): add insights property on Algolia Theme Config object TS definition ([@Virgil993](https://github.com/Virgil993))
|
||||
- `docusaurus-plugin-content-docs`, `docusaurus`
|
||||
- [#10054](https://github.com/facebook/docusaurus/pull/10054) fix(core): sortRoutes shouldn't have a default baseUrl value, this led to a bug ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-plugin-content-docs`
|
||||
- [#10025](https://github.com/facebook/docusaurus/pull/10025) fix(docs): sidebar item label impact the pagination label of docs ([@Abdullah-03](https://github.com/Abdullah-03))
|
||||
- `docusaurus-utils`
|
||||
- [#10022](https://github.com/facebook/docusaurus/pull/10022) fix(utils): getFileCommitDate should support `log.showSignature=true` ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :running_woman: Performance
|
||||
|
||||
- `docusaurus`
|
||||
- [#10060](https://github.com/facebook/docusaurus/pull/10060) refactor(core): optimize App entrypoint, it should not re-render when navigating ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :nail_care: Polish
|
||||
|
||||
- `docusaurus-theme-classic`
|
||||
- [#10061](https://github.com/facebook/docusaurus/pull/10061) refactor(theme): simplify CSS solution to solve empty search container ([@slorber](https://github.com/slorber))
|
||||
- `docusaurus-theme-common`
|
||||
- [#10023](https://github.com/facebook/docusaurus/pull/10023) refactor(website): refactor showcase components ([@slorber](https://github.com/slorber))
|
||||
|
||||
#### :memo: Documentation
|
||||
|
||||
- [#10096](https://github.com/facebook/docusaurus/pull/10096) docs: Fix `déja` to `déjà` in `swizzling.mdx` ([@Zwyx](https://github.com/Zwyx))
|
||||
- [#10093](https://github.com/facebook/docusaurus/pull/10093) docs: Fix dead Typesense links ([@kaihoffman](https://github.com/kaihoffman))
|
||||
- [#10085](https://github.com/facebook/docusaurus/pull/10085) docs: make `ThemedImage` example work out of the box ([@lebalz](https://github.com/lebalz))
|
||||
- [#10082](https://github.com/facebook/docusaurus/pull/10082) docs: add note regarding ts extension for config file. ([@homotechsual](https://github.com/homotechsual))
|
||||
- [#9490](https://github.com/facebook/docusaurus/pull/9490) docs: add troubleshooting steps to migration/upgrade page ([@homotechsual](https://github.com/homotechsual))
|
||||
- [#10056](https://github.com/facebook/docusaurus/pull/10056) docs(search): Algolia troubleshooting section for index configuration problems ([@slorber](https://github.com/slorber))
|
||||
- [#10039](https://github.com/facebook/docusaurus/pull/10039) docs: visit is a named export of unist-util-visit ([@pearmini](https://github.com/pearmini))
|
||||
- [#10020](https://github.com/facebook/docusaurus/pull/10020) docs: Fix wrong path example ([@tomy0000000](https://github.com/tomy0000000))
|
||||
- [#10011](https://github.com/facebook/docusaurus/pull/10011) docs: add stormkit as deployment platform ([@eldemcan](https://github.com/eldemcan))
|
||||
|
||||
#### :robot: Dependencies
|
||||
|
||||
- [#10097](https://github.com/facebook/docusaurus/pull/10097) chore(deps): bump ejs from 3.1.9 to 3.1.10 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10089](https://github.com/facebook/docusaurus/pull/10089) chore(deps): bump actions/dependency-review-action from 4.2.5 to 4.3.1 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10088](https://github.com/facebook/docusaurus/pull/10088) chore(deps): bump preactjs/compressed-size-action from 2.5.0 to 2.6.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- [#10034](https://github.com/facebook/docusaurus/pull/10034) chore(deps): bump semver from 7.3.4 to 7.6.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
||||
|
||||
#### :wrench: Maintenance
|
||||
|
||||
- `create-docusaurus`, `docusaurus-cssnano-preset`, `docusaurus-logger`, `docusaurus-mdx-loader`, `docusaurus-plugin-client-redirects`, `docusaurus-plugin-content-blog`, `docusaurus-plugin-content-docs`, `docusaurus-plugin-content-pages`, `docusaurus-plugin-debug`, `docusaurus-plugin-google-analytics`, `docusaurus-plugin-google-gtag`, `docusaurus-plugin-google-tag-manager`, `docusaurus-plugin-ideal-image`, `docusaurus-plugin-pwa`, `docusaurus-plugin-sitemap`, `docusaurus-plugin-vercel-analytics`, `docusaurus-preset-classic`, `docusaurus-remark-plugin-npm2yarn`, `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-theme-live-codeblock`, `docusaurus-theme-mermaid`, `docusaurus-theme-search-algolia`, `docusaurus-theme-translations`, `docusaurus-utils-common`, `docusaurus-utils-validation`, `docusaurus-utils`, `docusaurus`, `eslint-plugin`, `lqip-loader`, `stylelint-copyright`
|
||||
- [#10065](https://github.com/facebook/docusaurus/pull/10065) refactor: extract base TS client config + upgrade TS + refactor TS setup ([@slorber](https://github.com/slorber))
|
||||
- Other
|
||||
- [#10063](https://github.com/facebook/docusaurus/pull/10063) test(e2e): TypeCheck website/starter in min/max range of TS versions ([@slorber](https://github.com/slorber))
|
||||
- [#10049](https://github.com/facebook/docusaurus/pull/10049) fix(website): fix website manifest.json name "Docusaurus v2" to just "Docusaurus" ([@volcanofr](https://github.com/volcanofr))
|
||||
|
||||
#### Committers: 20
|
||||
|
||||
- Abdullah Saud ([@Abdullah-03](https://github.com/Abdullah-03))
|
||||
- Alexander Sandor ([@SandPod](https://github.com/SandPod))
|
||||
- Alexey Ivanov ([@iAdramelk](https://github.com/iAdramelk))
|
||||
- Andrea Mazzucchelli ([@andrmaz](https://github.com/andrmaz))
|
||||
- Bairui Su ([@pearmini](https://github.com/pearmini))
|
||||
- Balthasar Hofer ([@lebalz](https://github.com/lebalz))
|
||||
- Can Eldem ([@eldemcan](https://github.com/eldemcan))
|
||||
- Daniel Li ([@d4nyll](https://github.com/d4nyll))
|
||||
- Guille ([@gagdiez](https://github.com/gagdiez))
|
||||
- H3NR1KE ([@h3nr1ke](https://github.com/h3nr1ke))
|
||||
- John Reilly ([@johnnyreilly](https://github.com/johnnyreilly))
|
||||
- Kai Hoffman ([@kaihoffman](https://github.com/kaihoffman))
|
||||
- Mikey O'Toole ([@homotechsual](https://github.com/homotechsual))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
- Tommaso Sotte ([@tomsotte](https://github.com/tomsotte))
|
||||
- Tomy Hsieh ([@tomy0000000](https://github.com/tomy0000000))
|
||||
- Zwyx ([@Zwyx](https://github.com/Zwyx))
|
||||
- [@Virgil993](https://github.com/Virgil993)
|
||||
- [@volcanofr](https://github.com/volcanofr)
|
||||
- ozaki ([@OzakIOne](https://github.com/OzakIOne))
|
||||
|
||||
## 3.2.1 (2024-04-04)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "new.docusaurus.io",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "npx --package netlify-cli netlify dev"
|
||||
|
|
|
@ -68,7 +68,7 @@ yarn serve
|
|||
|
||||
This local test step is optional because it will be run by the CI on your release PR ([see](https://github.com/facebook/docusaurus/pull/2954/checks?check_run_id=780871959))
|
||||
|
||||
### 3. Update the v2 changelog
|
||||
### 3. Update the changelog
|
||||
|
||||
The changelog uses GitHub labels to classify each pull request. Use the GitHub interface to assign each newly merged pull request to a GitHub label starting with `pr:`, otherwise the PR won't appear in the changelog.
|
||||
|
||||
|
@ -187,7 +187,7 @@ If all accesses are available, build all the necessary packages, and then run th
|
|||
|
||||
```sh
|
||||
yarn build:packages
|
||||
yarn lerna publish --exact 2.0.0-beta.0
|
||||
yarn lerna publish --force-publish --exact 2.0.0-beta.0
|
||||
```
|
||||
|
||||
This command does a few things:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "argos",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Argos visual diff tests",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
|
|
|
@ -8,6 +8,7 @@ import * as fs from 'fs';
|
|||
import {test} from '@playwright/test';
|
||||
import {argosScreenshot} from '@argos-ci/playwright';
|
||||
import * as cheerio from 'cheerio';
|
||||
import type {Page} from '@playwright/test';
|
||||
|
||||
const siteUrl = 'http://localhost:3000';
|
||||
const sitemapPath = '../website/build/sitemap.xml';
|
||||
|
@ -61,9 +62,12 @@ function getPathnames(): string[] {
|
|||
(pathname) => !isBlacklisted(pathname),
|
||||
);
|
||||
pathnames.sort();
|
||||
/*
|
||||
console.log('Pathnames:\n', JSON.stringify(pathnames, null, 2));
|
||||
console.log('Pathnames before filtering', pathnamesUnfiltered.length);
|
||||
console.log('Pathnames after filtering', pathnames.length);
|
||||
|
||||
*/
|
||||
return pathnames;
|
||||
}
|
||||
|
||||
|
@ -91,8 +95,47 @@ function waitForDocusaurusHydration() {
|
|||
return document.documentElement.dataset.hasHydrated === 'true';
|
||||
}
|
||||
|
||||
// Ensure that Docusaurus site pages do not emit unexpected errors/warnings
|
||||
// See https://github.com/microsoft/playwright/issues/27277
|
||||
// TODO this shouldn't be the responsibility of Argos tests to do this
|
||||
// but this is convenient to do this here for now
|
||||
function throwOnConsole(page: Page) {
|
||||
const typesToCheck = ['error', 'warning'];
|
||||
|
||||
const ignoreMessages = [
|
||||
// This mismatch warning looks like a React 18 bug to me
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s className "null" ""',
|
||||
|
||||
// TODO this fetch error message is unexpected and should be fixed
|
||||
// it's already happening in main branch
|
||||
'Failed to load resource: the server responded with a status of 404 (Not Found)',
|
||||
|
||||
// TODO looks like a legit hydration bug to fix
|
||||
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs/configuration" "/docs/configuration?docusaurus-theme=light"',
|
||||
|
||||
// TODO weird problem related to KaTeX fonts refusing to decode?
|
||||
// on http://localhost:3000/docs/markdown-features/math-equations
|
||||
'Failed to decode downloaded font: http://localhost:3000/katex/fonts/',
|
||||
'OTS parsing error: Failed to convert WOFF 2.0 font to SFNT',
|
||||
];
|
||||
|
||||
page.on('console', (message) => {
|
||||
if (!typesToCheck.includes(message.type())) {
|
||||
return;
|
||||
}
|
||||
if (ignoreMessages.some((msg) => message.text().includes(msg))) {
|
||||
return;
|
||||
}
|
||||
throw new Error(`Docusaurus site page unexpectedly logged something to the browser console
|
||||
Type=${message.type()}
|
||||
Text=${message.text()}
|
||||
Location=${message.location().url}`);
|
||||
});
|
||||
}
|
||||
|
||||
function createPathnameTest(pathname: string) {
|
||||
test(`pathname ${pathname}`, async ({page}) => {
|
||||
throwOnConsole(page);
|
||||
const url = siteUrl + pathname;
|
||||
await page.goto(url);
|
||||
await page.waitForFunction(waitForDocusaurusHydration);
|
||||
|
@ -102,6 +145,10 @@ function createPathnameTest(pathname: string) {
|
|||
});
|
||||
}
|
||||
|
||||
// Allow parallel execution within a single test file
|
||||
// See https://playwright.dev/docs/test-parallel
|
||||
test.describe.configure({mode: 'parallel'});
|
||||
|
||||
test.describe('Docusaurus site screenshots', () => {
|
||||
const pathnames = getPathnames();
|
||||
pathnames.forEach(createPathnameTest);
|
||||
|
|
10
examples/classic-typescript/package.json
generated
10
examples/classic-typescript/package.json
generated
|
@ -16,8 +16,8 @@
|
|||
"dev": "docusaurus start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.0",
|
||||
"@docusaurus/preset-classic": "3.2.0",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
|
@ -25,9 +25,9 @@
|
|||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.2.0",
|
||||
"@docusaurus/tsconfig": "3.2.0",
|
||||
"@docusaurus/types": "3.2.0",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/tsconfig": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"typescript": "~5.2.2"
|
||||
},
|
||||
"browserslist": {
|
||||
|
|
2004
examples/classic-typescript/yarn.lock
generated
2004
examples/classic-typescript/yarn.lock
generated
File diff suppressed because it is too large
Load diff
8
examples/classic/package.json
generated
8
examples/classic/package.json
generated
|
@ -15,8 +15,8 @@
|
|||
"dev": "docusaurus start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.0",
|
||||
"@docusaurus/preset-classic": "3.2.0",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
|
@ -24,8 +24,8 @@
|
|||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.2.0",
|
||||
"@docusaurus/types": "3.2.0"
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
1996
examples/classic/yarn.lock
generated
1996
examples/classic/yarn.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"useNx": false,
|
||||
|
|
|
@ -115,6 +115,6 @@
|
|||
"stylelint": "^14.16.1",
|
||||
"stylelint-config-prettier": "^9.0.5",
|
||||
"stylelint-config-standard": "^29.0.0",
|
||||
"typescript": "~5.2.2"
|
||||
"typescript": "~5.4.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "create-docusaurus",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Create Docusaurus apps easily.",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
@ -22,8 +22,8 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"commander": "^5.1.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
"lodash": "^4.17.21",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-typescript-template",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -15,8 +15,8 @@
|
|||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/preset-classic": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
|
@ -24,9 +24,9 @@
|
|||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/tsconfig": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/tsconfig": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"typescript": "~5.2.2"
|
||||
},
|
||||
"browserslist": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-template",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -14,8 +14,8 @@
|
|||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/preset-classic": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
|
@ -23,8 +23,8 @@
|
|||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1"
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/cssnano-preset",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Advanced cssnano preset for maximum optimization.",
|
||||
"main": "lib/index.js",
|
||||
"license": "MIT",
|
||||
|
@ -17,9 +17,9 @@
|
|||
"directory": "packages/docusaurus-cssnano-preset"
|
||||
},
|
||||
"dependencies": {
|
||||
"cssnano-preset-advanced": "^5.3.10",
|
||||
"postcss": "^8.4.26",
|
||||
"postcss-sort-media-queries": "^4.4.1",
|
||||
"cssnano-preset-advanced": "^6.1.2",
|
||||
"postcss": "^8.4.38",
|
||||
"postcss-sort-media-queries": "^5.2.0",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/logger",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "An encapsulated logger for semantically formatting console messages.",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/mdx-loader",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Docusaurus Loader for MDX",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,9 +18,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"@mdx-js/mdx": "^3.0.0",
|
||||
"@slorber/remark-comment": "^1.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
|
@ -44,7 +44,7 @@
|
|||
"webpack": "^5.88.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@types/escape-html": "^1.0.2",
|
||||
"@types/mdast": "^4.0.2",
|
||||
"@types/stringify-object": "^3.3.1",
|
||||
|
|
|
@ -47,11 +47,6 @@ type SimpleProcessor = {
|
|||
}) => Promise<SimpleProcessorResult>;
|
||||
};
|
||||
|
||||
async function getDefaultRemarkPlugins(): Promise<MDXPlugin[]> {
|
||||
const {default: emoji} = await import('remark-emoji');
|
||||
return [headings, emoji, toc];
|
||||
}
|
||||
|
||||
export type MDXPlugin = Pluggable;
|
||||
|
||||
export type MDXOptions = {
|
||||
|
@ -86,8 +81,18 @@ async function createProcessorFactory() {
|
|||
const {default: comment} = await import('@slorber/remark-comment');
|
||||
const {default: directive} = await import('remark-directive');
|
||||
const {VFile} = await import('vfile');
|
||||
const {default: emoji} = await import('remark-emoji');
|
||||
|
||||
const defaultRemarkPlugins = await getDefaultRemarkPlugins();
|
||||
function getDefaultRemarkPlugins({options}: {options: Options}): MDXPlugin[] {
|
||||
return [
|
||||
[
|
||||
headings,
|
||||
{anchorsMaintainCase: options.markdownConfig.anchors.maintainCase},
|
||||
],
|
||||
emoji,
|
||||
toc,
|
||||
];
|
||||
}
|
||||
|
||||
// /!\ this method is synchronous on purpose
|
||||
// Using async code here can create cache entry race conditions!
|
||||
|
@ -104,7 +109,7 @@ async function createProcessorFactory() {
|
|||
directive,
|
||||
[contentTitle, {removeContentTitle: options.removeContentTitle}],
|
||||
...getAdmonitionsPlugins(options.admonitions ?? false),
|
||||
...defaultRemarkPlugins,
|
||||
...getDefaultRemarkPlugins({options}),
|
||||
details,
|
||||
head,
|
||||
...(options.markdownConfig.mermaid ? [mermaid] : []),
|
||||
|
|
|
@ -11,13 +11,20 @@ import u from 'unist-builder';
|
|||
import {removePosition} from 'unist-util-remove-position';
|
||||
import {toString} from 'mdast-util-to-string';
|
||||
import {visit} from 'unist-util-visit';
|
||||
import slug from '../index';
|
||||
import plugin from '../index';
|
||||
import type {PluginOptions} from '../index';
|
||||
import type {Plugin} from 'unified';
|
||||
import type {Parent} from 'unist';
|
||||
|
||||
async function process(doc: string, plugins: Plugin[] = []) {
|
||||
async function process(
|
||||
doc: string,
|
||||
plugins: Plugin[] = [],
|
||||
options: PluginOptions = {anchorsMaintainCase: false},
|
||||
) {
|
||||
const {remark} = await import('remark');
|
||||
const processor = await remark().use({plugins: [...plugins, slug]});
|
||||
const processor = await remark().use({
|
||||
plugins: [...plugins, [plugin, options]],
|
||||
});
|
||||
const result = await processor.run(processor.parse(doc));
|
||||
removePosition(result, {force: true});
|
||||
return result;
|
||||
|
@ -312,4 +319,25 @@ describe('headings remark plugin', () => {
|
|||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('preserve anchors case then "anchorsMaintainCase" option is set', async () => {
|
||||
const result = await process('# Case Sensitive Heading', [], {
|
||||
anchorsMaintainCase: true,
|
||||
});
|
||||
const expected = u('root', [
|
||||
u(
|
||||
'heading',
|
||||
{
|
||||
depth: 1,
|
||||
data: {
|
||||
hProperties: {id: 'Case-Sensitive-Heading'},
|
||||
id: 'Case-Sensitive-Heading',
|
||||
},
|
||||
},
|
||||
[u('text', 'Case Sensitive Heading')],
|
||||
),
|
||||
]);
|
||||
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,7 +12,13 @@ import {parseMarkdownHeadingId, createSlugger} from '@docusaurus/utils';
|
|||
import type {Transformer} from 'unified';
|
||||
import type {Heading, Text} from 'mdast';
|
||||
|
||||
export default function plugin(): Transformer {
|
||||
export interface PluginOptions {
|
||||
anchorsMaintainCase: boolean;
|
||||
}
|
||||
|
||||
export default function plugin({
|
||||
anchorsMaintainCase,
|
||||
}: PluginOptions): Transformer {
|
||||
return async (root) => {
|
||||
const {toString} = await import('mdast-util-to-string');
|
||||
const {visit} = await import('unist-util-visit');
|
||||
|
@ -38,7 +44,9 @@ export default function plugin(): Transformer {
|
|||
// Support explicit heading IDs
|
||||
const parsedHeading = parseMarkdownHeadingId(heading);
|
||||
|
||||
id = parsedHeading.id ?? slugs.slug(heading);
|
||||
id =
|
||||
parsedHeading.id ??
|
||||
slugs.slug(heading, {maintainCase: anchorsMaintainCase});
|
||||
|
||||
if (parsedHeading.id) {
|
||||
// When there's an id, it is always in the last child node
|
||||
|
|
|
@ -25,7 +25,7 @@ const processFixture = async (name: string) => {
|
|||
|
||||
const result = await compile(file, {
|
||||
format: 'mdx',
|
||||
remarkPlugins: [headings, gfm, plugin],
|
||||
remarkPlugins: [[headings, {anchorsMaintainCase: false}], gfm, plugin],
|
||||
rehypePlugins: [],
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/module-type-aliases",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Docusaurus module type aliases.",
|
||||
"types": "./src/index.d.ts",
|
||||
"publishConfig": {
|
||||
|
@ -12,14 +12,13 @@
|
|||
"directory": "packages/docusaurus-module-type-aliases"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/react-loadable": "5.5.2",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@types/history": "^4.7.11",
|
||||
"@types/react": "*",
|
||||
"@types/react-router-config": "*",
|
||||
"@types/react-router-dom": "*",
|
||||
"react-helmet-async": "*",
|
||||
"react-loadable": "npm:@docusaurus/react-loadable@5.5.2"
|
||||
"react-loadable": "npm:@docusaurus/react-loadable@6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
|
|
|
@ -387,4 +387,5 @@ interface Window {
|
|||
prefetch: (url: string) => false | Promise<void[]>;
|
||||
preload: (url: string) => false | Promise<void[]>;
|
||||
};
|
||||
docusaurusRoot?: import('react-dom/client').Root;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-client-redirects",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Client redirects plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,18 +18,18 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"eta": "^2.2.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
"lodash": "^4.17.21",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/types": "3.2.1"
|
||||
"@docusaurus/types": "3.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-content-blog",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Blog plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-content-blog.d.ts",
|
||||
|
@ -31,13 +31,13 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/mdx-loader": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/mdx-loader": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"feed": "^4.2.2",
|
||||
"fs-extra": "^11.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-content-docs",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Docs plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"sideEffects": false,
|
||||
|
@ -35,14 +35,14 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/mdx-loader": "3.2.1",
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/mdx-loader": "3.3.2",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"@types/react-router-config": "^5.0.7",
|
||||
"combine-promises": "^1.1.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-content-pages",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Pages plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-content-pages.d.ts",
|
||||
|
@ -18,11 +18,11 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/mdx-loader": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/mdx-loader": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"fs-extra": "^11.1.1",
|
||||
"tslib": "^2.6.0",
|
||||
"webpack": "^5.88.1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-debug",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Debug plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-debug.d.ts",
|
||||
|
@ -20,9 +20,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"fs-extra": "^11.1.1",
|
||||
"react-json-view-lite": "^1.2.0",
|
||||
"tslib": "^2.6.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-google-analytics",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Global analytics (analytics.js) plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,9 +18,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-google-gtag",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Global Site Tag (gtag.js) plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,9 +18,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"@types/gtag.js": "^0.0.12",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-google-tag-manager",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Google Tag Manager (gtm.js) plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,9 +18,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-ideal-image",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-ideal-image.d.ts",
|
||||
|
@ -20,12 +20,12 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/lqip-loader": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/lqip-loader": "3.3.2",
|
||||
"@docusaurus/responsive-loader": "^1.7.0",
|
||||
"@docusaurus/theme-translations": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/theme-translations": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"@slorber/react-ideal-image": "^0.0.12",
|
||||
"react-waypoint": "^10.3.0",
|
||||
"sharp": "^0.32.3",
|
||||
|
@ -33,7 +33,7 @@
|
|||
"webpack": "^5.88.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"fs-extra": "^11.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-pwa",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Docusaurus Plugin to add PWA support.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-pwa.d.ts",
|
||||
|
@ -22,12 +22,12 @@
|
|||
"dependencies": {
|
||||
"@babel/core": "^7.23.3",
|
||||
"@babel/preset-env": "^7.23.3",
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/theme-common": "3.2.1",
|
||||
"@docusaurus/theme-translations": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/theme-common": "3.3.2",
|
||||
"@docusaurus/theme-translations": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"babel-loader": "^9.1.3",
|
||||
"clsx": "^2.0.0",
|
||||
"core-js": "^3.31.1",
|
||||
|
@ -41,7 +41,7 @@
|
|||
"workbox-window": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"fs-extra": "^11.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-sitemap",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Simple sitemap generation plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,12 +18,12 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"fs-extra": "^11.1.1",
|
||||
"sitemap": "^7.1.1",
|
||||
"tslib": "^2.6.0"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {createElement} from 'react';
|
||||
import {fromPartial} from '@total-typescript/shoehorn';
|
||||
import createSitemap from '../createSitemap';
|
||||
import type {PluginOptions} from '../options';
|
||||
|
@ -84,6 +84,53 @@ describe('createSitemap', () => {
|
|||
expect(sitemap).not.toContain('/tags');
|
||||
});
|
||||
|
||||
it('excludes items that createSitemapItems configures to be ignored', async () => {
|
||||
const sitemap = await createSitemap({
|
||||
siteConfig,
|
||||
routes: routes([
|
||||
'/',
|
||||
'/search/',
|
||||
'/tags/',
|
||||
'/search/foo',
|
||||
'/tags/foo/bar',
|
||||
]),
|
||||
head: {},
|
||||
options: {
|
||||
...options,
|
||||
createSitemapItems: async (params) => {
|
||||
const {defaultCreateSitemapItems, ...rest} = params;
|
||||
const sitemapItems = await defaultCreateSitemapItems(rest);
|
||||
const sitemapsWithoutPageAndTags = sitemapItems.filter(
|
||||
(sitemapItem) =>
|
||||
!sitemapItem.url.includes('/tags/') &&
|
||||
!sitemapItem.url.endsWith('/search/'),
|
||||
);
|
||||
return sitemapsWithoutPageAndTags;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(sitemap).not.toContain('/search/</loc>');
|
||||
expect(sitemap).toContain('/search/foo');
|
||||
expect(sitemap).not.toContain('/tags');
|
||||
});
|
||||
|
||||
it('returns null when createSitemapItems returns no items', async () => {
|
||||
const sitemap = await createSitemap({
|
||||
siteConfig,
|
||||
routes: routes(['/', '/docs/myDoc/', '/blog/post']),
|
||||
head: {},
|
||||
options: {
|
||||
...options,
|
||||
createSitemapItems: async () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(sitemap).toBeNull();
|
||||
});
|
||||
|
||||
it('keep trailing slash unchanged', async () => {
|
||||
const sitemap = await createSitemap({
|
||||
siteConfig,
|
||||
|
@ -140,7 +187,7 @@ describe('createSitemap', () => {
|
|||
meta: {
|
||||
// @ts-expect-error: bad lib def
|
||||
toComponent: () => [
|
||||
React.createElement('meta', {
|
||||
createElement('meta', {
|
||||
name: 'robots',
|
||||
content: 'NoFolloW, NoiNDeX',
|
||||
}),
|
||||
|
@ -164,7 +211,7 @@ describe('createSitemap', () => {
|
|||
meta: {
|
||||
// @ts-expect-error: bad lib def
|
||||
toComponent: () => [
|
||||
React.createElement('meta', {name: 'robots', content: 'noindex'}),
|
||||
createElement('meta', {name: 'robots', content: 'noindex'}),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -172,7 +219,7 @@ describe('createSitemap', () => {
|
|||
meta: {
|
||||
// @ts-expect-error: bad lib def
|
||||
toComponent: () => [
|
||||
React.createElement('meta', {name: 'robots', content: 'noindex'}),
|
||||
createElement('meta', {name: 'robots', content: 'noindex'}),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -249,4 +249,44 @@ describe('validateOptions', () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('createSitemapItems', () => {
|
||||
it('accept createSitemapItems undefined', () => {
|
||||
const userOptions: Options = {
|
||||
createSitemapItems: undefined,
|
||||
};
|
||||
expect(testValidate(userOptions)).toEqual(defaultOptions);
|
||||
});
|
||||
|
||||
it('accept createSitemapItems valid', () => {
|
||||
const userOptions: Options = {
|
||||
createSitemapItems: async (params) => {
|
||||
const {defaultCreateSitemapItems, ...rest} = params;
|
||||
const sitemapItems = await defaultCreateSitemapItems(rest);
|
||||
const sitemapsWithoutPageAndTags = sitemapItems.filter(
|
||||
(sitemapItem) =>
|
||||
!sitemapItem.url.includes('/tags/') &&
|
||||
!sitemapItem.url.includes('/page/'),
|
||||
);
|
||||
return sitemapsWithoutPageAndTags;
|
||||
},
|
||||
};
|
||||
expect(testValidate(userOptions)).toEqual({
|
||||
...defaultOptions,
|
||||
...userOptions,
|
||||
});
|
||||
});
|
||||
|
||||
it('rejects createSitemapItems bad input type', () => {
|
||||
const userOptions: Options = {
|
||||
// @ts-expect-error: test
|
||||
createSitemapItems: 'not a function',
|
||||
};
|
||||
expect(() =>
|
||||
testValidate(userOptions),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`""createSitemapItems" must be of type function"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,57 +5,14 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {ReactElement} from 'react';
|
||||
import {createMatcher, flattenRoutes} from '@docusaurus/utils';
|
||||
import {sitemapItemsToXmlString} from './xml';
|
||||
import {createSitemapItem} from './createSitemapItem';
|
||||
import type {SitemapItem} from './types';
|
||||
import type {DocusaurusConfig, RouteConfig} from '@docusaurus/types';
|
||||
import type {HelmetServerState} from 'react-helmet-async';
|
||||
import {isNoIndexMetaRoute} from './head';
|
||||
import type {CreateSitemapItemsFn, CreateSitemapItemsParams} from './types';
|
||||
import type {RouteConfig} from '@docusaurus/types';
|
||||
import type {PluginOptions} from './options';
|
||||
|
||||
type CreateSitemapParams = {
|
||||
siteConfig: DocusaurusConfig;
|
||||
routes: RouteConfig[];
|
||||
head: {[location: string]: HelmetServerState};
|
||||
options: PluginOptions;
|
||||
};
|
||||
|
||||
// Maybe we want to add a routeConfig.metadata.noIndex instead?
|
||||
// But using Helmet is more reliable for third-party plugins...
|
||||
function isNoIndexMetaRoute({
|
||||
head,
|
||||
route,
|
||||
}: {
|
||||
head: {[location: string]: HelmetServerState};
|
||||
route: string;
|
||||
}) {
|
||||
const isNoIndexMetaTag = ({
|
||||
name,
|
||||
content,
|
||||
}: {
|
||||
name?: string;
|
||||
content?: string;
|
||||
}): boolean => {
|
||||
if (!name || !content) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
// meta name is not case-sensitive
|
||||
name.toLowerCase() === 'robots' &&
|
||||
// Robots directives are not case-sensitive
|
||||
content.toLowerCase().includes('noindex')
|
||||
);
|
||||
};
|
||||
|
||||
// https://github.com/staylor/react-helmet-async/pull/167
|
||||
const meta = head[route]?.meta.toComponent() as unknown as
|
||||
| ReactElement<{name?: string; content?: string}>[]
|
||||
| undefined;
|
||||
return meta?.some((tag) =>
|
||||
isNoIndexMetaTag({name: tag.props.name, content: tag.props.content}),
|
||||
);
|
||||
}
|
||||
import type {HelmetServerState} from 'react-helmet-async';
|
||||
|
||||
// Not all routes should appear in the sitemap, and we should filter:
|
||||
// - parent routes, used for layouts
|
||||
|
@ -75,10 +32,13 @@ function getSitemapRoutes({routes, head, options}: CreateSitemapParams) {
|
|||
return flattenRoutes(routes).filter((route) => !isRouteExcluded(route));
|
||||
}
|
||||
|
||||
async function createSitemapItems(
|
||||
params: CreateSitemapParams,
|
||||
): Promise<SitemapItem[]> {
|
||||
const sitemapRoutes = getSitemapRoutes(params);
|
||||
// Our default implementation receives some additional parameters on purpose
|
||||
// Params such as "head" are "messy" and not directly exposed to the user
|
||||
function createDefaultCreateSitemapItems(
|
||||
internalParams: Pick<CreateSitemapParams, 'head' | 'options'>,
|
||||
): CreateSitemapItemsFn {
|
||||
return async (params) => {
|
||||
const sitemapRoutes = getSitemapRoutes({...params, ...internalParams});
|
||||
if (sitemapRoutes.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
@ -87,20 +47,42 @@ async function createSitemapItems(
|
|||
createSitemapItem({
|
||||
route,
|
||||
siteConfig: params.siteConfig,
|
||||
options: params.options,
|
||||
options: internalParams.options,
|
||||
}),
|
||||
),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
type CreateSitemapParams = CreateSitemapItemsParams & {
|
||||
head: {[location: string]: HelmetServerState};
|
||||
options: PluginOptions;
|
||||
};
|
||||
|
||||
export default async function createSitemap(
|
||||
params: CreateSitemapParams,
|
||||
): Promise<string | null> {
|
||||
const items = await createSitemapItems(params);
|
||||
if (items.length === 0) {
|
||||
const {head, options, routes, siteConfig} = params;
|
||||
|
||||
const defaultCreateSitemapItems: CreateSitemapItemsFn =
|
||||
createDefaultCreateSitemapItems({head, options});
|
||||
|
||||
const sitemapItems = params.options.createSitemapItems
|
||||
? await params.options.createSitemapItems({
|
||||
routes,
|
||||
siteConfig,
|
||||
defaultCreateSitemapItems,
|
||||
})
|
||||
: await defaultCreateSitemapItems({
|
||||
routes,
|
||||
siteConfig,
|
||||
});
|
||||
|
||||
if (sitemapItems.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const xmlString = await sitemapItemsToXmlString(items, {
|
||||
|
||||
const xmlString = await sitemapItemsToXmlString(sitemapItems, {
|
||||
lastmod: params.options.lastmod,
|
||||
});
|
||||
return xmlString;
|
||||
|
|
47
packages/docusaurus-plugin-sitemap/src/head.ts
Normal file
47
packages/docusaurus-plugin-sitemap/src/head.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import type {ReactElement} from 'react';
|
||||
import type {HelmetServerState} from 'react-helmet-async';
|
||||
|
||||
// Maybe we want to add a routeConfig.metadata.noIndex instead?
|
||||
// But using Helmet is more reliable for third-party plugins...
|
||||
export function isNoIndexMetaRoute({
|
||||
head,
|
||||
route,
|
||||
}: {
|
||||
head: {[location: string]: HelmetServerState};
|
||||
route: string;
|
||||
}): boolean {
|
||||
const isNoIndexMetaTag = ({
|
||||
name,
|
||||
content,
|
||||
}: {
|
||||
name?: string;
|
||||
content?: string;
|
||||
}): boolean => {
|
||||
if (!name || !content) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
// meta name is not case-sensitive
|
||||
name.toLowerCase() === 'robots' &&
|
||||
// Robots directives are not case-sensitive
|
||||
content.toLowerCase().includes('noindex')
|
||||
);
|
||||
};
|
||||
|
||||
// https://github.com/staylor/react-helmet-async/pull/167
|
||||
const meta = head[route]?.meta.toComponent() as unknown as
|
||||
| ReactElement<{name?: string; content?: string}>[]
|
||||
| undefined;
|
||||
return (
|
||||
meta?.some((tag) =>
|
||||
isNoIndexMetaTag({name: tag.props.name, content: tag.props.content}),
|
||||
) ?? false
|
||||
);
|
||||
}
|
|
@ -8,7 +8,13 @@
|
|||
import {Joi} from '@docusaurus/utils-validation';
|
||||
import {ChangeFreqList, LastModOptionList} from './types';
|
||||
import type {OptionValidationContext} from '@docusaurus/types';
|
||||
import type {ChangeFreq, LastModOption} from './types';
|
||||
import type {
|
||||
ChangeFreq,
|
||||
LastModOption,
|
||||
SitemapItem,
|
||||
CreateSitemapItemsFn,
|
||||
CreateSitemapItemsParams,
|
||||
} from './types';
|
||||
|
||||
export type PluginOptions = {
|
||||
/**
|
||||
|
@ -44,8 +50,17 @@ export type PluginOptions = {
|
|||
* @see https://www.sitemaps.org/protocol.html#xmlTagDefinitions
|
||||
*/
|
||||
priority: number | null;
|
||||
|
||||
/** Allow control over the construction of SitemapItems */
|
||||
createSitemapItems?: CreateSitemapItemsOption;
|
||||
};
|
||||
|
||||
type CreateSitemapItemsOption = (
|
||||
params: CreateSitemapItemsParams & {
|
||||
defaultCreateSitemapItems: CreateSitemapItemsFn;
|
||||
},
|
||||
) => Promise<SitemapItem[]>;
|
||||
|
||||
export type Options = Partial<PluginOptions>;
|
||||
|
||||
export const DEFAULT_OPTIONS: PluginOptions = {
|
||||
|
@ -90,6 +105,8 @@ const PluginOptionSchema = Joi.object<PluginOptions>({
|
|||
.valid(null, ...LastModOptionList)
|
||||
.default(DEFAULT_OPTIONS.lastmod),
|
||||
|
||||
createSitemapItems: Joi.function(),
|
||||
|
||||
ignorePatterns: Joi.array()
|
||||
.items(Joi.string())
|
||||
.default(DEFAULT_OPTIONS.ignorePatterns),
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {DocusaurusConfig, RouteConfig} from '@docusaurus/types';
|
||||
|
||||
export const LastModOptionList = ['date', 'datetime'] as const;
|
||||
|
||||
export type LastModOption = (typeof LastModOptionList)[number];
|
||||
|
@ -65,3 +67,12 @@ export type SitemapItem = {
|
|||
*/
|
||||
priority?: number | null;
|
||||
};
|
||||
|
||||
export type CreateSitemapItemsParams = {
|
||||
siteConfig: DocusaurusConfig;
|
||||
routes: RouteConfig[];
|
||||
};
|
||||
|
||||
export type CreateSitemapItemsFn = (
|
||||
params: CreateSitemapItemsParams,
|
||||
) => Promise<SitemapItem[]>;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/plugin-vercel-analytics",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Global vercel analytics plugin for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,11 +18,11 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"@vercel/analytics": "^1.1.1",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/preset-classic",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Classic preset for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -18,19 +18,19 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/plugin-content-blog": "3.2.1",
|
||||
"@docusaurus/plugin-content-docs": "3.2.1",
|
||||
"@docusaurus/plugin-content-pages": "3.2.1",
|
||||
"@docusaurus/plugin-debug": "3.2.1",
|
||||
"@docusaurus/plugin-google-analytics": "3.2.1",
|
||||
"@docusaurus/plugin-google-gtag": "3.2.1",
|
||||
"@docusaurus/plugin-google-tag-manager": "3.2.1",
|
||||
"@docusaurus/plugin-sitemap": "3.2.1",
|
||||
"@docusaurus/theme-classic": "3.2.1",
|
||||
"@docusaurus/theme-common": "3.2.1",
|
||||
"@docusaurus/theme-search-algolia": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1"
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/plugin-content-blog": "3.3.2",
|
||||
"@docusaurus/plugin-content-docs": "3.3.2",
|
||||
"@docusaurus/plugin-content-pages": "3.3.2",
|
||||
"@docusaurus/plugin-debug": "3.3.2",
|
||||
"@docusaurus/plugin-google-analytics": "3.3.2",
|
||||
"@docusaurus/plugin-google-gtag": "3.3.2",
|
||||
"@docusaurus/plugin-google-tag-manager": "3.3.2",
|
||||
"@docusaurus/plugin-sitemap": "3.3.2",
|
||||
"@docusaurus/theme-classic": "3.3.2",
|
||||
"@docusaurus/theme-common": "3.3.2",
|
||||
"@docusaurus/theme-search-algolia": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.0.0",
|
||||
|
|
|
@ -89,7 +89,7 @@ export default function preset(
|
|||
),
|
||||
);
|
||||
}
|
||||
if (isProd && sitemap !== false) {
|
||||
if (sitemap !== false && (isProd || debug)) {
|
||||
plugins.push(makePluginConfig('@docusaurus/plugin-sitemap', sitemap));
|
||||
}
|
||||
if (Object.keys(rest).length > 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/remark-plugin-npm2yarn",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Remark plugin for converting npm commands to Yarn commands as tabs.",
|
||||
"main": "lib/index.js",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-classic",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Classic theme for Docusaurus",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/theme-classic.d.ts",
|
||||
|
@ -20,19 +20,19 @@
|
|||
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/mdx-loader": "3.2.1",
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/plugin-content-blog": "3.2.1",
|
||||
"@docusaurus/plugin-content-docs": "3.2.1",
|
||||
"@docusaurus/plugin-content-pages": "3.2.1",
|
||||
"@docusaurus/plugin-content-showcase": "3.2.1",
|
||||
"@docusaurus/theme-common": "3.2.1",
|
||||
"@docusaurus/theme-translations": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/mdx-loader": "3.3.2",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/plugin-content-blog": "3.3.2",
|
||||
"@docusaurus/plugin-content-docs": "3.3.2",
|
||||
"@docusaurus/plugin-content-pages": "3.3.2",
|
||||
"@docusaurus/plugin-content-showcase": "3.3.2",
|
||||
"@docusaurus/theme-common": "3.3.2",
|
||||
"@docusaurus/theme-translations": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"copy-text-to-clipboard": "^3.2.0",
|
||||
|
|
|
@ -50,7 +50,7 @@ export default function AdmonitionLayout(props: Props): JSX.Element {
|
|||
const {type, icon, title, children, className} = props;
|
||||
return (
|
||||
<AdmonitionContainer type={type} className={className}>
|
||||
<AdmonitionHeading title={title} icon={icon} />
|
||||
{title || icon ? <AdmonitionHeading title={title} icon={icon} /> : null}
|
||||
<AdmonitionContent>{children}</AdmonitionContent>
|
||||
</AdmonitionContainer>
|
||||
);
|
||||
|
|
|
@ -28,7 +28,7 @@ export default function CodeBlockLine({
|
|||
});
|
||||
|
||||
const lineTokens = line.map((token, key) => (
|
||||
<span key={key} {...getTokenProps({token, key})} />
|
||||
<span key={key} {...getTokenProps({token})} />
|
||||
));
|
||||
|
||||
return (
|
||||
|
|
|
@ -140,8 +140,8 @@ function TabsComponent(props: Props): JSX.Element {
|
|||
const tabs = useTabs(props);
|
||||
return (
|
||||
<div className={clsx('tabs-container', styles.tabList)}>
|
||||
<TabList {...props} {...tabs} />
|
||||
<TabContent {...props} {...tabs} />
|
||||
<TabList {...tabs} {...props} />
|
||||
<TabContent {...tabs} {...props} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-common",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Common code for Docusaurus themes.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
@ -30,13 +30,13 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/mdx-loader": "3.2.1",
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/plugin-content-blog": "3.2.1",
|
||||
"@docusaurus/plugin-content-docs": "3.2.1",
|
||||
"@docusaurus/plugin-content-pages": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/mdx-loader": "3.3.2",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/plugin-content-blog": "3.3.2",
|
||||
"@docusaurus/plugin-content-docs": "3.3.2",
|
||||
"@docusaurus/plugin-content-pages": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@types/history": "^4.7.11",
|
||||
"@types/react": "*",
|
||||
"@types/react-router-config": "*",
|
||||
|
@ -47,8 +47,8 @@
|
|||
"utility-types": "^3.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"fs-extra": "^11.1.1",
|
||||
"lodash": "^4.17.21",
|
||||
"schema-dts": "^1.1.2"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-live-codeblock",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Docusaurus live code block component.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/theme-live-codeblock.d.ts",
|
||||
|
@ -23,18 +23,18 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/theme-common": "3.2.1",
|
||||
"@docusaurus/theme-translations": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/theme-common": "3.3.2",
|
||||
"@docusaurus/theme-translations": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"@philpl/buble": "^0.19.7",
|
||||
"clsx": "^2.0.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
"react-live": "^4.1.5",
|
||||
"react-live": "^4.1.6",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@types/buble": "^0.20.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-mermaid",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Mermaid components for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/theme-mermaid.d.ts",
|
||||
|
@ -33,11 +33,11 @@
|
|||
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/theme-common": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/theme-common": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"mermaid": "^10.4.0",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-search-algolia",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Algolia search component for Docusaurus.",
|
||||
"main": "lib/index.js",
|
||||
"sideEffects": [
|
||||
|
@ -34,13 +34,13 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@docsearch/react": "^3.5.2",
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/plugin-content-docs": "3.2.1",
|
||||
"@docusaurus/theme-common": "3.2.1",
|
||||
"@docusaurus/theme-translations": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/plugin-content-docs": "3.3.2",
|
||||
"@docusaurus/theme-common": "3.3.2",
|
||||
"@docusaurus/theme-translations": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"algoliasearch": "^4.18.0",
|
||||
"algoliasearch-helper": "^3.13.3",
|
||||
"clsx": "^2.0.0",
|
||||
|
@ -51,7 +51,7 @@
|
|||
"utility-types": "^3.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.2.1"
|
||||
"@docusaurus/module-type-aliases": "3.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.0.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"theme.IdealImageMessage.404error": "404. Image not found",
|
||||
"theme.IdealImageMessage.error": "Error. Click to reload",
|
||||
"theme.IdealImageMessage.load": "Click to load{sizeMessage}",
|
||||
"theme.IdealImageMessage.loading": "Loading...",
|
||||
"theme.IdealImageMessage.offline": "Your browser is offline. Image not loaded"
|
||||
"theme.IdealImageMessage.404error": "404. Imagem não encontrada",
|
||||
"theme.IdealImageMessage.error": "Erro. Clique para recarregar",
|
||||
"theme.IdealImageMessage.load": "Clique para carregar{sizeMessage}",
|
||||
"theme.IdealImageMessage.loading": "Carregando...",
|
||||
"theme.IdealImageMessage.offline": "Seu browser está offline. Imagem não carregada"
|
||||
}
|
||||
|
|
|
@ -69,6 +69,6 @@
|
|||
"theme.tags.tagsListLabel": "Marcadores:",
|
||||
"theme.tags.tagsPageLink": "Ver todas os Marcadores",
|
||||
"theme.tags.tagsPageTitle": "Marcadores",
|
||||
"theme.unlistedContent.message": "This page is unlisted. Search engines will not index it, and only users having a direct link can access it.",
|
||||
"theme.unlistedContent.message": "Esta página não está listada. Mecanismos de busca não armazenarão nenhuma informação, e somente usuários que possuam o link direto poderão acessá-la",
|
||||
"theme.unlistedContent.title": "Página não listada"
|
||||
}
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
{
|
||||
"theme.SearchBar.label": "Buscar",
|
||||
"theme.SearchBar.seeAll": "See all {count} results",
|
||||
"theme.SearchModal.errorScreen.helpText": "You might want to check your network connection.",
|
||||
"theme.SearchModal.errorScreen.titleText": "Unable to fetch results",
|
||||
"theme.SearchModal.footer.closeKeyAriaLabel": "Escape key",
|
||||
"theme.SearchModal.footer.closeText": "to close",
|
||||
"theme.SearchModal.footer.navigateDownKeyAriaLabel": "Arrow down",
|
||||
"theme.SearchModal.footer.navigateText": "to navigate",
|
||||
"theme.SearchModal.footer.navigateUpKeyAriaLabel": "Arrow up",
|
||||
"theme.SearchModal.footer.searchByText": "Search by",
|
||||
"theme.SearchModal.footer.selectKeyAriaLabel": "Enter key",
|
||||
"theme.SearchModal.footer.selectText": "to select",
|
||||
"theme.SearchModal.noResultsScreen.noResultsText": "No results for",
|
||||
"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "Let us know.",
|
||||
"theme.SearchModal.noResultsScreen.reportMissingResultsText": "Believe this query should return results?",
|
||||
"theme.SearchModal.noResultsScreen.suggestedQueryText": "Try searching for",
|
||||
"theme.SearchModal.placeholder": "Search docs",
|
||||
"theme.SearchModal.searchBox.cancelButtonText": "Cancel",
|
||||
"theme.SearchModal.searchBox.resetButtonTitle": "Clear the query",
|
||||
"theme.SearchModal.startScreen.favoriteSearchesTitle": "Favorite",
|
||||
"theme.SearchModal.startScreen.noRecentSearchesText": "No recent searches",
|
||||
"theme.SearchModal.startScreen.recentSearchesTitle": "Recent",
|
||||
"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Remove this search from favorites",
|
||||
"theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Remove this search from history",
|
||||
"theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Save this search",
|
||||
"theme.SearchBar.seeAll": "Ver todos os {count} resultados",
|
||||
"theme.SearchModal.errorScreen.helpText": "Talvez você deva verificar sua conexão de rede.",
|
||||
"theme.SearchModal.errorScreen.titleText": "Não foi possível obter resultados",
|
||||
"theme.SearchModal.footer.closeKeyAriaLabel": "Tecla Esc",
|
||||
"theme.SearchModal.footer.closeText": "fechar",
|
||||
"theme.SearchModal.footer.navigateDownKeyAriaLabel": "Seta para baixo",
|
||||
"theme.SearchModal.footer.navigateText": "navegar",
|
||||
"theme.SearchModal.footer.navigateUpKeyAriaLabel": "Seta para cima",
|
||||
"theme.SearchModal.footer.searchByText": "Esta busca utiliza",
|
||||
"theme.SearchModal.footer.selectKeyAriaLabel": "Tecla Enter",
|
||||
"theme.SearchModal.footer.selectText": "selecionar",
|
||||
"theme.SearchModal.noResultsScreen.noResultsText": "Nenhum resultado para",
|
||||
"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": "Nos avise.",
|
||||
"theme.SearchModal.noResultsScreen.reportMissingResultsText": "Você acha que esta busca deveria retornar resultados?",
|
||||
"theme.SearchModal.noResultsScreen.suggestedQueryText": "Tente buscar por",
|
||||
"theme.SearchModal.placeholder": "Buscar documentos",
|
||||
"theme.SearchModal.searchBox.cancelButtonText": "Cancelar",
|
||||
"theme.SearchModal.searchBox.resetButtonTitle": "Limpar a busca",
|
||||
"theme.SearchModal.startScreen.favoriteSearchesTitle": "Favorito",
|
||||
"theme.SearchModal.startScreen.noRecentSearchesText": "Nenhuma busca recente",
|
||||
"theme.SearchModal.startScreen.recentSearchesTitle": "Recente",
|
||||
"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": "Remover esta busca dos favoritos",
|
||||
"theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Remover esta busca do histórico",
|
||||
"theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Salvar esta busca",
|
||||
"theme.SearchPage.algoliaLabel": "Busca feita por Algolia",
|
||||
"theme.SearchPage.documentsFound.plurals": "Um documento encontrado|{count} documentos encontrados",
|
||||
"theme.SearchPage.emptyResultsTitle": "Busca da documentação",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/theme-translations",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Docusaurus theme translations.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -23,8 +23,8 @@
|
|||
"tslib": "^2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/tsconfig",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Docusaurus base TypeScript configuration.",
|
||||
"main": "tsconfig.json",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/types",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Common types for Docusaurus packages.",
|
||||
"types": "./src/index.d.ts",
|
||||
"publishConfig": {
|
||||
|
|
12
packages/docusaurus-types/src/config.d.ts
vendored
12
packages/docusaurus-types/src/config.d.ts
vendored
|
@ -45,6 +45,13 @@ export type ParseFrontMatter = (
|
|||
},
|
||||
) => Promise<ParseFrontMatterResult>;
|
||||
|
||||
export type MarkdownAnchorsConfig = {
|
||||
/**
|
||||
* Preserves the case of the heading text when generating anchor ids.
|
||||
*/
|
||||
maintainCase: boolean;
|
||||
};
|
||||
|
||||
export type MarkdownConfig = {
|
||||
/**
|
||||
* The Markdown format to use by default.
|
||||
|
@ -101,6 +108,11 @@ export type MarkdownConfig = {
|
|||
* See also https://github.com/remarkjs/remark-rehype#options
|
||||
*/
|
||||
remarkRehypeOptions: RemarkRehypeOptions;
|
||||
|
||||
/**
|
||||
* Options to control the behavior of anchors generated from Markdown headings
|
||||
*/
|
||||
anchors: MarkdownAnchorsConfig;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/utils-common",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Common (Node/Browser) utility functions for Docusaurus packages.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/utils-validation",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Node validation utility functions for Docusaurus packages.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
@ -18,9 +18,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"joi": "^17.9.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"tslib": "^2.6.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/utils",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Node utility functions for Docusaurus packages.",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
|
@ -18,9 +18,9 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@svgr/webpack": "^6.5.1",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@svgr/webpack": "^8.1.0",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
|
@ -42,7 +42,7 @@
|
|||
"node": ">=18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@types/dedent": "^0.7.0",
|
||||
"@types/github-slugger": "^1.3.0",
|
||||
"@types/micromatch": "^4.0.2",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@docusaurus/core",
|
||||
"description": "Easy to Maintain Open Source Documentation Websites",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@ -43,14 +43,12 @@
|
|||
"@babel/runtime": "^7.22.6",
|
||||
"@babel/runtime-corejs3": "^7.22.6",
|
||||
"@babel/traverse": "^7.22.8",
|
||||
"@docusaurus/cssnano-preset": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/mdx-loader": "3.2.1",
|
||||
"@docusaurus/react-loadable": "5.5.2",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/utils-validation": "3.2.1",
|
||||
"@svgr/webpack": "^6.5.1",
|
||||
"@docusaurus/cssnano-preset": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/mdx-loader": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@docusaurus/utils-validation": "3.3.2",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"babel-loader": "^9.1.3",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
|
@ -64,8 +62,8 @@
|
|||
"copy-webpack-plugin": "^11.0.0",
|
||||
"core-js": "^3.31.1",
|
||||
"css-loader": "^6.8.1",
|
||||
"css-minimizer-webpack-plugin": "^4.2.2",
|
||||
"cssnano": "^5.1.15",
|
||||
"css-minimizer-webpack-plugin": "^5.0.1",
|
||||
"cssnano": "^6.1.2",
|
||||
"del": "^6.1.1",
|
||||
"detect-port": "^1.5.1",
|
||||
"escape-html": "^1.0.3",
|
||||
|
@ -85,7 +83,7 @@
|
|||
"prompts": "^2.4.2",
|
||||
"react-dev-utils": "^12.0.1",
|
||||
"react-helmet-async": "^1.3.0",
|
||||
"react-loadable": "npm:@docusaurus/react-loadable@5.5.2",
|
||||
"react-loadable": "npm:@docusaurus/react-loadable@6.0.0",
|
||||
"react-loadable-ssr-addon-v5-slorber": "^1.0.1",
|
||||
"react-router": "^5.3.4",
|
||||
"react-router-config": "^5.1.1",
|
||||
|
@ -105,8 +103,8 @@
|
|||
"webpackbar": "^5.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.2.1",
|
||||
"@docusaurus/types": "3.2.1",
|
||||
"@docusaurus/module-type-aliases": "3.3.2",
|
||||
"@docusaurus/types": "3.3.2",
|
||||
"@total-typescript/shoehorn": "^0.1.2",
|
||||
"@types/detect-port": "^1.3.3",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {startTransition} from 'react';
|
||||
import ReactDOM, {type ErrorInfo} from 'react-dom/client';
|
||||
import {BrowserRouter} from 'react-router-dom';
|
||||
import {HelmetProvider} from 'react-helmet-async';
|
||||
|
@ -46,21 +46,24 @@ if (ExecutionEnvironment.canUseDOM) {
|
|||
};
|
||||
|
||||
const renderApp = () => {
|
||||
if (window.docusaurusRoot) {
|
||||
window.docusaurusRoot.render(app);
|
||||
return;
|
||||
}
|
||||
if (hydrate) {
|
||||
React.startTransition(() => {
|
||||
ReactDOM.hydrateRoot(container, app, {
|
||||
window.docusaurusRoot = ReactDOM.hydrateRoot(container, app, {
|
||||
onRecoverableError,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
const root = ReactDOM.createRoot(container, {onRecoverableError});
|
||||
React.startTransition(() => {
|
||||
root.render(app);
|
||||
});
|
||||
window.docusaurusRoot = root;
|
||||
}
|
||||
};
|
||||
|
||||
preload(window.location.pathname).then(renderApp);
|
||||
preload(window.location.pathname).then(() => {
|
||||
startTransition(renderApp);
|
||||
});
|
||||
|
||||
// Webpack Hot Module Replacement API
|
||||
if (module.hot) {
|
||||
|
|
|
@ -45,8 +45,11 @@ const getChunkNamesToLoad = (path: string): string[] =>
|
|||
)
|
||||
.flatMap(([, routeChunks]) => Object.values(flat(routeChunks)));
|
||||
|
||||
const docusaurus = {
|
||||
prefetch(routePath: string): false | Promise<void[]> {
|
||||
type Docusaurus = Window['docusaurus'];
|
||||
|
||||
const prefetch: Docusaurus['prefetch'] = (
|
||||
routePath: string,
|
||||
): false | Promise<void[]> => {
|
||||
if (!canPrefetch(routePath)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -76,15 +79,21 @@ const docusaurus = {
|
|||
return Promise.resolve();
|
||||
}),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
preload(routePath: string): false | Promise<void[]> {
|
||||
const preload: Docusaurus['preload'] = (
|
||||
routePath: string,
|
||||
): false | Promise<void[]> => {
|
||||
if (!canPreload(routePath)) {
|
||||
return false;
|
||||
}
|
||||
loaded.add(routePath);
|
||||
return preloadHelper(routePath);
|
||||
},
|
||||
};
|
||||
|
||||
const docusaurus: Window['docusaurus'] = {
|
||||
prefetch,
|
||||
preload,
|
||||
};
|
||||
|
||||
// This object is directly mounted onto window, better freeze it
|
||||
|
|
|
@ -12,11 +12,19 @@ import logger from '@docusaurus/logger';
|
|||
import {DEFAULT_BUILD_DIR_NAME} from '@docusaurus/utils';
|
||||
import serveHandler from 'serve-handler';
|
||||
import openBrowser from 'react-dev-utils/openBrowser';
|
||||
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
||||
import {loadSiteConfig} from '../server/config';
|
||||
import {build} from './build';
|
||||
import {getHostPort, type HostPortOptions} from '../server/getHostPort';
|
||||
import type {LoadContextParams} from '../server/site';
|
||||
|
||||
function redirect(res: http.ServerResponse, location: string) {
|
||||
res.writeHead(302, {
|
||||
Location: location,
|
||||
});
|
||||
res.end();
|
||||
}
|
||||
|
||||
export type ServeCLIOptions = HostPortOptions &
|
||||
Pick<LoadContextParams, 'config'> & {
|
||||
dir?: string;
|
||||
|
@ -62,15 +70,24 @@ export async function serve(
|
|||
const server = http.createServer((req, res) => {
|
||||
// Automatically redirect requests to /baseUrl/
|
||||
if (!req.url?.startsWith(baseUrl)) {
|
||||
res.writeHead(302, {
|
||||
Location: baseUrl,
|
||||
});
|
||||
res.end();
|
||||
redirect(res, baseUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
// We do the redirect ourselves for a good reason
|
||||
// server-handler is annoying and won't include /baseUrl/ in redirects
|
||||
const normalizedUrl = applyTrailingSlash(req.url, {trailingSlash, baseUrl});
|
||||
if (req.url !== normalizedUrl) {
|
||||
redirect(res, normalizedUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove baseUrl before calling serveHandler, because /baseUrl/ should
|
||||
// serve /build/index.html, not /build/baseUrl/index.html (does not exist)
|
||||
// Note server-handler is really annoying here:
|
||||
// - no easy way to do rewrites such as "/baseUrl/:path" => "/:path"
|
||||
// - no easy way to "reapply" the baseUrl to the redirect "Location" header
|
||||
// See also https://github.com/facebook/docusaurus/pull/10090
|
||||
req.url = req.url.replace(baseUrl, '/');
|
||||
|
||||
serveHandler(req, res, {
|
||||
|
|
|
@ -17,6 +17,9 @@ exports[`loadSiteConfig website with .cjs siteConfig 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -68,6 +71,9 @@ exports[`loadSiteConfig website with ts + js config 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -119,6 +125,9 @@ exports[`loadSiteConfig website with valid JS CJS config 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -170,6 +179,9 @@ exports[`loadSiteConfig website with valid JS ESM config 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -221,6 +233,9 @@ exports[`loadSiteConfig website with valid TypeScript CJS config 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -272,6 +287,9 @@ exports[`loadSiteConfig website with valid TypeScript ESM config 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -323,6 +341,9 @@ exports[`loadSiteConfig website with valid async config 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -376,6 +397,9 @@ exports[`loadSiteConfig website with valid async config creator function 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -429,6 +453,9 @@ exports[`loadSiteConfig website with valid config creator function 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
@ -485,6 +512,9 @@ exports[`loadSiteConfig website with valid siteConfig 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
|
|
@ -97,6 +97,9 @@ exports[`load loads props for site with custom i18n path 1`] = `
|
|||
"path": "i18n",
|
||||
},
|
||||
"markdown": {
|
||||
"anchors": {
|
||||
"maintainCase": false,
|
||||
},
|
||||
"format": "mdx",
|
||||
"mdx1Compat": {
|
||||
"admonitions": true,
|
||||
|
|
|
@ -69,6 +69,9 @@ describe('normalizeConfig', () => {
|
|||
admonitions: false,
|
||||
headingIds: true,
|
||||
},
|
||||
anchors: {
|
||||
maintainCase: true,
|
||||
},
|
||||
remarkRehypeOptions: {
|
||||
footnoteLabel: 'Pied de page',
|
||||
},
|
||||
|
@ -517,6 +520,9 @@ describe('markdown', () => {
|
|||
admonitions: true,
|
||||
headingIds: false,
|
||||
},
|
||||
anchors: {
|
||||
maintainCase: true,
|
||||
},
|
||||
remarkRehypeOptions: {
|
||||
footnoteLabel: 'Notes de bas de page',
|
||||
// @ts-expect-error: we don't validate it on purpose
|
||||
|
|
|
@ -41,6 +41,9 @@ export const DEFAULT_MARKDOWN_CONFIG: MarkdownConfig = {
|
|||
admonitions: true,
|
||||
headingIds: true,
|
||||
},
|
||||
anchors: {
|
||||
maintainCase: false,
|
||||
},
|
||||
remarkRehypeOptions: undefined,
|
||||
};
|
||||
|
||||
|
@ -320,6 +323,11 @@ export const ConfigSchema = Joi.object<DocusaurusConfig>({
|
|||
// Not sure if it's a good idea, validation is likely to become stale
|
||||
// See https://github.com/remarkjs/remark-rehype#options
|
||||
Joi.object().unknown(),
|
||||
anchors: Joi.object({
|
||||
maintainCase: Joi.boolean().default(
|
||||
DEFAULT_CONFIG.markdown.anchors.maintainCase,
|
||||
),
|
||||
}).default(DEFAULT_CONFIG.markdown.anchors),
|
||||
}).default(DEFAULT_CONFIG.markdown),
|
||||
}).messages({
|
||||
'docusaurus.configValidationWarning':
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/eslint-plugin",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "ESLint plugin to enforce best Docusaurus practices.",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docusaurus/lqip-loader",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Low Quality Image Placeholders (LQIP) loader for webpack.",
|
||||
"main": "lib/index.js",
|
||||
"publishConfig": {
|
||||
|
@ -17,7 +17,7 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"file-loader": "^6.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"sharp": "^0.32.3",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "stylelint-copyright",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"description": "Stylelint plugin to check CSS files for a copyright header.",
|
||||
"main": "lib/index.js",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -68,7 +68,6 @@ datagit
|
|||
Datagit
|
||||
Datagit's
|
||||
dedup
|
||||
Déja
|
||||
devto
|
||||
dingers
|
||||
Dmitry
|
||||
|
@ -317,6 +316,7 @@ sensical
|
|||
setaf
|
||||
setext
|
||||
setlocal
|
||||
SFNT
|
||||
shiki
|
||||
Shiki
|
||||
shortcodes
|
||||
|
|
|
@ -333,6 +333,20 @@ test
|
|||
|
||||
::::
|
||||
|
||||
```mdx-code-block
|
||||
import Admonition from '@theme/Admonition';
|
||||
|
||||
export function AdmonitionWithoutHeading(props) {
|
||||
return (
|
||||
<Admonition {...props} type="info" icon={null} title={null}>
|
||||
Admonition content without heading
|
||||
</Admonition>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
<AdmonitionWithoutHeading />
|
||||
|
||||
## Linking
|
||||
|
||||
This is a test page to see if Docusaurus Markdown features are working properly
|
||||
|
|
BIN
website/blog/releases/3.3/img/social-card.png
Normal file
BIN
website/blog/releases/3.3/img/social-card.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 KiB |
110
website/blog/releases/3.3/index.mdx
Normal file
110
website/blog/releases/3.3/index.mdx
Normal file
|
@ -0,0 +1,110 @@
|
|||
---
|
||||
title: Docusaurus 3.3
|
||||
authors: [slorber]
|
||||
tags: [release]
|
||||
image: ./img/social-card.png
|
||||
date: 2024-05-03
|
||||
---
|
||||
|
||||
We are happy to announce **Docusaurus 3.3**.
|
||||
|
||||
Upgrading should be easy. Our [release process](/community/release-process) respects [Semantic Versioning](https://semver.org/). Minor versions do not include any breaking changes.
|
||||
|
||||

|
||||
|
||||
<!--truncate-->
|
||||
|
||||
import BrowserWindow from '@site/src/components/BrowserWindow';
|
||||
import IframeWindow from '@site/src/components/BrowserWindow/IframeWindow';
|
||||
|
||||
## Highlights
|
||||
|
||||
### Prepare for React 19
|
||||
|
||||
The React core team recently [released the first **React 19 beta**](https://react.dev/blog/2024/04/25/react-19). They also [published an upgrade guide and a ** React v18.3 release**](https://react.dev/blog/2024/04/25/react-19-upgrade-guide) with new warnings to help us identify issues **before upgrading to React 19**.
|
||||
|
||||
Docusaurus v3 depends on React `18.x`. When initializing a new Docusaurus sites, it will use that new React `18.3` release. It's also the case if you decide to upgrade your dependencies, or re-generate your package manager lockfile.
|
||||
|
||||
It turns out in its current state, **Docusaurus had a few of those extra warnings to fix**, notably this one immediately appearing on your dev console on any page load and navigation:
|
||||
|
||||
> Warning: LoadableComponent uses the legacy contextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() with static contextType instead.
|
||||
|
||||
In [#10079](https://github.com/facebook/docusaurus/pull/10079), we got Docusaurus ready for React 19. We fixed all the React 18.3 warnings we encountered. In case we missed any, don't hesitate to [**report new warnings**](https://github.com/facebook/docusaurus/issues/10099) if you see them, to us but also to other Docusaurus third-party plugin authors.
|
||||
|
||||
### `createSitemapItems`
|
||||
|
||||
In [#10083](https://github.com/facebook/docusaurus/pull/10083), we introduced a new flexible `createSitemapItems()` hook to the sitemap plugin. This enables users to create/filter/transform/enhance the sitemap items with their own custom logic.
|
||||
|
||||
```ts
|
||||
export default {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
sitemap: {
|
||||
// highlight-start
|
||||
createSitemapItems: async ({
|
||||
defaultCreateSitemapItems,
|
||||
...params
|
||||
}) => {
|
||||
const items = await defaultCreateSitemapItems(params);
|
||||
return items.filter((item) => !item.url.includes('/tags/'));
|
||||
},
|
||||
// highlight-end
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### Pages plugin improvements
|
||||
|
||||
The Docusaurus [pages plugin](/docs/api/plugins/@docusaurus/plugin-content-pages) has historically been lagging behind the docs and blog plugins in terms of available feature.
|
||||
|
||||
In [#10032](https://github.com/facebook/docusaurus/pull/10032) we normalized the options available on each core content plugins by adding a few the missing page plugins APIs related to the edit url and the last update metadata displayed at the bottom on Markdown pages.
|
||||
|
||||
```js
|
||||
export default {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
pages: {
|
||||
// highlight-start
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/website/src/pages',
|
||||
editLocalizedFiles: true,
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
// highlight-end
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
<IframeWindow url="/examples/markdownPageExample" />
|
||||
|
||||
:::note Only for Markdown pages
|
||||
|
||||
These new plugin options only apply to Markdown pages, and have no effect on React pages for which you have full control over the layout with JSX.
|
||||
|
||||
:::
|
||||
|
||||
## Other changes
|
||||
|
||||
Other notable changes include:
|
||||
|
||||
- [#10064](https://github.com/facebook/docusaurus/pull/10064): new site config option `siteConfig.markdown.anchors.maintainCase`
|
||||
- [#9767](https://github.com/facebook/docusaurus/pull/9767): new `docusaurus deploy --target-dir` option
|
||||
- [#10042](https://github.com/facebook/docusaurus/pull/10042): new (experimental) plugin API: `route.props`
|
||||
- [#10060](https://github.com/facebook/docusaurus/pull/10060): optimizes the App entrypoint, avoid useless re-renders on navigations
|
||||
- [#10080](https://github.com/facebook/docusaurus/pull/10080): `<Admonition>` component can render properly without heading/icon
|
||||
- [#10091](https://github.com/facebook/docusaurus/pull/10091): `<Tabs>` props can now override defaults
|
||||
- [#10090](https://github.com/facebook/docusaurus/pull/10090): `docusaurus serve` works better with a `/baseUrl/` pathname prefix
|
||||
- [#10070](https://github.com/facebook/docusaurus/pull/10070): add missing theme translations for `pt-BR`
|
||||
- [#10025](https://github.com/facebook/docusaurus/pull/10025): doc sidebar item label now impacts the doc pagination label
|
||||
|
||||
Check the **[3.3.0 changelog entry](/changelog/3.3.0)** for an exhaustive list of changes.
|
|
@ -18,6 +18,12 @@ Refer to the Getting Started [**Configuration**](../configuration.mdx) for examp
|
|||
|
||||
`docusaurus.config.js` contains configurations for your site and is placed in the root directory of your site.
|
||||
|
||||
:::note
|
||||
|
||||
With a [TypeScript](../typescript-support.mdx) Docusaurus codebase your config file may be called `docusaurus.config.ts`. The syntax is broadly identical to the `js` config file with the addition of types. You can see an example on the [Docusaurus Website](https://github.com/facebook/docusaurus/blob/main/website/docusaurus.config.ts) itself.
|
||||
|
||||
:::
|
||||
|
||||
This file is run in Node.js and should export a site configuration object, or a function that creates it.
|
||||
|
||||
The `docusaurus.config.js` file supports:
|
||||
|
@ -438,6 +444,10 @@ export type ParseFrontMatter = (params: {
|
|||
content: string;
|
||||
}>;
|
||||
|
||||
type MarkdownAnchorsConfig = {
|
||||
maintainCase: boolean;
|
||||
};
|
||||
|
||||
type MarkdownConfig = {
|
||||
format: 'mdx' | 'md' | 'detect';
|
||||
mermaid: boolean;
|
||||
|
@ -445,6 +455,7 @@ type MarkdownConfig = {
|
|||
parseFrontMatter?: ParseFrontMatter;
|
||||
mdx1Compat: MDX1CompatOptions;
|
||||
remarkRehypeOptions: object; // see https://github.com/remarkjs/remark-rehype#options
|
||||
anchors: MarkdownAnchorsConfig;
|
||||
};
|
||||
```
|
||||
|
||||
|
@ -469,6 +480,9 @@ export default {
|
|||
admonitions: true,
|
||||
headingIds: true,
|
||||
},
|
||||
anchors: {
|
||||
maintainCase: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
@ -484,6 +498,7 @@ export default {
|
|||
| `preprocessor` | `MarkdownPreprocessor` | `undefined` | Gives you the ability to alter the Markdown content string before parsing. Use it as a last-resort escape hatch or workaround: it is almost always better to implement a Remark/Rehype plugin. |
|
||||
| `parseFrontMatter` | `ParseFrontMatter` | `undefined` | Gives you the ability to provide your own front matter parser, or to enhance the default parser. Read our [front matter guide](../guides/markdown-features/markdown-features-intro.mdx#front-matter) for details. |
|
||||
| `mdx1Compat` | `MDX1CompatOptions` | `{comments: true, admonitions: true, headingIds: true}` | Compatibility options to make it easier to upgrade to Docusaurus v3+. |
|
||||
| `anchors` | `MarkdownAnchorsConfig` | `{maintainCase: false}` | Options to control the behavior of anchors generated from Markdown headings |
|
||||
| `remarkRehypeOptions` | `object` | `undefined` | Makes it possible to pass custom [`remark-rehype` options](https://github.com/remarkjs/remark-rehype#options). |
|
||||
|
||||
```mdx-code-block
|
||||
|
|
|
@ -44,11 +44,24 @@ Accepted fields:
|
|||
| `priority` | `number \| null` | `0.5` | See [sitemap docs](https://www.sitemaps.org/protocol.html#xmlTagDefinitions) |
|
||||
| `ignorePatterns` | `string[]` | `[]` | A list of glob patterns; matching route paths will be filtered from the sitemap. Note that you may need to include the base URL in here. |
|
||||
| `filename` | `string` | `sitemap.xml` | The path to the created sitemap file, relative to the output directory. Useful if you have two plugin instances outputting two files. |
|
||||
| `createSitemapItems` | <code>[CreateSitemapItemsFn](#CreateSitemapItemsFn) \| undefined</code> | `undefined` | An optional function which can be used to transform and / or filter the items in the sitemap. |
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
### Types {#types}
|
||||
|
||||
#### `CreateSitemapItemsFn` {#CreateSitemapItemsFn}
|
||||
|
||||
```ts
|
||||
type CreateSitemapItemsFn = (params: {
|
||||
siteConfig: DocusaurusConfig;
|
||||
routes: RouteConfig[];
|
||||
defaultCreateSitemapItems: CreateSitemapItemsFn;
|
||||
}) => Promise<SitemapItem[]>;
|
||||
```
|
||||
|
||||
:::info
|
||||
|
||||
This plugin also respects some site config:
|
||||
|
@ -86,6 +99,11 @@ const config = {
|
|||
priority: 0.5,
|
||||
ignorePatterns: ['/tags/**'],
|
||||
filename: 'sitemap.xml',
|
||||
createSitemapItems: async (params) => {
|
||||
const {defaultCreateSitemapItems, ...rest} = params;
|
||||
const items = await defaultCreateSitemapItems(rest);
|
||||
return items.filter((item) => !item.url.includes('/page/'));
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ import DocusaurusSvg from './docusaurus.svg';
|
|||
Docusaurus supports themed images: the `ThemedImage` component (included in the themes) allows you to switch the image source based on the current theme.
|
||||
|
||||
```jsx
|
||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||
import ThemedImage from '@theme/ThemedImage';
|
||||
|
||||
<ThemedImage
|
||||
|
|
|
@ -350,7 +350,7 @@ Docusaurus also has an `#algolia` channel on [Discord](https://discordapp.com/in
|
|||
|
||||
Typesense is an [open source](https://github.com/typesense/typesense) instant-search engine that you can either:
|
||||
|
||||
- [Self-Host](https://typesense.org/docs/latest/guide/install-typesense.html#option-2-local-machine-self-hosting) on your own servers or
|
||||
- [Self-Host](https://typesense.org/docs/guide/install-typesense.html#option-2-local-machine-self-hosting) on your own servers or
|
||||
- Use the Managed [Typesense Cloud](https://cloud.typesense.org) service.
|
||||
|
||||
Similar to Algolia DocSearch, there are two components:
|
||||
|
@ -358,7 +358,7 @@ Similar to Algolia DocSearch, there are two components:
|
|||
- [typesense-docsearch-scraper](https://github.com/typesense/typesense-docsearch-scraper) - which scrapes your website and indexes the data in your Typesense cluster.
|
||||
- [docusaurus-theme-search-typesense](https://github.com/typesense/docusaurus-theme-search-typesense) - a search bar UI component to add to your website.
|
||||
|
||||
Read a step-by-step walk-through of how to [run typesense-docsearch-scraper here](https://typesense.org/docs/latest/guide/docsearch.html#step-1-set-up-docsearch-scraper) and how to [install the Search Bar in your Docusaurus Site here](https://typesense.org/docs/latest/guide/docsearch.html#option-a-docusaurus-powered-sites).
|
||||
Read a step-by-step walk-through of how to [run typesense-docsearch-scraper here](https://typesense.org/docs/guide/docsearch.html#step-1-set-up-docsearch-scraper) and how to [install the Search Bar in your Docusaurus Site here](https://typesense.org/docs/guide/docsearch.html#option-a-docusaurus-powered-sites).
|
||||
|
||||
## 👥 Using Local Search {#using-local-search}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ description: Customize your site's appearance through creating your own theme co
|
|||
|
||||
In this section, we will introduce how customization of layout is done in Docusaurus.
|
||||
|
||||
> Déja vu...?
|
||||
> Déjà vu...?
|
||||
|
||||
This section is similar to [Styling and Layout](./styling-layout.mdx), but this time, we will customize React components themselves, rather than what they look like. We will talk about a central concept in Docusaurus: **swizzling**, which allows **deeper site customizations**.
|
||||
|
||||
|
|
|
@ -39,15 +39,37 @@ const ArchivedVersionsDropdownItems = Object.entries(VersionsArchived).splice(
|
|||
|
||||
function isPrerelease(version: string) {
|
||||
return (
|
||||
version.includes('-') ||
|
||||
version.includes('alpha') ||
|
||||
version.includes('beta') ||
|
||||
version.includes('rc')
|
||||
);
|
||||
}
|
||||
|
||||
function getLastVersion() {
|
||||
const firstStableVersion = versions.find((version) => !isPrerelease(version));
|
||||
return firstStableVersion ?? versions[0];
|
||||
function getLastStableVersion() {
|
||||
const lastStableVersion = versions.find((version) => !isPrerelease(version));
|
||||
if (!lastStableVersion) {
|
||||
throw new Error('unexpected, no stable Docusaurus version?');
|
||||
}
|
||||
return lastStableVersion;
|
||||
}
|
||||
const announcedVersion = getAnnouncedVersion();
|
||||
|
||||
function getLastStableVersionTuple(): [string, string, string] {
|
||||
const lastStableVersion = getLastStableVersion();
|
||||
const parts = lastStableVersion.split('.');
|
||||
if (parts.length !== 3) {
|
||||
throw new Error(`Unexpected stable version name: ${lastStableVersion}`);
|
||||
}
|
||||
return [parts[0]!, parts[1]!, parts[2]!];
|
||||
}
|
||||
|
||||
// The version announced on the homepage hero and announcement banner
|
||||
// 3.3.2 => 3.3
|
||||
// 3.0.5 => 3.0
|
||||
function getAnnouncedVersion() {
|
||||
const [major, minor] = getLastStableVersionTuple();
|
||||
return `${major}.${minor}`;
|
||||
}
|
||||
|
||||
// This probably only makes sense for the alpha/beta/rc phase, temporary
|
||||
|
@ -228,6 +250,7 @@ export default async function createConfigAsync() {
|
|||
isDeployPreview,
|
||||
description:
|
||||
'An optimized site generator in React. Docusaurus helps you to move fast and write content. Build documentation websites, blogs, marketing pages, and more.',
|
||||
announcedVersion,
|
||||
},
|
||||
staticDirectories: [
|
||||
'static',
|
||||
|
@ -426,7 +449,7 @@ export default async function createConfigAsync() {
|
|||
isBranchDeploy ||
|
||||
isBuildFast
|
||||
? 'current'
|
||||
: getLastVersion(),
|
||||
: getLastStableVersion(),
|
||||
|
||||
onlyIncludeVersions: (() => {
|
||||
if (isBuildFast) {
|
||||
|
@ -517,9 +540,9 @@ export default async function createConfigAsync() {
|
|||
respectPrefersColorScheme: true,
|
||||
},
|
||||
announcementBar: {
|
||||
id: 'announcementBar-v3.2', // Increment on change
|
||||
id: `announcementBar-v${announcedVersion}`,
|
||||
// content: `⭐️ If you like Docusaurus, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/facebook/docusaurus">GitHub</a> and follow us on <a target="_blank" rel="noopener noreferrer" href="https://twitter.com/docusaurus">Twitter ${TwitterSvg}</a>`,
|
||||
content: `🎉️ <b><a target="_blank" href="https://docusaurus.io/blog/releases/3.2">Docusaurus v3.2</a> is out!</b> 🥳️`,
|
||||
content: `🎉️ <b><a target="_blank" href="https://docusaurus.io/blog/releases/${announcedVersion}">Docusaurus v${announcedVersion}</a> is out!</b> 🥳️`,
|
||||
},
|
||||
prism: {
|
||||
additionalLanguages: [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "website",
|
||||
"version": "3.2.1",
|
||||
"version": "3.3.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
@ -36,19 +36,19 @@
|
|||
"dependencies": {
|
||||
"@crowdin/cli": "^3.13.0",
|
||||
"@crowdin/crowdin-api-client": "^1.29.5",
|
||||
"@docusaurus/core": "3.2.1",
|
||||
"@docusaurus/logger": "3.2.1",
|
||||
"@docusaurus/plugin-client-redirects": "3.2.1",
|
||||
"@docusaurus/plugin-ideal-image": "3.2.1",
|
||||
"@docusaurus/plugin-pwa": "3.2.1",
|
||||
"@docusaurus/preset-classic": "3.2.1",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "3.2.1",
|
||||
"@docusaurus/theme-classic": "3.2.1",
|
||||
"@docusaurus/theme-common": "3.2.1",
|
||||
"@docusaurus/theme-live-codeblock": "3.2.1",
|
||||
"@docusaurus/theme-mermaid": "3.2.1",
|
||||
"@docusaurus/utils": "3.2.1",
|
||||
"@docusaurus/utils-common": "3.2.1",
|
||||
"@docusaurus/core": "3.3.2",
|
||||
"@docusaurus/logger": "3.3.2",
|
||||
"@docusaurus/plugin-client-redirects": "3.3.2",
|
||||
"@docusaurus/plugin-ideal-image": "3.3.2",
|
||||
"@docusaurus/plugin-pwa": "3.3.2",
|
||||
"@docusaurus/preset-classic": "3.3.2",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "3.3.2",
|
||||
"@docusaurus/theme-classic": "3.3.2",
|
||||
"@docusaurus/theme-common": "3.3.2",
|
||||
"@docusaurus/theme-live-codeblock": "3.3.2",
|
||||
"@docusaurus/theme-mermaid": "3.3.2",
|
||||
"@docusaurus/utils": "3.3.2",
|
||||
"@docusaurus/utils-common": "3.3.2",
|
||||
"@swc/core": "1.2.197",
|
||||
"clsx": "^2.0.0",
|
||||
"color": "^4.2.3",
|
||||
|
@ -81,8 +81,8 @@
|
|||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/eslint-plugin": "3.2.1",
|
||||
"@docusaurus/tsconfig": "3.2.1",
|
||||
"@docusaurus/eslint-plugin": "3.3.2",
|
||||
"@docusaurus/tsconfig": "3.3.2",
|
||||
"@types/color": "^3.0.4",
|
||||
"@types/jest": "^29.5.3",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
|
@ -203,29 +203,21 @@ function FeaturesContainer() {
|
|||
}
|
||||
|
||||
function TopBanner() {
|
||||
/* TODO restore Ukraine banner after launch
|
||||
<Translate
|
||||
id="homepage.banner"
|
||||
values={{
|
||||
link: (
|
||||
<Link to="https://opensource.facebook.com/support-ukraine">
|
||||
<Translate id="homepage.banner.link">
|
||||
Help Provide Humanitarian Aid to Ukraine
|
||||
</Translate>
|
||||
</Link>
|
||||
),
|
||||
}}>
|
||||
{'Support Ukraine 🇺🇦 {link}.'}
|
||||
</Translate>
|
||||
*/
|
||||
// TODO We should be able to strongly type customFields
|
||||
// Refactor to use a CustomFields interface + TS declaration merging
|
||||
const announcedVersion = useDocusaurusContext().siteConfig.customFields
|
||||
?.announcedVersion as string;
|
||||
|
||||
return (
|
||||
<div className={styles.topBanner}>
|
||||
<div className={styles.topBannerTitle}>
|
||||
{'🎉\xa0'}
|
||||
<Link to="/blog/releases/3.2" className={styles.topBannerTitleText}>
|
||||
<Link
|
||||
to={`/blog/releases/${announcedVersion}`}
|
||||
className={styles.topBannerTitleText}>
|
||||
<Translate
|
||||
id="homepage.banner.launch.newVersion"
|
||||
values={{newVersion: '3.2'}}>
|
||||
values={{newVersion: announcedVersion}}>
|
||||
{'Docusaurus\xa0{newVersion} is\xa0out!️'}
|
||||
</Translate>
|
||||
</Link>
|
||||
|
|
BIN
website/static/katex/fonts/KaTeX_AMS-Regular.ttf
Normal file
BIN
website/static/katex/fonts/KaTeX_AMS-Regular.ttf
Normal file
Binary file not shown.
BIN
website/static/katex/fonts/KaTeX_AMS-Regular.woff
Normal file
BIN
website/static/katex/fonts/KaTeX_AMS-Regular.woff
Normal file
Binary file not shown.
Binary file not shown.
BIN
website/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf
Normal file
BIN
website/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf
Normal file
Binary file not shown.
BIN
website/static/katex/fonts/KaTeX_Caligraphic-Bold.woff
Normal file
BIN
website/static/katex/fonts/KaTeX_Caligraphic-Bold.woff
Normal file
Binary file not shown.
Binary file not shown.
BIN
website/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf
Normal file
BIN
website/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf
Normal file
Binary file not shown.
BIN
website/static/katex/fonts/KaTeX_Caligraphic-Regular.woff
Normal file
BIN
website/static/katex/fonts/KaTeX_Caligraphic-Regular.woff
Normal file
Binary file not shown.
Binary file not shown.
BIN
website/static/katex/fonts/KaTeX_Fraktur-Bold.ttf
Normal file
BIN
website/static/katex/fonts/KaTeX_Fraktur-Bold.ttf
Normal file
Binary file not shown.
BIN
website/static/katex/fonts/KaTeX_Fraktur-Bold.woff
Normal file
BIN
website/static/katex/fonts/KaTeX_Fraktur-Bold.woff
Normal file
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue