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.

Chocolate Chip Cookies

★★★★★

13 reviews · ⏱ 25 min · 👥 24 servings · 🔥 150 kcal ·

Easy

Ingredients

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

Instructions

  1. Preheat the oven to 350°F (175°C).
  2. In a bowl, cream together softened butter, brown sugar, and white sugar.
  3. Beat in eggs one at a time, then stir in vanilla extract.
  4. Combine flour, baking soda, and salt. Gradually add to the wet ingredients.
  5. Fold in chocolate chips.
  6. Drop rounded tablespoons of dough onto ungreased baking sheets.
  7. Bake for 10-12 minutes or until edges are golden brown.
  8. Allow cookies to cool on the baking sheet for a few minutes before transferring to a wire rack.