-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update configuration part (#524)
* docs: update configuration part * fix: pass unstable_flexsearch * chore: apply cr
- Loading branch information
Showing
155 changed files
with
2,388 additions
and
961 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"nextra": patch | ||
"nextra-theme-blog": patch | ||
"nextra-theme-docs": patch | ||
--- | ||
|
||
pass unstable_flexsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
'nextra-theme-docs': patch | ||
"nextra-theme-docs": patch | ||
--- | ||
|
||
chore(nextra-theme-docs): refactor `theme-context.ts` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
'nextra': patch | ||
'nextra-theme-blog': patch | ||
'nextra-theme-docs': patch | ||
"nextra": patch | ||
"nextra-theme-blog": patch | ||
"nextra-theme-docs": patch | ||
--- | ||
|
||
Fix release workflow. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
'nextra': patch | ||
"nextra": patch | ||
--- | ||
|
||
feat(nextra): allow define custom languages for shiki with `mdxOptions.rehypePrettyCodeOptions` option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
'nextra-theme-blog': patch | ||
"nextra-theme-blog": patch | ||
--- | ||
|
||
fix(nextra-theme-blog): make nav items center aligned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
'nextra-theme-docs': patch | ||
"nextra-theme-docs": patch | ||
--- | ||
|
||
feat(nextra-theme-docs): update discord logo to the new one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
'nextra': patch | ||
"nextra": patch | ||
--- | ||
|
||
fix(nextra): allow to contain dots in page filenames |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist | ||
.next | ||
pnpm-lock.yaml | ||
pnpm-workspace.yaml | ||
.changeset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
import 'nextra-theme-docs/style.css' | ||
|
||
export default function MyApp({ Component, pageProps }) { | ||
// Use the layout defined at the page level, if available | ||
export default function Nextra({ Component, pageProps }) { | ||
const getLayout = Component.getLayout || (page => page) | ||
|
||
return getLayout(<Component {...pageProps} />) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Code Highlighting | ||
|
||
`Nextra` uses [Shiki](https://shiki.matsu.io) and [Rehype Pretty Code](https://github.com/FormidableLabs/prism-react-renderer) | ||
to highlight the code blocks. This section covers how you can customze it. | ||
|
||
## Meta strings | ||
|
||
### Highlight lines | ||
|
||
````mdx | ||
```jsx {1,3-5} | ||
import 'nextra-theme-docs/style.css' | ||
|
||
export default function Nextra({ Component, pageProps }) { | ||
const getLayout = Component.getLayout || (page => page) | ||
return getLayout(<Component {...pageProps} />) | ||
} | ||
``` | ||
```` | ||
|
||
```jsx {1,4-5} | ||
import 'nextra-theme-docs/style.css' | ||
|
||
export default function Nextra({ Component, pageProps }) { | ||
const getLayout = Component.getLayout || (page => page) | ||
return getLayout(<Component {...pageProps} />) | ||
} | ||
``` | ||
|
||
### Title | ||
|
||
````mdx | ||
```jsx filename="_app.js" | ||
import 'nextra-theme-docs/style.css' | ||
|
||
export default function Nextra({ Component, pageProps }) { | ||
const getLayout = Component.getLayout || (page => page) | ||
return getLayout(<Component {...pageProps} />) | ||
} | ||
``` | ||
```` | ||
|
||
```jsx filename="_app.js" | ||
import 'nextra-theme-docs/style.css' | ||
|
||
export default function Nextra({ Component, pageProps }) { | ||
const getLayout = Component.getLayout || (page => page) | ||
return getLayout(<Component {...pageProps} />) | ||
} | ||
``` | ||
|
||
## Supported Languages | ||
|
||
You can find a list of supported languages [here](https://github.com/shikijs/shiki/blob/main/docs/languages.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"code-highlighting": "Code Highlighting" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Callout from 'nextra-theme-docs/callout' | ||
|
||
# Next.js I18n | ||
|
||
<Callout emoji="⚠️">This feature is only available in the docs theme.</Callout> | ||
|
||
Nextra supports [Next.js Internationalized Routing](https://nextjs.org/docs/advanced-features/i18n-routing) out of the box. | ||
|
||
To add multi-language pages to your Nextra application, just need to config `i18n` in `next.config.js`: | ||
|
||
```js filename="next.config.js" | ||
const withNextra = require('nextra')('nextra-theme-docs', './theme.config.js') | ||
module.exports = withNextra({ | ||
i18n: { | ||
locales: ['en', 'zh', 'de'], | ||
defaultLocale: 'en' | ||
} | ||
}) | ||
``` | ||
|
||
Then, add the locale codes to your file extensions (required for the default locale too): | ||
|
||
```plaintext | ||
/pages | ||
index.en.md | ||
index.zh.md | ||
index.de.md | ||
meta.en.json | ||
meta.zh.json | ||
meta.de.json | ||
... | ||
``` | ||
|
||
Finally, add the `i18n` option to your `theme.config.js` to configure the language dropdown: | ||
|
||
```jsx filename="theme.config.js" | ||
i18n: [ | ||
{ locale: 'en', text: 'English' }, | ||
{ locale: 'zh', text: '中文' }, | ||
{ locale: 'de', text: 'Deutsch' }, | ||
{ locale: 'ar', text: 'العربية', direction: 'rtl' } | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Next.js Image | ||
|
||
You can use [Next.js Image](https://nextjs.org/docs/basic-features/image-optimization) directly in MDX. | ||
|
||
If the `demo.png` file is located at `/public/demo.png`, you can use the code below to display it: | ||
|
||
```mdx | ||
import Image from 'next/image' | ||
|
||
<Image src="/demo.png" alt="Hello" width={500} height={500} /> | ||
``` | ||
|
||
## Static Image | ||
|
||
import Callout from 'nextra-theme-docs/callout' | ||
|
||
<Callout emoji="⚠️"> | ||
You need to opt-in to this feature by enabling [`unstable_staticImage: | ||
true`](/get-started#create-manually). | ||
</Callout> | ||
|
||
Nextra also supports automatic static image imports, you no longer need to specify the width and height of the image manually, | ||
and you can directly use the Markdown syntax to display the same image: | ||
|
||
```markdown | ||
![Hello](../../../public/demo.png) | ||
``` | ||
|
||
With Next.js Image, there will be no layout shift, and a beautiful blury placeholder will be shown by default when loading the images: | ||
|
||
<br /> | ||
|
||
![Nextra](../../../public/og.png) |
Oops, something went wrong.