File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 72
72
:style =" preTagStyles"
73
73
>
74
74
<code
75
+ v-if =" prismPlugin"
75
76
:class =" `language-${props.lang} ${browserWindow ? 'v-code-block--code-browser' : ''} ${highlightjs ? 'hljs' : ''}`"
76
77
:style =" codeTagStyles"
77
- v-html =" !prismPlugin ? renderedCode : false"
78
- v-text =" prismPlugin ? computedCode : false"
78
+ v-text =" computedCode"
79
+ ></code >
80
+ <code
81
+ v-else
82
+ :class =" `language-${props.lang} ${browserWindow ? 'v-code-block--code-browser' : ''} ${highlightjs ? 'hljs' : ''}`"
83
+ :style =" codeTagStyles"
84
+ v-html =" renderedCode"
79
85
></code >
80
86
</pre >
81
87
</div >
@@ -203,7 +209,7 @@ const props = defineProps({
203
209
prismjs: {
204
210
type: Boolean ,
205
211
required: false ,
206
- default: true ,
212
+ default: false ,
207
213
},
208
214
prismPlugin: {
209
215
type: Boolean ,
@@ -399,6 +405,10 @@ onMounted(() => {
399
405
400
406
// -------------------------------------------------- Methods //
401
407
function checkLibrary(): void {
408
+ if (! props .prismjs && ! props .highlightjs ) {
409
+ throw new Error (' [vue3-code-block]: You must set either the prismjs or highlightjs props.' );
410
+ }
411
+
402
412
if (props .prismjs && props .highlightjs ) {
403
413
throw new Error (' [vue3-code-block]: You cannot have both prismjs and highlightjs props set at the same time.' );
404
414
}
You can’t perform that action at this time.
0 commit comments