mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
docs: add mdx page (#514)
Co-authored-by: Marco Pasqualetti <24919330+marcalexiei@users.noreply.github.com>
This commit is contained in:
@@ -11,4 +11,60 @@ import Breadcrumbs from '@/components/Breadcrumbs'
|
||||
|
||||
# MDX
|
||||
|
||||
TODO
|
||||
## Overview
|
||||
|
||||
[MDX](https://mdxjs.com/) is a library that allows writing markdown
|
||||
files as React components and import JSX directly within the markdown
|
||||
content.
|
||||
|
||||
Tuono fully supports MDX.
|
||||
|
||||
You can start using it right away with the `with-mdx` template:
|
||||
|
||||
```sh
|
||||
tuono new tuono-with-mdx --template with-mdx
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install MDX via your Node.js preferred package manager.
|
||||
|
||||
```sh
|
||||
npm install @mdx-js/react
|
||||
```
|
||||
|
||||
2. Install also the `@mdx-js/rollup` vite plugin as `devDependency`
|
||||
|
||||
```sh
|
||||
npm install -D @mdx-js/rollup
|
||||
```
|
||||
|
||||
3. Add the MDX vite plugin to `tuono.config.ts`, as seen in the example below:
|
||||
|
||||
```ts
|
||||
import type { TuonoConfig } from 'tuono/config'
|
||||
import mdx from '@mdx-js/rollup'
|
||||
|
||||
const config: TuonoConfig = {
|
||||
vite: {
|
||||
optimizeDeps: {
|
||||
exclude: ['@mdx-js/react'],
|
||||
},
|
||||
plugins: [
|
||||
{ enforce: 'pre', ...mdx({ providerImportSource: '@mdx-js/react' }) },
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
MDX is ready to go! You can now start declaring any component/route as MDX:
|
||||
|
||||
```mdx
|
||||
// src/routes/about.mdx
|
||||
|
||||
## About page
|
||||
```
|
||||
|
||||
@@ -27,10 +27,17 @@ tuono new tuono-with-tailwind --template with-tailwind
|
||||
1. Install Tailwind CSS via your Node.js preferred package manager.
|
||||
|
||||
```sh
|
||||
npm install tailwindcss@next @tailwindcss/vite@next
|
||||
npm install tailwindcss
|
||||
```
|
||||
|
||||
2. Add the Tailwind CSS vite plugin to `tuono.config.ts`, as seen in the example below:
|
||||
2. Install also the `@tailwindcss/vite` vite plugin as `devDependency`
|
||||
|
||||
```sh
|
||||
npm install -D @tailwindcss/vite
|
||||
|
||||
```
|
||||
|
||||
3. Add the Tailwind CSS vite plugin to `tuono.config.ts`, as seen in the example below:
|
||||
|
||||
```ts
|
||||
import type { TuonoConfig } from 'tuono/config'
|
||||
@@ -45,7 +52,7 @@ tuono new tuono-with-tailwind --template with-tailwind
|
||||
export default config
|
||||
```
|
||||
|
||||
3. Add the Tailwind CSS directives to `src/styles/global.css`.
|
||||
4. Add the Tailwind CSS directives to `src/styles/global.css`.
|
||||
|
||||
```css
|
||||
@import 'tailwindcss';
|
||||
|
||||
Reference in New Issue
Block a user