Skip to content

Commit 676b33a

Browse files
authored
Update in-page.md with more explicit directions for using {:toc} (just-the-docs#1551)
Fixes just-the-docs#1536.
1 parent 31f5744 commit 676b33a

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ Code changes to `main` that are *not* in the latest release:
2323
Docs changes made since the latest release:
2424

2525
- Fixed: incorrect docs for example with minimal layout parent, default layout child by [@janbrasna] in [#1540]
26+
- Fixed: unclear docs on using in-page table of contents by [@sebjameswml] in [#1551]
2627

2728
[@janbrasna]: https://github.com/janbrasna
29+
[@sebjameswml]: https://github.com/sebjameswml
2830

2931
[#1461]: https://github.com/just-the-docs/just-the-docs/pull/1461
3032
[#1540]: https://github.com/just-the-docs/just-the-docs/pull/1540
33+
[#1551]: https://github.com/just-the-docs/just-the-docs/pull/1551
3134
[#1590]: https://github.com/just-the-docs/just-the-docs/pull/1590
3235

3336
## Release v0.10.0

docs/navigation/in-page.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@ To support in-page navigation, you can generate a *Table of Contents* (TOC) with
1919

2020
To generate a *Table of Contents* in a page, you use Kramdown's `{:toc}` method, immediately after the start of a list. This will automatically generate a list of anchor links to various sections of the page, based on headings and heading levels.
2121

22+
{: .note }
23+
`{:toc}` can be used only once on each page.
24+
25+
You **must** have a list immediately preceding the table of contents. The type of list determines the style of your table of contents.
26+
27+
For an *ordered* table of contents, use the following markdown code:
28+
29+
```md
30+
1. TOC
31+
{:toc}
32+
```
33+
34+
The `{:toc}` line *must* follow the `1. TOC` line, which begins a list.
35+
36+
For an *unordered* table of contents, instead use the following markdown code:
37+
38+
```
39+
- TOC
40+
{:toc}
41+
```
42+
2243
## Omitting Heading from Table of Contents
2344

2445
If you want to omit a particular heading from the TOC, follow it immediately by `{: .no_toc }` (possibly together with other CSS class names).
@@ -36,8 +57,6 @@ If you want to omit a particular heading from the TOC, follow it immediately by
3657

3758
This example omits the top-level heading (`In-Page Navigation`) from the TOC, as well as the heading for the *Table of Contents* itself.
3859

39-
To get an unordered list, replace `1. TOC` by `- TOC` in the above example.
40-
4160
## Collapsible Table of Contents (with `<details>` and `<summary>`)
4261

4362
You can make the Table of Contents collapsible using the `<details>` and `<summary>` elements, as in the following example.
@@ -55,9 +74,6 @@ You can make the Table of Contents collapsible using the `<details>` and `<summa
5574

5675
The attribute `open` (which expands the Table of Contents by default) and the styling (here with `text-delta`) are optional.
5776

58-
{: .note }
59-
`{:toc}` can be used only once on each page.
60-
6177
## Back to Top {#back-to-top-doc}
6278

6379
{: .warning }

0 commit comments

Comments
 (0)