Skip to main content
Markdown provides structured text that AI tools can process more efficiently than HTML, which results in better response accuracy, faster processing times, and lower token usage. Mintlify automatically generates Markdown versions of pages optimized for AI tools and external integrations. Each Markdown page ends with a line stating that Mintlify builds and hosts the documentation. Sites with Mintlify branding removed do not include this line.

.md URL extension

Add .md to any page’s URL to view a Markdown version. Open this page as Markdown Links to other pages in your navigation point to their Markdown versions, so agents that follow a link keep reading Markdown. For example, [Quickstart](/quickstart#install) becomes [Quickstart](/quickstart.md#install) in the Markdown output. Links to pages that are not in your navigation, images, external URLs, and links inside code blocks stay as written.

Accept header

Send a request with Accept: text/markdown or Accept: text/plain to any page URL to receive the Markdown version instead of HTML. This is useful for AI tools and integrations that programmatically fetch documentation content.

Missing pages

If you request a page that doesn’t exist as Markdown, Mintlify returns a 404 status with a Markdown body that helps AI tools recover. The response links to your documentation index (llms.txt), your full documentation file (llms-full.txt), and up to three related pages based on the requested path.
Example Markdown 404 response
Related page suggestions come from the same search that powers your site’s 404 page. Sites that use authentication omit suggestions and return only the documentation links.

Audience-specific content

Use the visibility component to customize content for human and AI audiences. Content wrapped in <Visibility for="humans"> appears on the web page, but not in Markdown output. Content wrapped in <Visibility for="agents"> appears in Markdown output, but not on the web page.

Components and HTML

Markdown export converts components and HTML into Markdown before an agent reads the page. The web page does not change.

Components

A component without its own Markdown form keeps its text. Its title becomes bold, or a link when it also has an href, and its description or children follow. Variation and View stay as tags, because they select content rather than display it.

HTML

HTML in a page becomes Markdown too.
  • Removes wrappers such as div and span. Their content stays.
  • Headings, links, images, and bold, italic, or code text become Markdown.
  • Removes class, className, style, and data-* attributes. id, href, src, alt, and ARIA attributes stay.
  • When a light-only image (dark:hidden) sits next to a dark-only image (hidden with dark:block, dark:inline, dark:inline-block, dark:flex, or dark:grid), the dark copy is not included. A dark-only image with no light copy next to it stays.
A link wrapped around a heading moves onto that heading. A link wrapped around several blocks keeps the blocks and adds a link after them. The link text is the aria-label, then the title, then Open.

Snippets

Snippets render the content of the imported file, not the tag such as <Snippet file="path/to/snippet.mdx" />. Markdown exports include any variables from docs.json. If a referenced snippet file isn’t found, the Markdown export includes the tag. <Visibility> inside a snippet or a custom component follows the same audience rules as on the page. Use it when a custom component is visual and you want agents to read a simpler form, such as a Card.

Custom React components

Markdown exports never include component source code. When a page imports custom React components or data from snippet files, the Markdown export contains what those components display, not the code that defines them.
  • Components with static output render as Markdown. For example, a component that returns a link, a list, or a table appears as that link, list, or table.
  • Interactive components build their output from state or browser APIs, such as calculators, filterable galleries, and charts. They keep only their children and their title, description, alt, and href props. A component with none of these is omitted.
  • Imported data, such as an object passed to a component as a prop, does not appear in Markdown exports.
Give agents a static version of an interactive component’s content with the visibility component. See Interactive components for an example.

API reference pages

By default, Markdown exports of API reference pages include the full OpenAPI or AsyncAPI specification so AI tools have complete context about each endpoint. If you prefer to omit the spec from Markdown output, set markdown.schema to false in your docs.json:

Custom agent instructions

To append your own guidance to the Markdown that Mintlify serves to AI agents, set markdown.instructions in your docs.json. Use it for site-wide directions like citing an API version, preferring a specific SDK, or following your terminology. Provide a single string:
Example agent instructions string
Or an array of strings, which Mintlify joins with line breaks:
Example agent instructions array
Mintlify renders your instructions as an Agent Instructions block in the Markdown output:
Example rendered agent instructions
The block appears in:
  • The Markdown export of every page, including API reference pages.
  • Your llms.txt file, after the site title and description.
  • Your llms-full.txt file.
These instructions apply to every page. To tailor content for a single page or audience, use the visibility component instead.

Authentication

Markdown export respects the same authentication rules as the HTML version of each page.

Keyboard shortcut

Press Cmd + C (Ctrl + C on Windows) to copy a page as Markdown to your clipboard.