MDX Example

Lorem ipsum dolor sit amet

Lorem ipsum dolor sit amet

MDX is a special flavor of Markdown that supports embedded JavaScript & JSX syntax. This unlocks the ability to mix JavaScript and UI Components into your Markdown content for things like interactive charts or alerts.

internal-link

external-link

If you have existing content authored in MDX, this integration will hopefully make migrating to Astro a breeze.

Example

example.ts
example.rb
some-file.rb
const x = 1;

export default function() {
  return <div>{x}</div>;
}
x = 1
def some_function(**args)
  args[:foo]
end
bash-product
$ cat $(find . -name "*.js" | grep -v "bundle") | esbuild --bundle --minify > bundle.js

Output


console.log("Hello, world");
Photo of Steve
some caption

Here is how you import and use a UI component inside of MDX. When you open this page in the browser, you should see the clickable button below.


🗣️ Send me a howler

Have a comment on this post, something to point out, or just want to say hi? Take a deep breath, count to ten, and then put it in writing to stevendcoffey@gmail.com 😌


Footnotes