zachleat’s avatarzachleat’s Twitter Archive—№ 44,483

  1. …in reply to @jpcafe10
    @jpcafe10 @remix_run well now I’m doubting our conclusion here after reading this remix.run/docs/en/v1/guides/mdx which seems to describe the exact use case I benchmarked
    While we believe that a strong separation of data and display is important, we understand that formats that mix the two such as MDX (Markdown with embedded JSX components) have become a popular and powerful authoring format for developers.

Rather than compiling your content at build-time like this document demonstrates, it's typically better UX and DX if you do this at runtime via something like mdx-bundler. It's also much more customizable and powerful. However, if you prefer to do this compilation at build-time, continue reading.

Remix has built-in support for using MDX at build-time in two ways:

    You can use a .mdx file as one of your route modules
    You can import a .mdx file into one of your route modules (in app/routes)

Routes

The simplest way to get started with MDX in Remix is to create a route module. Just like .js and .ts files in your app/routes directory, .mdx (and .md) files will participate in automatic file system based routing.