1
0
Fork 0
mirror of https://github.com/elk-zone/elk.git synced 2025-05-09 08:43:00 +03:00

feat: support more markdown syntaxes

closes , partial 
This commit is contained in:
三咲智子 2022-11-26 04:19:45 +08:00
parent adf8c5cc1e
commit c9ae7cf942
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
4 changed files with 62 additions and 10 deletions
components/content

View file

@ -4,7 +4,7 @@ const props = defineProps<{
lang: string
}>()
const raw = computed(() => decodeURIComponent(props.code).replace(/&#39;/g, '\''))
const raw = $computed(() => decodeURIComponent(props.code).replace(/&#39;/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>