diff --git a/src/components/StackedNote.vue b/src/components/StackedNote.vue index 7cd0394..043db60 100644 --- a/src/components/StackedNote.vue +++ b/src/components/StackedNote.vue @@ -70,7 +70,7 @@ watch( } const lang = p ? getFileLanguage(p) : null const filename = p?.split("/").pop() - const result = await renderCodeFile(raw, lang, filename) + const result = await renderCodeFile({ rawContent: raw, lang, filename }) if (rawContent.value === raw) { displayedContent.value = result } diff --git a/src/hooks/useMarkdown.hook.ts b/src/hooks/useMarkdown.hook.ts index 75e98fd..b014a9f 100644 --- a/src/hooks/useMarkdown.hook.ts +++ b/src/hooks/useMarkdown.hook.ts @@ -164,11 +164,15 @@ const renderMarkdown = (content: string, env?: Record) => { return env ? md.render(content, env) : md.render(content) } -export const renderCodeFile = async ( - rawContent: string, - lang: string | null, +export const renderCodeFile = async ({ + rawContent, + lang, + filename +}: { + rawContent: string + lang: string | null filename?: string -): Promise => { +}): Promise => { await useShikiji() const heading = filename ? `# ${filename}\n\n` : "" if (lang !== null) {