chore: remove markdoc.config loader
This commit is contained in:
parent
bdcc67fc37
commit
af4ea22836
1 changed files with 1 additions and 15 deletions
|
@ -28,17 +28,6 @@ export default function markdoc(): AstroIntegration {
|
||||||
};
|
};
|
||||||
addContentEntryType(contentEntryType);
|
addContentEntryType(contentEntryType);
|
||||||
|
|
||||||
const markdocConfigUrl = new URL('./markdoc.config', config.srcDir);
|
|
||||||
const configFileLoad = `if (!config) {
|
|
||||||
try {
|
|
||||||
const importedConfig = await import(${JSON.stringify(markdocConfigUrl.pathname)});
|
|
||||||
console.log({importedConfig})
|
|
||||||
config = importedConfig.default.transform;
|
|
||||||
} catch {
|
|
||||||
config = {};
|
|
||||||
}
|
|
||||||
}`;
|
|
||||||
|
|
||||||
const viteConfig: InlineConfig = {
|
const viteConfig: InlineConfig = {
|
||||||
plugins: [
|
plugins: [
|
||||||
{
|
{
|
||||||
|
@ -47,10 +36,7 @@ export default function markdoc(): AstroIntegration {
|
||||||
if (!id.endsWith('.mdoc')) return;
|
if (!id.endsWith('.mdoc')) return;
|
||||||
return `import { jsx as h } from 'astro/jsx-runtime';\nimport { Markdoc } from '@astrojs/markdoc';\nimport { Renderer } from '@astrojs/markdoc/components';\nexport const body = ${JSON.stringify(
|
return `import { jsx as h } from 'astro/jsx-runtime';\nimport { Markdoc } from '@astrojs/markdoc';\nimport { Renderer } from '@astrojs/markdoc/components';\nexport const body = ${JSON.stringify(
|
||||||
code
|
code
|
||||||
)};\nexport function getParsed() { return Markdoc.parse(body); }\nexport async function getTransformed(inlineConfig) {
|
)};\nexport function getParsed() { return Markdoc.parse(body); }\nexport async function getTransformed(inlineConfig) { return Markdoc.transform(getParsed(), inlineConfig) }\nexport async function Content ({ config, components }) { return h(Renderer, { content: await getTransformed(config), components }); }\nContent[Symbol.for('astro.needsHeadRendering')] = true;`;
|
||||||
let config = inlineConfig;\n${
|
|
||||||
fs.existsSync(markdocConfigUrl) ? configFileLoad : ''
|
|
||||||
}\nreturn Markdoc.transform(getParsed(), config) }\nexport async function Content ({ config, components }) { return h(Renderer, { content: await getTransformed(config), components }); }\nContent[Symbol.for('astro.needsHeadRendering')] = true;`;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue