diff --git a/README.md b/README.md index bb5b729..10f7a85 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,10 @@ The `index.md` page should use layout `home`, which is the layout that displays Another thing you can do to customize the index page is show the description of your blog between the title and the menu. To do this, just edit `config.toml` and change `params.theme_config.show_description` to `true`. +### Adding table of contents + +You can add a table of contents by supplying the `toc: true` param to your post front matter. If you want a border around it you can also set `tocBorder: true`. The toc style behavior is handled by Goldmark and the defaults can be found in the `config.toml` file. + ### Pro tips #### Dark mode for images diff --git a/assets/css/main.scss b/assets/css/main.scss index 47502b9..c8315c7 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -51,6 +51,11 @@ li { margin: 0.4rem 0; } padding: 4rem 2rem; } +.toc { + border: thin solid black; + padding: 1rem; +} + hr { text-align: center; border: 0; diff --git a/config.toml b/config.toml index b0b53d0..95ad262 100644 --- a/config.toml +++ b/config.toml @@ -23,6 +23,10 @@ noHl = false style = 'rrt' tabWidth = 4 + [markup.tableOfContents] + startLevel = 2 + endLevel = 3 + ordered = false [params] [params.theme_config] diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2cbaff8..a09cee2 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -10,6 +10,12 @@