Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/highlight code #90

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/app.vue
Expand Up @@ -37,3 +37,17 @@ provide('navigation', navigation)

<UNotifications />
</template>

<style>
code.shiki {
background-color: transparent !important;
}

html.dark .shiki,
html.dark .shiki span {
color: var(--shiki-dark) !important;
font-style: var(--shiki-dark-font-style) !important;
font-weight: var(--shiki-dark-font-weight) !important;
text-decoration: var(--shiki-dark-text-decoration) !important;
}
</style>
2 changes: 1 addition & 1 deletion app/components/global/Pm-Install.vue
Expand Up @@ -28,7 +28,7 @@ onMounted(() => {
<template>
<CodeGroup ref="codeGroup">
<ProseCode v-for="(codeBlock, index) in codeBlocks" :key="index" v-bind="codeBlock">
<pre><code>{{ codeBlock.code }}</code></pre>
<Shiki :code="codeBlock.code" language="bash" />
</ProseCode>
</CodeGroup>
</template>
2 changes: 1 addition & 1 deletion app/components/global/Pm-Run.vue
Expand Up @@ -22,7 +22,7 @@ onMounted(() => {
<template>
<CodeGroup ref="codeGroup">
<ProseCode v-for="(codeBlock, index) in codeBlocks" :key="index" v-bind="codeBlock">
<pre><code>{{ codeBlock.code }}</code></pre>
<Shiki :code="codeBlock.code" language="bash" />
</ProseCode>
</CodeGroup>
</template>
2 changes: 1 addition & 1 deletion app/components/global/Pm-x.vue
Expand Up @@ -22,7 +22,7 @@ onMounted(() => {
<template>
<CodeGroup ref="codeGroup">
<ProseCode v-for="(codeBlock, index) in codeBlocks" :key="index" v-bind="codeBlock">
<pre><code>{{ codeBlock.code }}</code></pre>
<Shiki :code="codeBlock.code" language="bash" />
</ProseCode>
</CodeGroup>
</template>
11 changes: 9 additions & 2 deletions app/nuxt.config.ts
Expand Up @@ -9,7 +9,7 @@ const ssr = Boolean(isProd || process.env.NUXT_DOCS_SSR)

export default defineNuxtConfig({
ssr,
modules: ['@nuxt/fonts', '@nuxt/content', '@nuxtjs/seo', isProd && '@nuxtjs/plausible', '@nuxt/ui'],
modules: ['nuxt-shiki', '@nuxt/fonts', '@nuxt/content', '@nuxtjs/seo', isProd && '@nuxtjs/plausible', '@nuxt/ui'],
ui: {
icons: [],
},
Expand Down Expand Up @@ -45,7 +45,14 @@ export default defineNuxtConfig({
'\\.(js|mjs|ts)$',
],
highlight: {
langs: ['json5', 'jsonc', 'toml', 'yaml', 'html', 'sh', 'shell', 'bash', 'mdc', 'markdown', 'md'],
langs: ['json5', 'jsonc', 'toml', 'yaml', 'html', 'sh', 'shell', 'bash', 'mdc', 'markdown', 'md', 'docker'],
},
},
shiki: {
bundledLangs: ['json5', 'jsonc', 'toml', 'yaml', 'html', 'sh', 'shell', 'bash', 'mdc', 'markdown', 'md', 'docker'],
defaultTheme: {
dark: 'material-theme-palenight',
light: 'material-theme-lighter',
},
},
routeRules: {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -46,6 +46,7 @@
"nuxi": "^3.10.1",
"nuxt": "^3.10.3",
"nuxt-build-cache": "^0.1.1",
"nuxt-shiki": "^0.2.1",
"pkg-types": "^1.0.3",
"scule": "^1.3.0",
"tailwindcss": "^3.4.1",
Expand Down