Skip to content

Commit

Permalink
Add data-language attribute to code blocks in ProsePre component
Browse files Browse the repository at this point in the history
  • Loading branch information
d0rich committed Sep 6, 2024
1 parent 9c3ace9 commit f3e043a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-dogs-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@d0rich/nuxt-design-system': patch
---

Add data-language for code blocks for telegram instant view
48 changes: 48 additions & 0 deletions packages/nuxt-design-system/components/content/ProsePre.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<template>
<ProseCode
:code="code"
:language="language"
:filename="filename"
:highlights="highlights"
:meta="meta"
>
<pre
:class="$props.class"
:style="style"
:data-language="language"
><slot /></pre>
</ProseCode>
</template>

<script setup lang="ts">
defineProps({
code: {
type: String,
default: ''
},
language: {
type: String,
default: null
},
filename: {
type: String,
default: null
},
highlights: {
type: Array as () => number[],
default: () => []
},
meta: {
type: String,
default: null
},
class: {
type: String,
default: null
},
style: {
type: [String, Object],
default: null
}
})
</script>

0 comments on commit f3e043a

Please sign in to comment.