mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
docs: editorial fixes (#6889)
This commit is contained in:
parent
63caeb6073
commit
2648ec090e
11 changed files with 134 additions and 116 deletions
|
@ -7,15 +7,11 @@ slug: /markdown-features/inline-toc
|
|||
|
||||
import BrowserWindow from '@site/src/components/BrowserWindow';
|
||||
|
||||
Each Markdown document displays a tab of content on the top-right corner.
|
||||
|
||||
But it is also possible to display an inline table of contents directly inside a markdown document, thanks to MDX.
|
||||
Each Markdown document displays a table of contents on the top-right corner. But it is also possible to display an inline table of contents directly inside a markdown document, thanks to MDX.
|
||||
|
||||
## Full table of contents {#full-table-of-contents}
|
||||
|
||||
The `toc` variable is available in any MDX document and contains all the headings of an MDX document.
|
||||
|
||||
By default, only `h2` and `h3` headings are displayed in the TOC. You can change which heading levels are visible by setting `minHeadingLevel` or `maxHeadingLevel`.
|
||||
The `toc` variable is available in any MDX document and contains all the headings of an MDX document. By default, only `h2` and `h3` headings are displayed in the TOC. You can change which heading levels are visible by setting `minHeadingLevel` or `maxHeadingLevel` for individual `TOCInline` components.
|
||||
|
||||
```jsx
|
||||
import TOCInline from '@theme/TOCInline';
|
||||
|
@ -27,9 +23,7 @@ import TOCInline from '@theme/TOCInline';
|
|||
import TOCInline from '@theme/TOCInline';
|
||||
|
||||
<BrowserWindow>
|
||||
|
||||
<TOCInline toc={toc} />
|
||||
|
||||
</BrowserWindow>
|
||||
```
|
||||
|
||||
|
@ -53,12 +47,19 @@ import TOCInline from '@theme/TOCInline';
|
|||
<TOCInline
|
||||
// Only show h2 and h4 headings
|
||||
toc={toc.filter((node) => node.level === 2 || node.level === 4)}
|
||||
minHeadingLevel={2}
|
||||
// Show h4 headings in addition to the default h2 and h3 headings
|
||||
maxHeadingLevel={4}
|
||||
/>;
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
<BrowserWindow>
|
||||
<TOCInline toc={toc.filter((node) => node.level === 2 || node.level === 4)} />
|
||||
<TOCInline
|
||||
toc={toc.filter((node) => node.level === 2 || node.level === 4)}
|
||||
minHeadingLevel={2}
|
||||
maxHeadingLevel={4}
|
||||
/>
|
||||
</BrowserWindow>
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue