From e7abdcc26818a322a751dd2d6f62e8120815c80b Mon Sep 17 00:00:00 2001 From: zhuzhengjian Date: Mon, 25 Oct 2021 16:40:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=AF=E6=8C=81markown=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=BF=94=E5=9B=9E=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- src/node/markdown/markdown.ts | 4 ++-- src/node/markdownToVue.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0e9bd5c8..2a5cb454 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ dist node_modules TODOs.md -.vscode \ No newline at end of file +.vscode +.idea \ No newline at end of file diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 3338b240..1d8937f7 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -94,9 +94,9 @@ export const createMarkdownRenderer = ( // wrap render so that we can return both the html and extracted data. const render = md.render - const wrappedRender: MarkdownRenderer['render'] = (src) => { + const wrappedRender: MarkdownRenderer['render'] = (src,env={}) => { ;(md as any).__data = {} - const html = render.call(md, src) + const html = render.call(md, src,env) return { html, data: (md as any).__data diff --git a/src/node/markdownToVue.ts b/src/node/markdownToVue.ts index bc01c15d..3079818e 100644 --- a/src/node/markdownToVue.ts +++ b/src/node/markdownToVue.ts @@ -65,7 +65,7 @@ export function createMarkdownToVueRenderFn( }) const { content, data: frontmatter } = matter(src) - let { html, data } = md.render(content) + let { html, data } = md.render(content,{file}) if (isBuild) { // avoid env variables being replaced by vite