Write content with Markdown and MDX

MDX allows you to use JSX directly within your Markdown content. You write the text in Markdown, which is quicker than HTML for headings, lists or emphasis, and import JSX components wherever you need dynamic content.

How do I configure MDX for Jeasx? If you want to use MDX with Jeasx, simply run npm install @mdx-js/esbuild and add the configuration below to ESBUILD_SERVER_OPTIONS in jeasx.config.js. Visit jeasx.dev/jsx to learn how to enhance MDX with additional plugins.

export default {
  // The server imports this config at startup too, so import build-only plugins lazily.
  /** @type {() => Promise<import("esbuild").BuildOptions>} */
  ESBUILD_SERVER_OPTIONS: async () => {
    const { default: mdx } = await import("@mdx-js/esbuild");
    return {
      plugins: [
        mdx({
          development: process.env.NODE_ENV === "development",
          jsxImportSource: "jsx-async-runtime",
          elementAttributeNameCase: "html",
          stylePropertyNameCase: "css",
        }),
      ],
    };
  },
};

The MDX cookbook

These recipes are loaded from an API while the page is rendered. Pick one: the link sets ?recipe=, which MDX reads via props.request.query, just like in any other JSX route.

Vegetarian Stir-Fry

★★★★★

26 reviews · ⏱ 35 min · 👥 3 servings · 🔥 250 kcal ·

Medium

Ingredients

Tick them off while you shop; plain checkboxes and CSS, no JavaScript needed.

Instructions

  1. In a wok, heat sesame oil over medium-high heat.
  2. Add minced ginger and garlic, sauté until fragrant.
  3. Add cubed tofu and stir-fry until golden brown.
  4. Add broccoli, carrots, and bell peppers. Cook until vegetables are tender-crisp.
  5. Pour soy sauce over the stir-fry and toss to combine.
  6. Serve over cooked rice.