Prochain événement : cours découverte - le 9 juin de 19h à 20hProchain événement : cours découverte - le 9 juin de 19h à 20h
Bloc Spot
SalleÉcoleFalaiseEntreprisesAgendaTarifsMerchÀ proposContact
Y aller
Agenda
SalleÉcoleFalaiseEntreprises
TarifsMerchÀ proposContact
Y aller
SalleÉcoleFalaiseEntreprisesAgendaTarifsMerchÀ proposContact
Components/Markdown Components

API

  • POSTCreate Testimonial
  • GETList Testimonials

Components

  • Auth Components
  • Contact Components
  • Dialog Manager
  • Layout Components
  • Markdown Components

Developer

  • Safe Actions
  • Zod Route

Guide

  • Getting Started
  • Embedding Testimonials

Markdown Components

Client and server markdown rendering components with MDX support

If you need to render Markdown in our React application, you can easily do so with the two components provided.

ClientMarkdown

This component allows you to display Markdown client-side, meaning it is not rendered server-side. It uses the markdown-to-jsx library to parse and render Markdown.

import { ClientMarkdown } from "@/features/markdown/client-markdown";

const markdown = `
# Hello World

This is a paragraph

- Item 1
- Item 2
- Item 3
`;

export default function App() {
  return <ClientMarkdown>{markdown}</ClientMarkdown>;
}

Props

  • children: string - The Markdown content to render
  • className?: string - Custom CSS classes (replaces the default typography class)
  • All other markdown-to-jsx props are supported

Default Styling

By default, this component applies the typography class. You can replace it by passing a className prop to the component.

ServerMdx

This component allows you to display Markdown server-side, meaning the HTML is generated server-side and the client only receives the final render.

Why Mdx? Because this component supports mdx syntax, which is a markdown extension allowing you to add React components in Markdown.

import { ServerMdx } from "@/features/markdown/server-mdx";

const markdown = `
# Hello World

This is a paragraph

<Alert type="info">
  This is an information message
</Alert>
`;

export default async function Page() {
  return <ServerMdx source={markdown} />;
}

Props

  • source: string - The MDX content to render
  • className?: string - Custom CSS classes (applied to the wrapper div, added to the default typography class)

Adding Custom React Components

By default, no React components are supported. To add them, you need to modify the src/features/markdown/server-mdx.tsx file:

import { Alert } from "@/components/nowts/alert";

const MdxComponent = {
  Alert: Alert,
  // Add other components here
} satisfies Record<string, React.ComponentType>;

Complete example with an Alert component:

# My Document

This is a normal paragraph.

<Alert type="info">This is an information message</Alert>

FAQ

When should I use ServerMdx vs ClientMarkdown?

  • Use ServerMdx when:

    • You need to integrate custom React components in your Markdown
    • You want rendering to be done server-side (better for performance)
    • You need MDX
  • Use ClientMarkdown when:

    • You have basic Markdown without React components
    • You're rendering Markdown content dynamically client-side

Can I use React components in ClientMarkdown?

No, ClientMarkdown only supports basic Markdown. To integrate React components, you must use ServerMdx.

Layout ComponentsSafe Actions

On This Page

ClientMarkdownPropsDefault StylingServerMdxPropsAdding Custom React ComponentsFAQWhen should I use ServerMdx vs ClientMarkdown?Can I use React components in ClientMarkdown?
Bloc SpotBloc Spot

Salle d'escalade de bloc à Angoulême. 800 m², 190 voies, ouverte 7j/7 dès 4 ans.

★Laisser un avis Google
Activités
La salle d'escaladeÉcole d'escaladeFalaise avec BrunoAgenda & événementsTeam buildingAnniversaires
Infos
Tarifs & abonnementsMerch & producteurs locauxÀ proposInfos pratiques
Nous trouver
144 Route de Vars
16160 Gond-Pontouvre
Horaires
Lun – Ven9h – 23h
Sam – Dim9h – 21h
07 49 39 93 43blocspot.16@gmail.com
© 2026 Bloc Spot — OSPOT AngoulêmeMentions légalesConfidentialitéCGV
Codé avec cœur parSocial Sphère