fix: markdoc integration urls

This commit is contained in:
lutaok 2023-10-05 01:06:21 +02:00
parent d78806dfe0
commit 110d0306b0

View file

@ -106,7 +106,7 @@ export async function getContentEntryType({
import { createGetHeadings, createContentComponent } from '@astrojs/markdoc/runtime';
${
markdocConfigUrl
? `import markdocConfig from ${JSON.stringify(markdocConfigUrl.pathname)};`
? `import markdocConfig from ${JSON.stringify(decodeURI(markdocConfigUrl.pathname))};`
: 'const markdocConfig = {};'
}
@ -232,7 +232,9 @@ function getStringifiedImports(
const resolvedPath =
config.type === 'local' ? new URL(config.path, root).pathname : config.path;
stringifiedComponentImports += `import ${importName} from ${JSON.stringify(resolvedPath)};\n`;
stringifiedComponentImports += `import ${importName} from ${JSON.stringify(
decodeURI(resolvedPath)
)};\n`;
}
return stringifiedComponentImports;
}