Skip to content

Commit

Permalink
better dogfooding case
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Jan 18, 2024
1 parent 04636de commit 1e00363
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SecondLevelPartial from './_second-level-partial.mdx';

## This is a first level partial
## 1st level partial

I'm 1 level deep.

Expand Down
19 changes: 19 additions & 0 deletions website/_dogfooding/_docs tests/tests/toc-partials/_partial.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Partial

Partial intro

### Partial Sub Heading 1

Partial Sub Heading 1 content

#### Partial Sub Sub Heading 1

Partial Sub Sub Heading 1 content

### Partial Sub Heading 2

Partial Sub Heading 2 content

#### Partial Sub Sub Heading 2

Partial Sub Sub Heading 2 content
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### 2nd level partial

I'm 2 levels deep.
46 changes: 46 additions & 0 deletions website/_dogfooding/_docs tests/tests/toc-partials/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import Partial from './_partial.mdx';

# TOC partial test

This page tests that MDX-imported content appears correctly in the table-of-contents

See also:

- https://github.com/facebook/docusaurus/issues/3915
- https://github.com/facebook/docusaurus/pull/9684

---

**The table of contents should include headings of this partial**:

<Partial />

---

**We can import the same partial using a different name and it still works**:

import WeirdLocalName from './_partial.mdx';

<WeirdLocalName />

---

**We can import a partial and not use it, the TOC remains unaffected**:

import UnusedPartial from './_partial.mdx';

---

import FirstLevelPartial from './_first-level-partial.mdx';

**It also works for partials importing other partials**

<FirstLevelPartial />

---

**And we can even use the same partial twice!**

**(although it's useless and not particularly recommended because headings will have the same ids)**

<FirstLevelPartial />

This file was deleted.

3 changes: 0 additions & 3 deletions website/_dogfooding/_docs tests/toc-partials/_partial.mdx

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions website/_dogfooding/_docs tests/toc-partials/index.mdx

This file was deleted.

1 change: 0 additions & 1 deletion website/_dogfooding/docs-tests-sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ const sidebars = {
},
],
},
'toc-partials/index',
{
type: 'category',
label: 'HTML items tests',
Expand Down

0 comments on commit 1e00363

Please sign in to comment.