fix(mdx): resolve React-PDF SVG typings and next-mdx-remote parsing issues for pages/products
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Successful in 52s
Build & Deploy / 🏗️ Build (push) Successful in 1m58s
Build & Deploy / 🚀 Deploy (push) Failing after 14s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 1s

This commit is contained in:
2026-06-09 19:21:22 +02:00
parent 5a9c6e4a0a
commit 3cbb4ba700
4 changed files with 16 additions and 3 deletions

View File

@@ -51,7 +51,13 @@ export async function getPageBySlug(slug: string, locale: string): Promise<PageD
const fileContent = await fs.readFile(filePath, 'utf-8');
const { data, content } = matter(fileContent);
let parsedContent = content;
// Fix MDX data props dropped by next-mdx-remote
// Payload serializes as data={{"items":...}} which Acorn treats as a Block statement.
const fixedContent = content.replace(/data=\{\{([\s\S]*?)\}\}/g, (match, p1) => {
return 'data="{' + p1.replace(/"/g, '&quot;') + '}"';
});
let parsedContent = fixedContent;
try {
if (content.trim().startsWith('{')) {
parsedContent = JSON.parse(content);