component to allow prefetching and avoid hard-reload.
External links will get the default
rel="noreferrer noopener" target="_blank"
attributes for security.
[My Link](https://github.github.com/gfm)This also works: https://github.github.com/gfm.
MDX
MDX is a superset of Markdown, with support of JSX syntax.
It allows you to import components, and use them right in the document, or even export values.
import { Component } from './component';<Component name="Hello" />
Useful for adding links, it is included by default.
<Cards> <Card href="https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating" title="Fetching, Caching, and Revalidating" > Learn more about caching in Next.js </Card></Cards>
An anchor is automatically applied to each heading, it sanitizes invalid characters like spaces. (e.g.
Hello World
to
hello-world
)
# Hello `World`
TOC Settings
The table of contents (TOC) will be generated based on headings, you can also customise the effects of headings:
# Heading [!toc]This heading will be hidden from TOC.# Another Heading [toc]This heading will **only** be visible in TOC, you can use it to add additional TOC items.Like headings rendered in a React component:<MyComp />
Custom Anchor
You can add
[#slug]
to customise heading anchors.
# heading [#my-heading-id]
You can also chain it with TOC settings like:
# heading [toc] [#my-heading-id]
To link people to a specific heading, add the heading id to hash fragment:
/page#my-heading-id
.
Frontmatter
We support YAML frontmatter. It is a way to specify common information of the document (e.g. title).
Place it at the top of document.
---title: Hello World---## Title
See Page Conventions for a list of properties available for frontmatter.
Codeblock
Syntax Highlighting is supported by default using Rehype Code.