mirror of
https://github.com/elk-zone/elk.git
synced 2025-05-09 08:43:00 +03:00
parent
adf8c5cc1e
commit
c9ae7cf942
4 changed files with 62 additions and 10 deletions
components/content
|
@ -4,7 +4,7 @@ const props = defineProps<{
|
|||
lang: string
|
||||
}>()
|
||||
|
||||
const raw = computed(() => decodeURIComponent(props.code).replace(/'/g, '\''))
|
||||
const raw = $computed(() => decodeURIComponent(props.code).replace(/'/g, '\''))
|
||||
|
||||
const langMap: Record<string, string> = {
|
||||
js: 'javascript',
|
||||
|
@ -13,7 +13,7 @@ const langMap: Record<string, string> = {
|
|||
}
|
||||
|
||||
const hightlighted = computed(() => {
|
||||
return highlightCode(raw.value, langMap[props.lang] || props.lang as any)
|
||||
return props.lang ? highlightCode(raw, langMap[props.lang] || props.lang as any) : raw
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue