Skip to content

Commit 4535538

Browse files
authored
Code mini
1 parent 4149200 commit 4535538

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!-- CodeHighlight.vue -->
2+
<script setup>
3+
import 'highlight.js/styles/default.css'
4+
import 'highlight.js/styles/github.min.css'
5+
import hljs from 'highlight.js/lib/common'
6+
import hljsVuePlugin from '@highlightjs/vue-plugin'
7+
8+
const props = defineProps({
9+
code: { default: '<?php echo "Insert code here...";' },
10+
language: { type: String, default: 'php' },
11+
})
12+
13+
const highlightjs = hljsVuePlugin.component
14+
15+
function debugCode(code, language = 'php') {
16+
hljs.getLanguage(language)
17+
const result = hljs.highlight(props.code, { language: language })
18+
console.log(result)
19+
}
20+
</script>
21+
22+
<template>
23+
<highlightjs :code="props.code" :language="props.language" />
24+
</template>
25+
26+
<style>
27+
@import url('./css/code.css');
28+
</style>

0 commit comments

Comments
 (0)