diff --git a/.changeset/silent-phones-own.md b/.changeset/silent-phones-own.md
new file mode 100644
index 0000000000..da51cf5b64
--- /dev/null
+++ b/.changeset/silent-phones-own.md
@@ -0,0 +1,7 @@
+---
+'nextra': patch
+'nextra-theme-blog': patch
+'nextra-theme-docs': patch
+---
+
+feat: New layout implementation
diff --git a/examples/blog/next.config.mjs b/examples/blog/next.config.mjs
index 6c1f3b59a9..fcbcfbfbf6 100644
--- a/examples/blog/next.config.mjs
+++ b/examples/blog/next.config.mjs
@@ -7,5 +7,21 @@ const withNextra = nextra({
})
export default withNextra({
- reactStrictMode: true
+ reactStrictMode: true,
+ webpack(config) {
+ // To make pnpm workspace and themes work in this monorepo, we need to
+ // disable webpack's symlinks feature here. Otherwise the symlink
+ // `./node_modules/nextra-theme-docs/style.css` will be resolved as
+ // `../../packages/nextra-theme-docs/style.css`, which doesn't contain
+ // `node_modules` in its full path and webpack can't pick the correct loader
+ // for it due to:
+ // https://github.com/vercel/next.js/blob/213c42f446874d29d07fa2cca6e6b11fc9c3b711/packages/next/build/webpack/config/blocks/css/index.ts#L305
+ // This is not needed for normal usage, only a workaround for this
+ // development repository.
+ config.resolve = {
+ ...config.resolve,
+ symlinks: false
+ }
+ return config
+ }
})
diff --git a/examples/blog/pages/_app.js b/examples/blog/pages/_app.js
deleted file mode 100644
index 7f0719e1ff..0000000000
--- a/examples/blog/pages/_app.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import 'nextra-theme-blog/style.css'
-
-export default function MyApp({ Component, pageProps }) {
- // Use the layout defined at the page level, if available
- const getLayout = Component.getLayout || (page => page)
-
- return getLayout()
-}
diff --git a/examples/docs/next.config.js b/examples/docs/next.config.js
index 635ef549ec..97c69e8276 100644
--- a/examples/docs/next.config.js
+++ b/examples/docs/next.config.js
@@ -8,5 +8,21 @@ const withNextra = require('nextra')({
})
module.exports = withNextra({
- reactStrictMode: true
+ reactStrictMode: true,
+ webpack(config) {
+ // To make pnpm workspace and themes work in this monorepo, we need to
+ // disable webpack's symlinks feature here. Otherwise the symlink
+ // `./node_modules/nextra-theme-docs/style.css` will be resolved as
+ // `../../packages/nextra-theme-docs/style.css`, which doesn't contain
+ // `node_modules` in its full path and webpack can't pick the correct loader
+ // for it due to:
+ // https://github.com/vercel/next.js/blob/213c42f446874d29d07fa2cca6e6b11fc9c3b711/packages/next/build/webpack/config/blocks/css/index.ts#L305
+ // This is not needed for normal usage, only a workaround for this
+ // development repository.
+ config.resolve = {
+ ...config.resolve,
+ symlinks: false
+ }
+ return config
+ }
})
diff --git a/examples/docs/src/pages/get-started.mdx b/examples/docs/src/pages/get-started.mdx
index c791c9c30b..819b88aba3 100644
--- a/examples/docs/src/pages/get-started.mdx
+++ b/examples/docs/src/pages/get-started.mdx
@@ -15,43 +15,45 @@ Nextra works like a Next.js plugin, and it accepts a theme config (layout) to re
1. Install Next.js, Nextra and React
-
-
+import { Tabs, Tab } from 'nextra-theme-docs/tabs'
+
+
+
```bash
npm i react react-dom next nextra
```
-
-
+
+
```bash
yarn add react react-dom next nextra
```
-
-
+
+
```bash
pnpm i react react-dom next nextra
```
-
-
+
+
2. Install the docs theme
-
-
+
+
```bash
npm i nextra-theme-docs
```
-
-
+
+
```bash
yarn add nextra-theme-docs
```
-
-
+
+
```bash
pnpm i nextra-theme-docs
```
-
-
+
+
3. Create the following Next.js config and theme config under the root directory:
diff --git a/examples/docs/src/pages/themes/docs/bleed.mdx b/examples/docs/src/pages/themes/docs/bleed.mdx
index 57d80d5d50..e9c3967906 100644
--- a/examples/docs/src/pages/themes/docs/bleed.mdx
+++ b/examples/docs/src/pages/themes/docs/bleed.mdx
@@ -7,21 +7,23 @@ A built-in component provided by `nextra-theme-docs`.
When wrapping your content with ``, it will be slightly wider than the container
and will overflow on both sides.
-
+import Bleed from 'nextra-theme-docs/bleed'
+
+
_There is nothing to writing. All you do is sit down at a typewriter and **bleed**._
— Ernest Hemingway
-
+
It provides a better reading experience when you want to present some graphical information, which normally
looks nicer in a larger size.
For example you can put text, image, video or any component inside:
-
+
-
+
You can even make it full-bleed using ``:
-
+
![Landscape](https://source.unsplash.com/eaxwP9J_V6s/1600x398)
-
+
## Usage
### MDX component
```mdx filename="bleed.mdx"
-Hey, I can use **Markdown** syntax here.
+Hey, I can use **Markdown** syntax here.
-
+
![Landscape](https://source.unsplash.com/eaxwP9J_V6s/1600x398)
-
+
-
+
-
+
```
### React Component
diff --git a/examples/docs/src/pages/themes/docs/callout.mdx b/examples/docs/src/pages/themes/docs/callout.mdx
index e5b5a320ba..3285b72f07 100644
--- a/examples/docs/src/pages/themes/docs/callout.mdx
+++ b/examples/docs/src/pages/themes/docs/callout.mdx
@@ -4,48 +4,50 @@ A built-in component provided by `nextra-theme-docs`.
## Example
-
+import Callout from 'nextra-theme-docs/callout'
+
+
A **callout** is a short piece of text intended to attract attention.
-
+
## Usage
### Default
-
+
**Space Invaders** is a 1978 shoot 'em up arcade game developed by Tomohiro
Nishikado.
-
+
```mdx
-
+
**Space Invaders** is a 1978 shoot 'em up arcade game developed by Tomohiro
Nishikado.
-
+
```
### Warning
-
+
This API will be deprecated soon.
-
+
```mdx
-
+
This API will be deprecated soon.
-
+
```
### Error
-
+
This is a dangerous feature that can cause everything to explode.
-
+
```mdx
-
+
This is a dangerous feature that can cause everything to explode.
-
+
```
### React Component
diff --git a/examples/docs/src/pages/themes/docs/index.mdx b/examples/docs/src/pages/themes/docs/index.mdx
index a2457e2718..0512dfb8de 100644
--- a/examples/docs/src/pages/themes/docs/index.mdx
+++ b/examples/docs/src/pages/themes/docs/index.mdx
@@ -1,6 +1,9 @@
# Docs Theme
-This website is built with the docs theme.
+import Callout from 'nextra-theme-docs/callout'
+import { Tabs, Tab } from 'nextra-theme-docs/tabs'
+
+This website is built with the docs theme.
you can install the blog theme with the following commands:
@@ -8,43 +11,43 @@ you can install the blog theme with the following commands:
1. Install Next.js, Nextra and React
-
-
+
+
```bash
npm i react react-dom next nextra
```
-
-
+
+
```bash
yarn add react react-dom next nextra
```
-
-
+
+
```bash
pnpm i react react-dom next nextra
```
-
-
+
+
2. Install the docs theme
-
-
+
+
```bash
npm i nextra-theme-docs
```
-
-
+
+
```bash
yarn add nextra-theme-docs
```
-
-
+
+
```bash
pnpm i nextra-theme-docs
```
-
-
+
+
3. Create the following Next.js config and theme config under the root directory:
@@ -104,6 +107,6 @@ export default function Nextra({ Component, pageProps }) {
---
-
+
You can also use [`