diff --git a/example/markdown/example.md b/example/markdown/example.md new file mode 100644 index 0000000..445d460 --- /dev/null +++ b/example/markdown/example.md @@ -0,0 +1,3 @@ +# Test test + +Testing diff --git a/src/plugin.ts b/src/plugin.ts index 43346e7..ea0e0c9 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -97,13 +97,15 @@ export async function getCanvasFromEmbed( canvasMarkdown = text }) } else if (options.ssrPath !== undefined) { - const opPath = - extension === "md" ? options.mdPath : options.assetPath || null + const pathArr = [process.cwd()] + + if (options.ssrPath && extension !== "md") pathArr.push(options.ssrPath) + if (extension === "md" && options.mdPath) pathArr.push(options.mdPath) + + pathArr.push(markdownPath) + + const ssrPath = path.join(...pathArr) - const ssrPath = opPath - ? path.join(process.cwd(), options.ssrPath, opPath, markdownPath) - : path.join(process.cwd(), options.ssrPath, markdownPath) - console.log(ssrPath) try { canvasMarkdown = fs.readFileSync(ssrPath, { encoding: "utf8",