Code blocks are rendered by the ProsePre component of @nuxtjs/mdc and code highlighting is done underneath by Shiki.
export default defineNuxtConfig({
modules: ['pohon-ui']
});
```ts
export default defineNuxtConfig({
modules: ['pohon-ui']
})
```
| Prop | Default | Type |
|---|
Syntax highlighting is available for dozens of programming languages.
<script setup lang="ts">
const message = ref('Hello World!');
function updateMessage() {
message.value = 'Button clicked!';
}
</script>
<template>
<div>
<h1>{{ message }}</h1>
<PButton @click="updateMessage">
Click me
</PButton>
</div>
</template>
```vue
<script setup lang="ts">
const message = ref('Hello World!')
function updateMessage() {
message.value = 'Button clicked!'
}
</script>
<template>
<div>
<h1>{{ message }}</h1>
<PButton @click="updateMessage">
Click me
</PButton>
</div>
</template>
```
one-dark-pro themes are used for both light & dark mode. You can change this in your nuxt.config.ts through the content.build.markdown.highlight key.Code blocks support filename display with automatic icon detection.
export default defineNuxtConfig({
modules: ['pohon-ui']
});
```ts [nuxt.config.ts]
export default defineNuxtConfig({
modules: ['pohon-ui']
})
```
ProseCodeIcon component and contains a set of predefined icons which you can customize in your app.config.ts:export default defineAppConfig({
pohon: {
prose: {
codeIcon: {
terminal: 'i-ph:terminal-window-duotone',
config: 'i-lucide:settings',
package: 'i-lucide:package'
}
}
}
});
Every code-block has a built-in copy button that will copy the code to your clipboard.
app.config.ts through the pohon.icons.copy and pohon.icons.copyCheck keys:export default defineAppConfig({
pohon: {
icons: {
copy: 'i-lucide:copy',
copyCheck: 'i-lucide:copy-check'
}
}
});
Highlight specific lines to draw attention to important parts.
export default defineNuxtConfig({
modules: ['pohon-ui'], // This line is highlighted
css: ['~/assets/css/main.css']
});
```ts [nuxt.config.ts] {2}
export default defineNuxtConfig({
modules: ['pohon-ui'], // This line is highlighted
css: ['~/assets/css/main.css']
})
```
Use the diff language to show changes between code versions.
export default defineNuxtConfig({
modules: [
- 'some-ui'
+ 'pohon-ui'
]
})
```diff [nuxt.config.ts]
export default defineNuxtConfig({
modules: [
- 'some-ui'
+ 'pohon-ui'
]
})
```
Inline code snippets are rendered by the ProseCode component of @nuxtjs/mdc.
inline code
`inline code`
| Prop | Default | Type |
|---|
Below is the theme configuration skeleton for the ProseCode. Since the component is provided unstyled by default, you will need to fill in these values to apply your own custom look and feel. If you prefer to use our pre-built, opinionated styling, you can instead use our UnoCSS preset, this docs is using it as well.
export default defineAppConfig({
pohon: {
prose: {
code: {
base: '',
variants: {
color: {
primary: '',
secondary: '',
success: '',
info: '',
warning: '',
error: '',
neutral: ''
}
},
defaultVariants: {
color: 'neutral'
}
}
}
}
};
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import pohon from 'pohon-ui/vite'
export default defineAppConfig({
pohon: {
prose: {
code: {
base: '',
variants: {
color: {
primary: '',
secondary: '',
success: '',
info: '',
warning: '',
error: '',
neutral: ''
}
},
defaultVariants: {
color: 'neutral'
}
}
}
}
};
Use the color prop to change the color of the inline code. Defaults to neutral.
inline code
`inline code`{color="error"}
Use the lang prop to specify the language of the inline code.
nuxt.config.ts
`nuxt.config.ts`{lang="ts-type"}