summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/src
diff options
context:
space:
mode:
authorGravatar Happydev <81974850+MoustaphaDev@users.noreply.github.com> 2023-06-09 20:21:32 +0000
committerGravatar GitHub <noreply@github.com> 2023-06-09 20:21:32 +0000
commitbc7c164bc34959ab393df89adf961f269f147d09 (patch)
tree127837def19e6858d90dd0d4be0893cf0d97d33f /packages/integrations/mdx/src
parente138f663442c27c473987900cb1fe243949a5a52 (diff)
downloadastro-bc7c164bc34959ab393df89adf961f269f147d09.tar.gz
astro-bc7c164bc34959ab393df89adf961f269f147d09.tar.zst
astro-bc7c164bc34959ab393df89adf961f269f147d09.zip
Do not silence runtime MDX errors (#7089)
* test: add fixture * chore: remove unneeded files in fixture * test: update test mdx filfe * test: add test case * mark component as mdx * add error builder utility * throw error when it comes from an MDX component * chore: update lock file * Add comment to refactor later * apply review * add missing comma
Diffstat (limited to 'packages/integrations/mdx/src')
-rw-r--r--packages/integrations/mdx/src/index.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts
index 18c9aceca..1d0320213 100644
--- a/packages/integrations/mdx/src/index.ts
+++ b/packages/integrations/mdx/src/index.ts
@@ -165,6 +165,9 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
export default Content;`;
}
+ // mark the component as an MDX component
+ code += `\nContent[Symbol.for('mdx-component')] = true`;
+
// Ensures styles and scripts are injected into a `<head>`
// When a layout is not applied
code += `\nContent[Symbol.for('astro.needsHeadRendering')] = !Boolean(frontmatter.layout);`;