diff options
author | 2021-04-01 16:48:50 +0800 | |
---|---|---|
committer | 2021-04-01 18:04:14 +0800 | |
commit | ffad966760d99d5ed18c6187415712635d9b1cc4 (patch) | |
tree | 4deb65444ad2be42f5ab29bf3ccacf3233b3b644 /pydis_site/apps | |
parent | Place category pages in the same directory as categories. (diff) |
Document defining a table of contents for a page.
Diffstat (limited to 'pydis_site/apps')
-rw-r--r-- | pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md b/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md index 51f1097d..0bf5aa27 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md @@ -82,6 +82,7 @@ Pages, which include guides, articles, and other static content,... - **icon:** Icon for the category entry for the page. Default: `fab fa-python` <i class="fab fa-python is-black" aria-hidden="true"></i> - **relevant_links:** A YAML dictionary containing `text:link` pairs. See the example above. - **toc:** A number representing the smallest heading tag to show in the table of contents. + See: [Table of Contents](#table-of-contents) ## Extended Markdown @@ -187,3 +188,29 @@ To add an image caption, place a sentence with italics *right below* the image l *Summer Code Jam 2020 banner with event information.* > Note: To display a regular italicized line below an image, leave an empty line between the two. + +--- + +### Table of Contents +In order to show the table of contents on a page, simply define the `toc` key in the page metadata. + +The value of the `toc` key corresponds to the smallest heading to list in the table of contents. +For example, with markdown content like this: + +```markdown +# Header 1 +words +### Header 3 +more words +# Another Header 1 +## Header 2 +even more words +``` + +and `toc: 2` in the page metadata, only `Header 1`, `Another Header 1` and `Header 2` will be listed in the table of contents. + +To use a custom label in the table of contents for a heading, set the `data-toc-label` attribute in the heading line. See [HTML Attributes](#html-attributes) for more information. + +```markdown +# Header 1 {: data-toc-label="Header One" } +``` |