File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments