refactor: fix typo in function name
parent
295eb97a7a
commit
98a4e8caaf
|
@ -5,7 +5,7 @@ const shiki = ref<Highlighter>()
|
||||||
const registeredLang = ref(new Map<string, boolean>())
|
const registeredLang = ref(new Map<string, boolean>())
|
||||||
let shikiImport: Promise<void> | undefined
|
let shikiImport: Promise<void> | undefined
|
||||||
|
|
||||||
export function useHightlighter(lang: Lang) {
|
function useHighlighter(lang: Lang) {
|
||||||
if (!shikiImport) {
|
if (!shikiImport) {
|
||||||
shikiImport = import('shiki-es')
|
shikiImport = import('shiki-es')
|
||||||
.then(async (r) => {
|
.then(async (r) => {
|
||||||
|
@ -61,7 +61,7 @@ function escapeHtml(text: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function highlightCode(code: string, lang: Lang) {
|
export function highlightCode(code: string, lang: Lang) {
|
||||||
const shiki = useHightlighter(lang)
|
const shiki = useHighlighter(lang)
|
||||||
if (!shiki)
|
if (!shiki)
|
||||||
return escapeHtml(code)
|
return escapeHtml(code)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue