.md Extension

Access documentation pages as raw Markdown by appending .md or .mdx to any URL

Geistdocs includes a built-in feature that allows AI tools and language models to access your documentation as plain Markdown. Simply append .mdx to any documentation page URL to get the processed Markdown content.

How It Works

When you add .md or .mdx to any documentation URL, you get back the page content as plain text Markdown instead of the rendered HTML. This makes it easy for AI tools to read and understand your documentation.

Example

# Normal page
https://yourdomain.com/docs/getting-started

# Markdown version
https://yourdomain.com/docs/getting-started.mdx

The .mdx version returns:

  • The page title as an H1 heading
  • The full processed Markdown content
  • No HTML, styling, or navigation

Use Cases

This feature is particularly useful for:

  • AI Chat Tools - Tools like ChatGPT, Claude, and Cursor can fetch and read your docs
  • LLM Context - Provides clean text for language model prompts
  • Documentation Analysis - Extract content for processing or analysis
  • Content Migration - Export documentation in a clean format

Implementation

The feature uses a Next.js rewrite rule to route .mdx requests to a special endpoint:

next.config.ts

async rewrites() {
  return [
    {
      source: "/docs/:path*.mdx",
      destination: "/llms.mdx/:path*",
    },
  ];
}

The endpoint processes the page and returns plain Markdown with a text/markdown content type.

Response Format

The response includes:

  • Content-Type: text/markdown
  • The page title as a level 1 heading
  • Processed Markdown content from Fumadocs

All MDX components are processed and converted to plain Markdown equivalents.

On this page