.mdx files combine standard Markdown syntax with embedded React/JSX components. slugtree automatically parses frontmatter, extracts headings for table of contents, and indexes content for full-text search.

---
title: Routing Guide
description: Learn how dynamic routing works in our documentation.
icon: Route
---

# Routing Guide

This is standard markdown with a custom component:

<Callout type="info">
  Make sure your routes match the folder hierarchy.
</Callout>

Frontmatter Fields

FieldTypeRequiredDescription
titlestringNoDisplay name of the page. Fallback is title-cased filename.
descriptionstringNoShort summary for meta tags and search descriptions.
iconstringNoIcon identifier string.
hrefstringNoCustom URL override (useful for external links or redirects).

Any custom frontmatter fields you add are preserved and queryable via getNodesByFrontMatter() or getNodeData().frontMatter.

Heading Extraction (TOC)

All Markdown headings (#, ##, ###) are extracted into structured table of contents items accessible with getNodeToc():

import { getNodeToc } from 'slugtree'

const toc = getNodeToc(['guides', 'routing'])
// [{ id: 'routing-guide', text: 'Routing Guide', depth: 1 }]