` rather than the Markdown triple-backtick ` ``` `, because the latter will ship out any of its content as-is, but you want JSX to insert the imported text here.
:::
:::warning
This feature is experimental and might be subject to breaking API changes in the future.
:::
## Importing Markdown {#importing-markdown}
You can use Markdown files as components and import them elsewhere, either in Markdown files or in React pages.
By convention, using the **`_` filename prefix** will not create any doc page and means the markdown file is a **"partial"**, to be imported by other files.
```md title="_markdown-partial-example.mdx"
Hello {props.name}
This is text some content from `_markdown-partial-example.mdx`.
```
```jsx title="someOtherDoc.mdx"
import PartialExample from './_markdown-partial-example.mdx';
;
```
```mdx-code-block
import PartialExample from './_markdown-partial-example.mdx';
```
This way, you can reuse content among multiple pages and avoid duplicating materials.
:::caution
The table of contents does not currently contain the imported Markdown headings. This is a technical limitation that we are trying to solve ([issue](https://github.com/facebook/docusaurus/issues/3915)).
:::
## Available exports
Within the MDX page, the following variables are available as globals:
- `frontMatter`: the front matter as a record of string keys and values;
- `toc`: the table of contents, as a tree of headings. See also [Inline TOC](./markdown-features-inline-toc.mdx) for a more concrete use-case.
- `contentTitle`: the Markdown title, which is the first `h1` heading in the Markdown text. It's `undefined` if there isn't one (e.g. title specified in the front matter).
```jsx
import TOCInline from '@theme/TOCInline';
import CodeBlock from '@theme/CodeBlock';
The table of contents for this page, serialized:
{JSON.stringify(toc, null, 2)}
The front matter of this page:
{Object.entries(frontMatter).map(([key, value]) => - {key}: {value}
)}
The title of this page is: {contentTitle}
```
```mdx-code-block
import TOCInline from '@theme/TOCInline';
The table of contents for this page, serialized:
{JSON.stringify(toc, null, 2)}
The front matter of this page:
{Object.entries(frontMatter).map(([key, value]) => - {key}: {value}
)}
The title of this page is: {contentTitle}
```