Skip to content

Commit f8b7c19

Browse files
authored
fix(message): dark mode syntax highlighting in code blocks (#45)
* fix(message): dark mode syntax highlighting in code blocks * chore: remove code block mode prop and upgrade streamdown-vue
1 parent 9b9929a commit f8b7c19

File tree

6 files changed

+38
-36
lines changed

6 files changed

+38
-36
lines changed

apps/www/content/3.components/1.chatbot/message.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ const md = computed(() => (slotContent.value ?? props.content ?? '') as string)
421421
422422
<template>
423423
<StreamMarkdown
424+
:shiki-theme="{
425+
light: 'github-light',
426+
dark: 'github-dark',
427+
}"
424428
:content="md"
425429
:class="
426430
cn(

packages/elements/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"lucide-vue-next": "^0.544.0",
2121
"motion-v": "^1.7.3",
2222
"shiki": "^3.14.0",
23-
"streamdown-vue": "^1.0.21",
23+
"streamdown-vue": "^1.0.29",
2424
"tokenlens": "^1.3.1",
2525
"vue": "^3.5.22",
2626
"vue-stick-to-bottom": "^0.1.0"

packages/elements/src/message/MessageResponse.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const md = computed(() => (slotContent.value ?? props.content ?? '') as string)
2626

2727
<template>
2828
<StreamMarkdown
29+
:shiki-theme="{
30+
light: 'github-light',
31+
dark: 'github-dark',
32+
}"
2933
:content="md"
3034
:class="
3135
cn(

packages/examples/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"private": true,
55
"description": "Examples for the repo.",
66
"exports": {
7-
".": "./src/index.ts",
8-
"./*": "./src/*.ts"
7+
".": "./src/index.ts"
98
},
109
"dependencies": {
1110
"@repo/elements": "workspace:*",

packages/examples/src/message.vue

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Creates reactive primitive values:
9696
import { ref } from 'vue'
9797
9898
const count = ref(0)
99-
<//script>
99+
<\/script>
100100
101101
<template>
102102
<button @click="count++">Count: {{ count }}</button>
@@ -115,19 +115,19 @@ const count = ref(0)
115115
watch(count, (newVal, oldVal) => {
116116
console.log(\`Count changed from \${oldVal} to \${newVal}\`)
117117
})
118-
<//script>
118+
<\/script>
119119
\`\`\`
120120
121121
## When to Use the Composition API
122122
123-
- ✅ **For complex logic** — Easier to organize and reuse reactive state
124-
- ✅ **For reusable code** — Create your own composables (like custom hooks)
125-
- ✅ **For TypeScript support** — More type-friendly than Options API
123+
- ✅ **For complex logic** — Easier to organize and reuse reactive state
124+
- ✅ **For reusable code** — Create your own composables (like custom hooks)
125+
- ✅ **For TypeScript support** — More type-friendly than Options API
126126
- ❌ **For simple components** — The Options API might be enough
127127
128128
## Rules of the Composition API
129129
130-
1. Only use Vue composables **inside \`setup()\`** or other composables
130+
1. Only use Vue composables **inside \`setup()\`** or other composables
131131
2. Always return what you want to use in your template from \`setup()\`
132132
133133
Would you like to explore more advanced composables like \`computed\` or \`onMounted\`?`,
@@ -138,11 +138,11 @@ Would you like to explore more advanced composables like \`computed\` or \`onMou
138138
139139
Here are the most common composables:
140140
141-
- **ref()** — creates reactive primitive values
142-
- **reactive()** — makes entire objects reactive
143-
- **computed()** — creates derived reactive values
144-
- **watch()** — runs side effects on data changes
145-
- **onMounted()** — lifecycle hook for when a component is mounted
141+
- **ref()** — creates reactive primitive values
142+
- **reactive()** — makes entire objects reactive
143+
- **computed()** — creates derived reactive values
144+
- **watch()** — runs side effects on data changes
145+
- **onMounted()** — lifecycle hook for when a component is mounted
146146
147147
Here's a simple example:
148148
@@ -155,7 +155,7 @@ const count = ref(0)
155155
onMounted(() => {
156156
console.log('Component mounted!')
157157
})
158-
<//script>
158+
<\/script>
159159
160160
<template>
161161
<button @click="count++">Clicked {{ count }} times</button>
@@ -170,9 +170,9 @@ Which specific composable would you like to learn more about?`,
170170
171171
## Key Benefits
172172
173-
1. **Cleaner code organization** — Group related logic by feature
174-
2. **Reusable logic** — Build and share your own composables
175-
3. **Better TypeScript support** — Stronger typing than the Options API
173+
1. **Cleaner code organization** — Group related logic by feature
174+
2. **Reusable logic** — Build and share your own composables
175+
3. **Better TypeScript support** — Stronger typing than the Options API
176176
177177
## Most Popular Composables
178178

pnpm-lock.yaml

Lines changed: 13 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)