Nuxt Typography
A Nuxt theme to get a beautiful and customisable typography with a set of prose components for Nuxt Content.

Repository is on GitHub: nuxt-themes/typography
See also the online playground.
Some examples:
Installation
npm install --save-dev @nuxt-themes/typographyUsage
Add it to the nuxt.config:
export default defineNuxtConfig({
extends: '@nuxt-themes/typography'
})Configuration
You can change the whole appearance of Prose components via tokens.config.ts file.
You can check out all the available keys by looking at the source of this file.
Tokens are divided between two keys:
typographyrules general style tokens reused in the other categoryproserules per-component style tokens, that feeds fromtypography
Editing typography is more suited if you want to modify or adapt the general appearance of your typography.
Editing prose is more suited if you want to modify or adapt the appearance of a specific prose component.
Configuration example
import { defineTheme } from 'pinceau'
export default defineTheme({
typography: {
// This will change the general line-break size
letterSpacings: {
tight: '-0.035em',
wide: '0.035em'
},
},
prose: {
// This will change the fontSize of the `<ProseH1>` component
h1: {
fontSize: '{typography.2xl.fontSize}'
}
}
})Icons
To customize the icons used in Nuxt Typography, use the prose property in your app.config.ts:
export default defineAppConfig({
prose: {
// Default icon for all headings on hover
headings: {
icon: 'ph:anchor'
},
// Icon used for h1 headings
h1: {
icon: 'ph:link'
},
// Remove icon on h2 headings
h2: {
icon: false
},
// Icon used for the copy button on code blocks
copyButton: {
iconCopy: 'ph:copy',
iconCopied: 'ph:check'
}
}
})Note that under the hood, Nuxt Typography uses nuxt-icon, this mean that you can use a custom component name or any name coming from icones.js.org.
Prose Components
Nuxt Typography expose a set of prose components that work seamlessly with Nuxt Content.
To overwrite a prose component, create a component with the same name in your project components/content/ directory (ex: components/content/ProseA.vue).
<ProseA>
[Link](/api/components/prose)<ProseBlockquote>
> Block quoteBlock quote
<ProseCode>
\```javascript
export default () => {
console.log('Code block')
}
\```export default () => {
console.log('Code block')
}Check out the highlight options for more about the syntax highlighting.
<ProseCodeInline>
`code inline`.
`const codeInline: string = 'highlighted code inline'`{lang="ts"}code inline.
const codeInline: string = 'highlighted code inline'
<ProseH1>
H1 Heading
# H1 Heading<ProseH2>
## H2 HeadingH2 Heading
<ProseH3>
### H3 HeadingH3 Heading
<ProseH4>
#### H4 HeadingH4 Heading
<ProseH5>
##### H5 HeadingH5 Heading
<ProseH6>
###### H6 HeadingH6 Heading
<ProseHr>
---<ProseImg>

<ProseUl>
- Just
- An
- Unordered
- List- Just
- An
- Unordered
- List
It also include the <ProseLi> component.
<ProseOl>
1. Foo
2. Bar
3. Baz- Foo
- Bar
- Baz
It also include the <ProseLi> component.
<ProseP>
Just a paragraph.Just a paragraph.
<ProseStrong>
**Just a strong paragraph.**Just a strong paragraph.
<ProseEm>
_Just an italic paragraph._Just an italic paragraph.
<ProseTable>
| Key | Type | Description |
|-----|------| ------------|
| 1 | Wonderful | Table with `some long code snippet example` |
| 2 | Wonderful | Data |
| 3 | Wonderful | Website || Key | Type | Description |
|---|---|---|
| 1 | Wonderful | Table with some long code snippet example |
| 2 | Wonderful | Data |
| 3 | Wonderful | Website |
It also includes:
<ProseTbody><ProseTd><ProseTh><ProseThead><ProseTr>