Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Dependency Review
uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # 4.9.0
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # 5.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,30 @@ describe('collectRedirects', () => {
]);
});

it('preserves external redirect targets with trailingSlash=true', () => {
expect(
collectRedirects(
createTestPluginContext(
{
redirects: [
{
from: '/someLegacyPath',
to: 'https://example.com/somePath?a=1#x',
},
],
},
['/'],
),
true,
),
).toEqual([
{
from: '/someLegacyPath',
to: 'https://example.com/somePath?a=1#x',
},
]);
});

it('collects redirects from plugin option redirects with trailingSlash=false', () => {
expect(
collectRedirects(
Expand Down Expand Up @@ -268,6 +292,30 @@ describe('collectRedirects', () => {
]);
});

it('preserves external redirect targets with trailingSlash=false', () => {
expect(
collectRedirects(
createTestPluginContext(
{
redirects: [
{
from: '/someLegacyPath',
to: 'https://example.com/somePath/?a=1#x',
},
],
},
['/'],
),
false,
),
).toEqual([
{
from: '/someLegacyPath',
to: 'https://example.com/somePath/?a=1#x',
},
]);
});

it('throw if plugin option redirects contain invalid to paths', () => {
expect(() =>
collectRedirects(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export default function collectRedirects(
pluginContext: PluginContext,
trailingSlash: boolean | undefined,
): RedirectItem[] {
function normalizeRedirectTo(to: string) {
return to.startsWith('/')
? applyTrailingSlash(to, {
trailingSlash,
baseUrl: pluginContext.baseUrl,
})
: to;
}

// For each plugin config option, create the appropriate redirects
const redirects = [
...createFromExtensionsRedirects(
Expand All @@ -50,10 +59,7 @@ export default function collectRedirects(
//
// It should be easy to toggle `trailingSlash` option without having to
// change other configs
to: applyTrailingSlash(redirect.to, {
trailingSlash,
baseUrl: pluginContext.baseUrl,
}),
to: normalizeRedirectTo(redirect.to),
}));

validateCollectedRedirects(redirects, pluginContext);
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@types/mdast": "^4.0.2",
"@types/react": "19.2.14",
"commander": "^5.1.0",
"joi": "^17.9.2",
"joi": "^18.1.2",
"react-helmet-async": "npm:@slorber/react-helmet-async@1.3.0",
"utility-types": "^3.10.0",
"webpack": "^5.106.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-utils-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@docusaurus/utils": "3.10.1",
"@docusaurus/utils-common": "3.10.1",
"fs-extra": "^11.2.0",
"joi": "^17.9.2",
"joi": "^18.1.2",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"tslib": "^2.6.0"
Expand Down
1 change: 1 addition & 0 deletions website/community/2-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ See the <a href={require('@docusaurus/useBaseUrl').default('showcase')}>showcase
- [docusaurus-plugin-glossary](https://github.com/mcclowes/docusaurus-plugin-glossary) - A docusaurus plugin for helping users understand key terms.
- [docusaurus-plugin-cookie-consent](https://github.com/mcclowes/docusaurus-plugin-cookie-consent) - A Docusaurus plugin for allowing users to opt in/out of cookies, and accessing those settings in code.
- [expose-markdown-docusaurus-plugin](https://github.com/FlyNumber/markdown_docusaurus_plugin) - A Docusaurus plugin that exposes your /docs Markdown files as raw .md URLs. (For LLM's and such).
- [docusaurus-plugin-copy-page-button](https://github.com/portdeveloper/docusaurus-plugin-copy-page-button) - Adds a "Copy page" button that exports doc pages as clean markdown for use with ChatGPT, Claude, and Gemini. Used by Ethereum, Sui, Monad, and Flare docs.

## Enterprise usage {/* #enterprise-usage */}

Expand Down
22 changes: 22 additions & 0 deletions website/docs/guides/markdown-features/markdown-features-intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,25 @@ Markdown can embed HTML elements, and [`details`](https://developer.mozilla.org/
You may want to keep your `<summary>` on a single line. Keep in mind that [MDX creates extra HTML `<p>` paragraphs for line breaks.](https://mdxjs.com/migrating/v2/#jsx). When in doubt, use the [MDX playground](https://mdxjs.com/playground/) to troubleshoot `<details>` rendering problems.

:::

## Tables {/* #tables */}

Markdown tables are supported via **[GitHub Flavored Markdown (GFM)](https://github.github.com/gfm/#tables-extension-)**. They are an excellent way to display structured data in your documentation.

```md
| Feature | Support | Description |
| :--------- | :------ | :-------------------------------- |
| GFM Tables | ✅ Yes | Standard Markdown table syntax |
| Alignment | ✅ Yes | Left, center, and right alignment |
```

```mdx-code-block
<BrowserWindow>

| Feature | Support | Description |
| :--------- | :------ | :-------------------------------- |
| GFM Tables | ✅ Yes | Standard Markdown table syntax |
| Alignment | ✅ Yes | Left, center, and right alignment |

</BrowserWindow>
```
2 changes: 1 addition & 1 deletion website/docs/i18n/i18n-tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ This helps [search engines like Google know about localized versions of your pag

This also permits Docusaurus themes to redirect users to the appropriate URL when they switch locale, usually through the [Navbar locale dropdown](../api/themes/theme-configuration.mdx#navbar-locale-dropdown).

Read more on the [`siteConfig.url`](../api/docusaurus.config.js.mdx#baseUrl) and [`siteConfig.baseUrl`](../api/docusaurus.config.js.mdx#baseUrl) docs.
Read more on the [`siteConfig.url`](../api/docusaurus.config.js.mdx#url) and [`siteConfig.baseUrl`](../api/docusaurus.config.js.mdx#baseUrl) docs.

:::

Expand Down
16 changes: 8 additions & 8 deletions website/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ Assuming you chose the classic template and named your site `my-website`, you wi
```bash
my-website
├── blog
│ ├── 2019-05-28-hola.md
│ ├── 2019-05-29-hello-world.md
│ └── 2020-05-30-welcome.md
│ ├── 2019-05-28-hola.mdx
│ ├── 2019-05-29-hello-world.mdx
│ └── 2020-05-30-welcome.mdx
├── docs
│ ├── doc1.md
│ ├── doc2.md
│ ├── doc3.md
│ └── mdx.md
│ ├── doc1.mdx
│ ├── doc2.mdx
│ ├── doc3.mdx
│ └── mdx.mdx
├── src
│ ├── css
│ │ └── custom.css
Expand All @@ -101,7 +101,7 @@ my-website
- `/src/pages` - Any JSX/TSX/MDX file within this directory will be converted into a website page. More details can be found in the [pages guide](guides/creating-pages.mdx)
- `/static/` - Static directory. Any contents inside here will be copied into the root of the final `build` directory
- `/docusaurus.config.js` - A config file containing the site configuration. This is the equivalent of `siteConfig.js` in Docusaurus v1
- `/package.json` - A Docusaurus website is a React app. You can install and use any npm packages you like in it.
- `/package.json` - A Docusaurus website is a React app. You can install and use any npm packages you like in it
- `/sidebars.js` - Used by the documentation to specify the order of documents in the sidebar

### Monorepos {/* #monorepos */}
Expand Down
27 changes: 27 additions & 0 deletions website/docs/typescript-support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,33 @@ Docusaurus doesn't use this `tsconfig.json` to compile your project. It is added

Now you can start writing TypeScript theme components.

## Ambient types for optional plugins {/* #ambient-types-for-optional-plugins */}

Some plugins and themes ship their own ambient `.d.ts` files that TypeScript does not load automatically.

For example, importing from `@theme/Playground` (provided by `@docusaurus/theme-live-codeblock`) fails with `TS2307: Cannot find module '@theme/Playground'` until you opt the plugin's types in.

Add a triple-slash reference in a project `.d.ts` file (recommended):

```ts title="src/types.d.ts"
/// <reference types="@docusaurus/theme-live-codeblock" />
```

Alternatively, add the package to the `types` compiler option of your `tsconfig.json`. This disables TypeScript's default loading of `@types/*` packages, so include any other type packages you rely on explicitly:

```json title="tsconfig.json"
{
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"baseUrl": ".",
// highlight-next-line
"types": ["@docusaurus/theme-live-codeblock"]
}
}
```

The same applies to any other optional plugin or theme that ships ambient types.

## Typing the config file {/* #typing-config */}

It is possible to use a TypeScript config file in Docusaurus.
Expand Down
93 changes: 50 additions & 43 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,9 @@
"@babel/helper-plugin-utils" "^7.28.6"

"@babel/plugin-transform-modules-systemjs@^7.29.0":
version "7.29.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.29.0.tgz#e458a95a17807c415924106a3ff188a3b8dee964"
integrity sha512-PrujnVFbOdUpw4UHiVwKvKRLMMic8+eC0CuNlxjsyZUiBjhFdPsewdXCkveh2KqBA9/waD0W1b4hXSOBQJezpQ==
version "7.29.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.29.4.tgz#f621105da99919c15cf4bde6fcc7346ef95e7b20"
integrity sha512-N7QmZ0xRZfjHOfZeQLJjwgX2zS9pdGHSVl/cjSGlo4dXMqvurfxXDMKY4RqEKzPozV78VMcd0lxyG13mlbKc4w==
dependencies:
"@babel/helper-module-transforms" "^7.28.6"
"@babel/helper-plugin-utils" "^7.28.6"
Expand Down Expand Up @@ -2341,17 +2341,39 @@
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==

"@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0":
version "9.3.0"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==
"@hapi/address@^5.1.1":
version "5.1.1"
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-5.1.1.tgz#e9925fc1b65f5cc3fbea821f2b980e4652e84cb6"
integrity sha512-A+po2d/dVoY7cYajycYI43ZbYMXukuopIsqCjh5QzsBCipDtdofHntljDlpccMjIfTy6UOkg+5KPriwYch2bXA==
dependencies:
"@hapi/hoek" "^11.0.2"

"@hapi/formula@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@hapi/formula/-/formula-3.0.2.tgz#81b538060ee079481c906f599906d163c4badeaf"
integrity sha512-hY5YPNXzw1He7s0iqkRQi+uMGh383CGdyyIGYtB+W5N3KHPXoqychklvHhKCC9M3Xtv0OCs/IHw+r4dcHtBYWw==

"@hapi/topo@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012"
integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==
"@hapi/hoek@^11.0.2", "@hapi/hoek@^11.0.7":
version "11.0.7"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-11.0.7.tgz#56a920793e0a42d10e530da9a64cc0d3919c4002"
integrity sha512-HV5undWkKzcB4RZUusqOpcgxOaq6VOAH7zhhIr2g3G8NF/MlFO75SjOr2NfuSx0Mh40+1FqCkagKLJRykUWoFQ==

"@hapi/pinpoint@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@hapi/pinpoint/-/pinpoint-2.0.1.tgz#32077e715655fc00ab8df74b6b416114287d6513"
integrity sha512-EKQmr16tM8s16vTT3cA5L0kZZcTMU5DUOZTuvpnY738m+jyP3JIUj+Mm1xc1rsLkGBQ/gVnfKYPwOmPg1tUR4Q==

"@hapi/tlds@^1.1.1":
version "1.1.6"
resolved "https://registry.yarnpkg.com/@hapi/tlds/-/tlds-1.1.6.tgz#c98ed89ca76aa030352d6d7102d0f250aed89cfb"
integrity sha512-xdi7A/4NZokvV0ewovme3aUO5kQhW9pQ2YD1hRqZGhhSi5rBv4usHYidVocXSi9eihYsznZxLtAiEYYUL6VBGw==

"@hapi/topo@^6.0.2":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-6.0.2.tgz#f219c1c60da8430228af4c1f2e40c32a0d84bbb4"
integrity sha512-KR3rD5inZbGMrHmgPxsJ9dbi6zEK+C3ZwUwTa+eMwWLz7oijWUTWD2pMSNNYJAU6Qq+65NkxXjqHr/7LM2Xkqg==
dependencies:
"@hapi/hoek" "^9.0.0"
"@hapi/hoek" "^11.0.2"

"@humanwhocodes/config-array@^0.13.0":
version "0.13.0"
Expand Down Expand Up @@ -4228,23 +4250,6 @@
resolved "https://registry.yarnpkg.com/@rtsao/scc/-/scc-1.1.0.tgz#927dd2fae9bc3361403ac2c7a00c32ddce9ad7e8"
integrity sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==

"@sideway/address@^4.1.5":
version "4.1.5"
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5"
integrity sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==
dependencies:
"@hapi/hoek" "^9.0.0"

"@sideway/formula@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f"
integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==

"@sideway/pinpoint@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==

"@sigstore/bundle@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@sigstore/bundle/-/bundle-1.1.0.tgz#17f8d813b09348b16eeed66a8cf1c3d6bd3d04f1"
Expand Down Expand Up @@ -4322,7 +4327,7 @@
resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz#821f8442f4175d8f0467b9daf26e3a18e2d02af2"
integrity sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==

"@standard-schema/spec@^1.0.0":
"@standard-schema/spec@^1.0.0", "@standard-schema/spec@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@standard-schema/spec/-/spec-1.1.0.tgz#a79b55dbaf8604812f52d140b2c9ab41bc150bb8"
integrity sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==
Expand Down Expand Up @@ -9826,9 +9831,9 @@ fast-levenshtein@^2.0.6:
integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==

fast-uri@^3.0.1:
version "3.0.3"
resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.3.tgz#892a1c91802d5d7860de728f18608a0573142241"
integrity sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw==
version "3.1.2"
resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.2.tgz#8af3d4fc9d3e71b11572cc2673b514a7d1a8c8ec"
integrity sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==

fastest-levenshtein@^1.0.16:
version "1.0.16"
Expand Down Expand Up @@ -12268,16 +12273,18 @@ jiti@^2.5.1:
resolved "https://registry.yarnpkg.com/jiti/-/jiti-2.6.1.tgz#178ef2fc9a1a594248c20627cd820187a4d78d92"
integrity sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==

joi@^17.9.2:
version "17.13.3"
resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec"
integrity sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==
dependencies:
"@hapi/hoek" "^9.3.0"
"@hapi/topo" "^5.1.0"
"@sideway/address" "^4.1.5"
"@sideway/formula" "^3.0.1"
"@sideway/pinpoint" "^2.0.0"
joi@^18.1.2:
version "18.1.2"
resolved "https://registry.yarnpkg.com/joi/-/joi-18.1.2.tgz#4735a384d7721fcda7a551d128862cf816541924"
integrity sha512-rF5MAmps5esSlhCA+N1b6IYHDw9j/btzGaqfgie522jS02Ju/HXBxamlXVlKEHAxoMKQL77HWI8jlqWsFuekZA==
dependencies:
"@hapi/address" "^5.1.1"
"@hapi/formula" "^3.0.2"
"@hapi/hoek" "^11.0.7"
"@hapi/pinpoint" "^2.0.1"
"@hapi/tlds" "^1.1.1"
"@hapi/topo" "^6.0.2"
"@standard-schema/spec" "^1.1.0"

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
Expand Down
Loading