### Develop Example Docs Locally Source: https://github.com/shuding/nextra/blob/main/README.md Starts the 'example-docs' project locally for development. Changes will be re-rendered instantly. For core or theme package updates, a rebuild might be necessary, or use watch mode. ```bash pnpm --filter example-docs dev ``` -------------------------------- ### Install typesense-nextra-adapter Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/guide/search/typesense/page.mdx Install the adapter package using npm or yarn. ```sh npm i typesense-nextra-adapter ``` -------------------------------- ### Install Nextra blog theme Source: https://github.com/shuding/nextra/blob/main/examples/docs/src/content/themes/blog/index.mdx Install the specific theme package for the blog layout. ```sh npm i nextra-theme-blog ``` -------------------------------- ### Install Next.js, Nextra, and React Source: https://github.com/shuding/nextra/blob/main/examples/docs/src/content/themes/docs/index.mdx Use this command to install the core Next.js, Nextra, and React packages. This is the first step in setting up your project. ```sh npm i react react-dom next nextra ``` -------------------------------- ### Install Nextra Blog Theme Dependencies Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/blog-theme/start/page.mdx Install Next.js, React, Nextra, and the Nextra Blog Theme. If Next.js is already installed, only install 'nextra' and 'nextra-theme-blog'. ```sh npm i next react react-dom nextra nextra-theme-blog ``` -------------------------------- ### Install KaTeX Package Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/advanced/latex/page.mdx Install the `katex` package using npm or yarn if you plan to import its CSS directly. ```bash npm i katex ``` -------------------------------- ### Install Nextra dependencies Source: https://github.com/shuding/nextra/blob/main/examples/docs/src/content/themes/blog/index.mdx Install the required packages for Next.js, Nextra, and React. ```sh npm i next nextra react react-dom ``` -------------------------------- ### Create Posts Page with Nextra Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/blog-theme/posts/page.mdx This example shows the basic structure for a posts page in a Nextra application. It utilizes a custom `ExampleCode` component to render blog examples. ```jsx import { ExampleCode } from 'components/example-code' ``` -------------------------------- ### Install Nextra Docs Theme Source: https://github.com/shuding/nextra/blob/main/examples/docs/src/content/themes/docs/index.mdx Install the specific theme package for documentation websites using Nextra. ```sh npm i nextra-theme-docs ``` -------------------------------- ### Import Icons and OverviewPage Component Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/guide/page.mdx Imports necessary icons and the OverviewPage component from local components and nextra. This setup is required for rendering the guide's overview page. ```javascript import { BrushIcon, GlobeIcon, LightningIcon, PictureIcon, StarsIcon } from '@components/icons' import { InformationCircleIcon, LinkIcon, MarkdownIcon } from 'nextra/icons' import { OverviewPage } from '../../_components/overview-page' ``` -------------------------------- ### Setup application entry point Source: https://github.com/shuding/nextra/blob/main/examples/docs/src/content/themes/blog/index.mdx Import the theme stylesheet and configure the custom App component in pages/_app.js. ```jsx import 'nextra-theme-blog/style.css' export default function Nextra({ Component, pageProps }) { const getLayout = Component.getLayout || (page => page) return } ``` -------------------------------- ### Start the development server Source: https://github.com/shuding/nextra/blob/main/docs/components/ready-to-go.mdx Executes the development script defined in the project's package.json file. ```sh npm run dev ``` ```sh yarn dev ``` ```sh pnpm dev ``` ```sh bun dev ``` -------------------------------- ### Install ESLint Plugin Source: https://github.com/shuding/nextra/blob/main/examples/swr-site/content/en/foo.md Installs the @graphql-eslint/eslint-plugin package using npm or yarn. ```sh npm i @graphql-eslint/eslint-plugin ``` -------------------------------- ### Install Nextra dependencies Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/docs-theme/start/page.mdx Run this command in your project directory to install the required packages for a new Nextra Docs site. ```sh npm i next react react-dom nextra nextra-theme-docs ``` ```yarn yarn add next react react-dom nextra nextra-theme-docs ``` ```pnpm pnpm add next react react-dom nextra nextra-theme-docs ``` ```bun bun add next react react-dom nextra nextra-theme-docs ``` -------------------------------- ### MathJax Example Component Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/advanced/latex/page.mdx An example of how to programmatically compile and render MathJax content using MDXRemote. ```jsx export async function MathJaxExample() { const rawMdx = `~~~math \\int_2^3x^3\\,\\mathrm{d}x ~~~` const rawJs = await compileMdx(rawMdx, { latex: { renderer: 'mathjax', options: { config: { tex: { macros: { RR: '\\mathbb{R}' } } } } } }) return ( ) } ``` -------------------------------- ### Install Inkeep Component Library Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/guide/search/ai/page.mdx Install the required React component library for Inkeep. ```bash npm i @inkeep/cxkit-react ``` -------------------------------- ### Install Pagefind dependency Source: https://github.com/shuding/nextra/blob/main/docs/app/docs/guide/search/page.mdx Add Pagefind as a development dependency to your project. ```sh npm i -D pagefind ``` -------------------------------- ### Global SWRConfig Setup Source: https://github.com/shuding/nextra/blob/main/examples/swr-site/content/en/docs/advanced/react-native.mdx Wrap the application with SWRConfig to apply global configurations. ```jsx ``` -------------------------------- ### Run development and production servers Source: https://github.com/shuding/nextra/blob/main/docs/components/install-nextra-theme.mdx Commands to start the application in development or production modes. ```sh npm run dev ``` ```sh npm run build npm run start ``` -------------------------------- ### Install Dependencies with npm/yarn Source: https://github.com/shuding/nextra/blob/main/examples/swr-site/content/en/docs/getting-started.mdx Installs the swr package and a special __esModule variable. Use npm2yarn to convert between npm and yarn commands. ```sh npm i swr __esModule ``` -------------------------------- ### React Bleed Component Examples Source: https://github.com/shuding/nextra/blob/main/examples/docs/src/content/themes/docs/bleed.mdx Shows how to use the Bleed component in a React application, including examples with images and iframes. Requires importing the component. ```jsx import { Bleed } from 'nextra/components' Hey, I can use **Markdown** syntax here. ![Nextra](https://nextra.site/og.jpeg)