Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: demo
Browse files Browse the repository at this point in the history
  • Loading branch information
hanspagel committed Dec 13, 2023
1 parent eca1c31 commit fe3d865
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
1 change: 0 additions & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"dependencies": {
"@scalar/snippetz": "workspace:*",
"@scalar/snippetz-plugin-undici": "workspace:*",
"vue": "^3.3.11"
},
"devDependencies": {
Expand Down
8 changes: 3 additions & 5 deletions demo/src/components/CodeExample.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { snippetz } from '@scalar/snippetz'
import { undici } from '@scalar/snippetz-plugin-undici'
import { getHighlighter } from 'shikiji'
const props = defineProps<{
Expand All @@ -15,18 +14,17 @@ const highlightedRequest = ref('')
onMounted(async () => {
// Code
const source = undici(props.request)
code.value = snippetz().get(source)
code.value = snippetz().print('node', 'undici', props.request) ?? ''
// Syntax highlighting for the code
const shiki = await getHighlighter({
themes: ['nord'],
langs: [source.target, 'json'],
langs: ['javascript', 'json'],
})
await shiki.loadTheme('vitesse-dark')
highlightedCode.value = shiki.codeToHtml(code.value, { lang: source.target, theme: 'vitesse-dark' })
highlightedCode.value = shiki.codeToHtml(code.value, { lang: 'javascript', theme: 'vitesse-dark' })
highlightedRequest.value = shiki.codeToHtml(JSON.stringify(props.request, null, 2), { lang: 'json', theme: 'vitesse-dark' })
})
</script>
Expand Down
31 changes: 14 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fe3d865

Please sign in to comment.