hljs.
This commit is contained in:
15
src/App.vue
15
src/App.vue
@@ -1,8 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { zhCN, dateZhCN, darkTheme } from "naive-ui"
|
||||
import { isDark } from "./shared/composables/dark"
|
||||
import hljs from "highlight.js/lib/core"
|
||||
import c from "highlight.js/lib/languages/c"
|
||||
import cpp from "highlight.js/lib/languages/c"
|
||||
import java from "highlight.js/lib/languages/java"
|
||||
import python from "highlight.js/lib/languages/python"
|
||||
import javascript from "highlight.js/lib/languages/javascript"
|
||||
import go from "highlight.js/lib/languages/go"
|
||||
|
||||
const theme = computed(() => (isDark.value ? darkTheme : null))
|
||||
|
||||
hljs.registerLanguage("c", c)
|
||||
hljs.registerLanguage("cpp", cpp)
|
||||
hljs.registerLanguage("java", java)
|
||||
hljs.registerLanguage("python", python)
|
||||
hljs.registerLanguage("javascript", javascript)
|
||||
hljs.registerLanguage("go", go)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -11,6 +25,7 @@ const theme = computed(() => (isDark.value ? darkTheme : null))
|
||||
:theme="theme"
|
||||
:locale="zhCN"
|
||||
:date-locale="dateZhCN"
|
||||
:hljs="hljs"
|
||||
>
|
||||
<router-view></router-view>
|
||||
</n-config-provider>
|
||||
|
||||
Reference in New Issue
Block a user