diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f224752ad..50ed28f83b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,69 @@
# Docusaurus 2 Changelog
+## 2.4.0 (2023-03-23)
+
+#### :rocket: New Feature
+
+- `docusaurus-plugin-content-docs`, `docusaurus-theme-classic`
+ - [#8236](https://github.com/facebook/docusaurus/pull/8236) feat(content-docs): add support for sidebar item category/link descriptions in generated index page ([@ZarakiKanzaki](https://github.com/ZarakiKanzaki))
+- `docusaurus-theme-classic`
+ - [#8708](https://github.com/facebook/docusaurus/pull/8708) feat(theme): allow to load a Docusaurus page with theme from query-string: ?docusaurus-theme=dark ([@slorber](https://github.com/slorber))
+ - [#8616](https://github.com/facebook/docusaurus/pull/8616) feat(theme): add ability to translate navbar+footer logo alt text ([@Mysterious-Dev](https://github.com/Mysterious-Dev))
+- `docusaurus-remark-plugin-npm2yarn`
+ - [#8690](https://github.com/facebook/docusaurus/pull/8690) feat(npm-to-yarn): add support for PnPm and custom converters ([@armano2](https://github.com/armano2))
+- `docusaurus`
+ - [#8677](https://github.com/facebook/docusaurus/pull/8677) feat(core): add script env variables: NODE_ENV + BABEL_ENV + DOCUSAURUS_CURRENT_LOCALE (temporary i18n workaround) ([@slorber](https://github.com/slorber))
+- `docusaurus-theme-classic`, `docusaurus-theme-common`
+ - [#8674](https://github.com/facebook/docusaurus/pull/8674) feat(theme-classic): respect `prefers-reduced-motion: reduce` mediaquery, bump Infima to alpha.43 ([@slorber](https://github.com/slorber))
+- `docusaurus-theme-translations`
+ - [#8668](https://github.com/facebook/docusaurus/pull/8668) feat(theme-translations): add Hungarian theme translations ([@trueqap](https://github.com/trueqap))
+ - [#8631](https://github.com/facebook/docusaurus/pull/8631) feat(theme-translations): add Norwegian (Bokmål) theme translation ([@dr0nn1](https://github.com/dr0nn1))
+- `docusaurus-theme-common`
+ - [#8656](https://github.com/facebook/docusaurus/pull/8656) feat(theme-common): allow passing a string for details summary ([@pReya](https://github.com/pReya))
+- `docusaurus-plugin-google-gtag`
+ - [#8620](https://github.com/facebook/docusaurus/pull/8620) feat(gtag-plugin): gtag should support multiple tracking ids, notably for the UA => GA4 transition ([@slorber](https://github.com/slorber))
+
+#### :bug: Bug Fix
+
+- `docusaurus-theme-classic`
+ - [#8803](https://github.com/facebook/docusaurus/pull/8803) fix(theme): codeblock buttons should be kept on the right when using RTL locale ([@Vishruta-Patil](https://github.com/Vishruta-Patil))
+ - [#8615](https://github.com/facebook/docusaurus/pull/8615) fix(theme): improve color toggle when using dark navbar ([@dewanshDT](https://github.com/dewanshDT))
+ - [#8699](https://github.com/facebook/docusaurus/pull/8699) fix(theme-classic): fix tab focus bug in dropdown (#8697) ([@kagankan](https://github.com/kagankan))
+- `docusaurus-theme-classic`, `docusaurus-theme-common`
+ - [#8801](https://github.com/facebook/docusaurus/pull/8801) fix(theme): allow tabs children to be falsy ([@Josh-Cena](https://github.com/Josh-Cena))
+- `docusaurus-theme-common`, `docusaurus-theme-search-algolia`
+ - [#8757](https://github.com/facebook/docusaurus/pull/8757) fix(search): search page should react to querystring changes + cleanup/refactor ([@slorber](https://github.com/slorber))
+- `docusaurus`
+ - [#8746](https://github.com/facebook/docusaurus/pull/8746) fix(core): baseUrl error banner link anchor case ([@slorber](https://github.com/slorber))
+- `docusaurus-theme-translations`
+ - [#8744](https://github.com/facebook/docusaurus/pull/8744) fix(theme-translations): fix wrong arabic words (tip/next) ([@Anasqx](https://github.com/Anasqx))
+
+#### :nail_care: Polish
+
+- `create-docusaurus`
+ - [#8712](https://github.com/facebook/docusaurus/pull/8712) polish(create-docusaurus): the starter template should use a navbar item "docSidebar" instead of "doc" (less fragile on updates) ([@biplavmz](https://github.com/biplavmz))
+- `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus-utils-common`, `docusaurus`
+ - [#8735](https://github.com/facebook/docusaurus/pull/8735) polish(theme): better error messages on navbar item rendering failures + ErrorCauseBoundary API ([@tannerdolby](https://github.com/tannerdolby))
+- `docusaurus-theme-classic`, `docusaurus-theme-common`, `docusaurus`
+ - [#8736](https://github.com/facebook/docusaurus/pull/8736) polish(core): better styling for error screens ([@tannerdolby](https://github.com/tannerdolby))
+
+#### Committers: 14
+
+- Anas ([@Anasqx](https://github.com/Anasqx))
+- Armano ([@armano2](https://github.com/armano2))
+- Davide Donadio ([@ZarakiKanzaki](https://github.com/ZarakiKanzaki))
+- Dewansh Thakur ([@dewanshDT](https://github.com/dewanshDT))
+- Joshua Chen ([@Josh-Cena](https://github.com/Josh-Cena))
+- Kagan ([@kagankan](https://github.com/kagankan))
+- Moritz Stückler ([@pReya](https://github.com/pReya))
+- Mysterious_Dev ([@Mysterious-Dev](https://github.com/Mysterious-Dev))
+- Petter Drønnen ([@dr0nn1](https://github.com/dr0nn1))
+- Sébastien Lorber ([@slorber](https://github.com/slorber))
+- Tanner Dolby ([@tannerdolby](https://github.com/tannerdolby))
+- TrueQAP ([@trueqap](https://github.com/trueqap))
+- Vishruta Patil ([@Vishruta-Patil](https://github.com/Vishruta-Patil))
+- [@biplavmz](https://github.com/biplavmz)
+
## 2.3.1 (2023-02-03)
#### :bug: Bug Fix
diff --git a/project-words.txt b/project-words.txt
index 983d0f16b0..106f7768d0 100644
--- a/project-words.txt
+++ b/project-words.txt
@@ -25,6 +25,7 @@ beforeinstallprompt
bhatt
blocklist
blockquotes
+Bokmål
browserslist
browserstack
buble
diff --git a/website/_dogfooding/_pages tests/embeds.tsx b/website/_dogfooding/_pages tests/embeds.tsx
index 36bc066688..562e9f59dd 100644
--- a/website/_dogfooding/_pages tests/embeds.tsx
+++ b/website/_dogfooding/_pages tests/embeds.tsx
@@ -8,20 +8,7 @@
import React from 'react';
import Layout from '@theme/Layout';
import Heading from '@theme/Heading';
-import BrowserWindow from '@site/src/components/BrowserWindow';
-
-function IframeTest({url}: {url: string}) {
- return (
-
-
-
-
-
- );
-}
+import IframeWindow from '@site/src/components/BrowserWindow/IframeWindow';
// See https://github.com/facebook/docusaurus/issues/8672
export default function Embeds(): JSX.Element {
@@ -30,12 +17,12 @@ export default function Embeds(): JSX.Element {
Test Embeds
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/website/blog/releases/2.4/img/navbar-error.jpg b/website/blog/releases/2.4/img/navbar-error.jpg
new file mode 100644
index 0000000000..4ee8ebf195
Binary files /dev/null and b/website/blog/releases/2.4/img/navbar-error.jpg differ
diff --git a/website/blog/releases/2.4/img/sidebar-item-description.jpg b/website/blog/releases/2.4/img/sidebar-item-description.jpg
new file mode 100644
index 0000000000..444903b728
Binary files /dev/null and b/website/blog/releases/2.4/img/sidebar-item-description.jpg differ
diff --git a/website/blog/releases/2.4/img/social-card.png b/website/blog/releases/2.4/img/social-card.png
new file mode 100644
index 0000000000..1f319accdc
Binary files /dev/null and b/website/blog/releases/2.4/img/social-card.png differ
diff --git a/website/blog/releases/2.4/index.mdx b/website/blog/releases/2.4/index.mdx
new file mode 100644
index 0000000000..d02dfd3544
--- /dev/null
+++ b/website/blog/releases/2.4/index.mdx
@@ -0,0 +1,161 @@
+---
+title: Docusaurus 2.4
+authors: [slorber]
+tags: [release]
+image: ./img/social-card.png
+date: 2023-03-23
+---
+
+We are happy to announce **Docusaurus 2.4**.
+
+The upgrade should be easy: as explained in our [release process documentation](/community/release-process), minor versions respect [Semantic Versioning](https://semver.org/).
+
+
+
+
+
+import BrowserWindow from '@site/src/components/BrowserWindow';
+import IframeWindow from '@site/src/components/BrowserWindow/IframeWindow';
+import ErrorBoundaryTestButton from '@site/src/components/ErrorBoundaryTestButton';
+
+## Highlights
+
+### Sidebar item description
+
+In [#8236](https://github.com/facebook/docusaurus/pull/8236), we made it possible to provide a new `description` attribute for docs sidebar items of type `link` and `category`.
+
+```tsx title="sidebars.js"
+[
+ {
+ type: 'link',
+ label: 'Link with description',
+ href: 'https://docusaurus.io',
+ // highlight-next-line
+ description: 'Some link description',
+ },
+ {
+ type: 'category',
+ label: 'Category with description',
+ // highlight-next-line
+ description: 'Some category description',
+ items: [],
+ },
+];
+```
+
+These descriptions will be used in category generated index pages.
+
+
+
+### Theme Query String
+
+In [#8708](https://github.com/facebook/docusaurus/pull/8708), we added the possibility to force Docusaurus to initialize itself in `light` or `dark` mode through a new `docusaurus-theme` query-string parameter.
+
+This is useful to ensure a consistent theme when embedding an existing Docusaurus page into an iframe or WebView.
+
+
+
+
+### Remark plugin npm2yarn upgrade
+
+In [#8690](https://github.com/facebook/docusaurus/pull/8690), we upgraded our Remark plugin [@docusaurus/remark-plugin-npm2yarn](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-remark-plugin-npm2yarn) with many conversion bug fixes, first-class support for pnpm, and the ability to register custom converters producing new tabs.
+
+````markdown
+Run these commands!
+
+```bash npm2yarn
+npm install
+npm run build
+npm run myCustomScript -- --some-arg
+```
+````
+
+
+
+```bash npm2yarn
+npm install
+npm run build
+npm run myCustomScript -- --some-arg
+```
+
+
+
+### gtag support for multiple tracking IDs
+
+In [#8620](https://github.com/facebook/docusaurus/pull/8620) we added support for the [@docusaurus/plugin-google-gtag](/docs/api/plugins/@docusaurus/plugin-google-gtag) plugin to declare multiple tracking IDs.
+
+```js title="docusaurus.config.js"
+module.exports = {
+ presets: [
+ [
+ '@docusaurus/preset-classic',
+ {
+ gtag: {
+ trackingID: [
+ // highlight-next-line
+ 'G-',
+ // highlight-next-line
+ 'UA-',
+ ],
+ },
+ },
+ ],
+ ],
+};
+```
+
+:::caution Google is sunsetting Universal Analytics
+
+**[Google will sunset its Universal Analytics](https://blog.google/products/marketingplatform/analytics/prepare-for-future-with-google-analytics-4/)** on **July 1, 2023**.
+
+Docusaurus users should migrate to Google Analytics 4. Google **does not permit to migrate your existing Universal Analytics data** to your new Google Analytics 4 property.
+
+To preserve the continuity of your analytics, we temporarily recommend that you report events to 2 tracking IDs at the same time: the old one (`UA-*`) and new one (`G-*`). Refer to the **[dedicated issue](https://github.com/facebook/docusaurus/issues/7221)** for details.
+
+:::
+
+### Developer Experience
+
+In [#8736](https://github.com/facebook/docusaurus/pull/8736), we improved how we render error messages and added initial support to render the full causal chain of an error (see [ES2022 Error Cause](https://h3manth.com/ES2022/#error-cause)).
+
+:::tip
+
+To see it in action, click here:
+
+:::
+
+In [#8735](https://github.com/facebook/docusaurus/pull/8735) we also made navbar-related error messages clearer to help users understand what they did wrong.
+
+
+
+### Translations
+
+We made it possible to translate some new elements:
+
+- [#8677](https://github.com/facebook/docusaurus/pull/8677) introduces a new `process.env.DOCUSAURUS_CURRENT_LOCALE` (experimental) allowing you to localize your config file, including site title, tagline, announcement bar, baseUrl...
+- [#8616](https://github.com/facebook/docusaurus/pull/8616) allows to translate the navbar and footer logo alt text
+
+We added default theme translation support for multiple languages:
+
+- 🇭🇺 [#8668](https://github.com/facebook/docusaurus/pull/8668): Hungarian
+- 🇳🇴 [#8631](https://github.com/facebook/docusaurus/pull/8631): Norwegian (Bokmål)
+
+:::tip
+
+Completing theme translations is an [ongoing effort](https://github.com/facebook/docusaurus/issues/3526) and an easy way to contribute to Docusaurus. We add new theme features regularly, for which we often [need new translations](https://github.com/facebook/docusaurus/issues/3526).
+
+:::
+
+## Other changes
+
+Other notable changes include:
+
+- [#8674](https://github.com/facebook/docusaurus/pull/8674): respect `prefers-reduced-motion: reduce` media query
+- [#8712](https://github.com/facebook/docusaurus/pull/8712): use a navbar item of type `docSidebar` in template
+- [#8801](https://github.com/facebook/docusaurus/pull/8801): allow tabs children to be falsy
+- [#8757](https://github.com/facebook/docusaurus/pull/8757): make search page react to external query-string changes
+- [#8803](https://github.com/facebook/docusaurus/pull/8803): fix code block buttons position in RTL
+- [#8615](https://github.com/facebook/docusaurus/pull/8615): fix color mode toggle when using dark navbar
+- [#8699](https://github.com/facebook/docusaurus/pull/8699): fix navbar dropdown tab focus bug
+
+Check the **[2.4.0 changelog entry](/changelog/2.4.0)** for an exhaustive list of changes.
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index 6f08a78c93..8642c6130c 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -357,6 +357,7 @@ const config = {
}
return `https://github.com/facebook/docusaurus/edit/main/website/${blogDirPath}/${blogPath}`;
},
+ remarkPlugins: [npm2yarn],
postsPerPage: 5,
feedOptions: {
type: 'all',
diff --git a/website/src/components/BrowserWindow/IframeWindow.tsx b/website/src/components/BrowserWindow/IframeWindow.tsx
new file mode 100644
index 0000000000..10512e7764
--- /dev/null
+++ b/website/src/components/BrowserWindow/IframeWindow.tsx
@@ -0,0 +1,33 @@
+/**
+ * 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 React from 'react';
+
+import BrowserWindow from './index';
+
+// Quick and dirty component, to improve later if needed
+export default function IframeWindow({url}: {url: string}): JSX.Element {
+ return (
+
+
+
+
+
+ );
+}
diff --git a/website/src/components/BrowserWindow/index.tsx b/website/src/components/BrowserWindow/index.tsx
index 0d2312ee8e..b060a4b3a7 100644
--- a/website/src/components/BrowserWindow/index.tsx
+++ b/website/src/components/BrowserWindow/index.tsx
@@ -51,3 +51,17 @@ export default function BrowserWindow({
);
}
+
+// Quick and dirty component, to improve later if needed
+export function IframeWindow({url}: {url: string}): JSX.Element {
+ return (
+
+
+
+
+
+ );
+}
diff --git a/website/src/components/ErrorBoundaryTestButton/index.tsx b/website/src/components/ErrorBoundaryTestButton/index.tsx
index e099829177..f5c1113da0 100644
--- a/website/src/components/ErrorBoundaryTestButton/index.tsx
+++ b/website/src/components/ErrorBoundaryTestButton/index.tsx
@@ -9,15 +9,24 @@ import React, {type ReactNode, useState} from 'react';
export default function ErrorBoundaryTestButton({
children = 'Boom!',
+ message = 'Boom!\nSomething bad happened, but you can try again!',
+ cause,
}: {
children?: ReactNode;
+ message?: string;
+ cause?: string;
}): JSX.Element {
const [state, setState] = useState(false);
if (state) {
- throw new Error('Boom!\nSomething bad happened, but you can try again!');
+ throw new Error(message, {
+ cause: cause ? new Error(cause) : undefined,
+ });
}
return (
-