Skip to content

Loading multiple Markdown files and rendering them into one React component #108

Answered by lazarv
nickw1 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @nickw1,

your project looks very interesting and thanks for including react-server as an RSC introductory framework!

Right now native Markdown/MDX support is restricted only to pages when using the file-system based router. But as react-server is using Vite, you can just use the same Vite plugin the framework uses to transform any MDX to React components. react-server is using @mdx-js/rollup and together with some awesome Remark of Rehype plugins it can be very nice. While the official documentation at https://mdxjs.com/packages/rollup/ is for Rollup, but it works with Vite too.

// vite.config.mjs
import { defineConfig } from "vite";
import mdx from "@mdx-js/rollup";

export default de…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nickw1
Comment options

Answer selected by nickw1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants