Using MDX safely


This theme supports MDX for components maintained in the site source. Posts written from the CMS are saved as regular Markdown so everyday editing stays simple and does not execute pasted JavaScript.

Why MDX?

MDX is a flavor of Markdown that can mix components into an article. It is useful when a developer intentionally builds and reviews an interactive component in the repository.

For ordinary posts, use the CMS formatting tools, code blocks, photos, callouts, and collapsible sections. They provide rich presentation without adding executable code to an article.

Safe example

Component syntax can still be shown to readers as a code example:

import HeaderLink from '../../components/HeaderLink.astro';

<HeaderLink href="#">
  Embedded component example
</HeaderLink>

The fenced block above is displayed as text. It is not imported or executed by the published page.