From 436fbad0d57dd27f3c085f548b722772aa0b3027 Mon Sep 17 00:00:00 2001 From: Tim Vink Date: Mon, 13 Sep 2021 15:31:49 +0200 Subject: [PATCH] The table of contents (when enabled) will now only be displayed in the print version --- docs/options.md | 2 +- mkdocs_print_site_plugin/css/print-site.css | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/options.md b/docs/options.md index 7e6118a..6b9bbe0 100644 --- a/docs/options.md +++ b/docs/options.md @@ -30,7 +30,7 @@ plugins: : Default is `'Print Site'`. When `add_to_navigation` is set to `true` this setting controls the name of the print page in the navigation of the site. This setting is ignored when `add_to_navigation` is set to `false`. `add_table_of_contents` -: Default is `true`. Adds a table of contents section at the beginning of the print page. +: Default is `true`. Adds a table of contents section at the beginning of the print page (in print version, not HTML version). `toc_title` : Default is `'Table of Contents'`. When `add_table_of_contents` is set to `true` this setting controls the name of the table of contents. This setting is ignored when `add_table_of_contents` is set to `false`. diff --git a/mkdocs_print_site_plugin/css/print-site.css b/mkdocs_print_site_plugin/css/print-site.css index d40a98f..e7515e7 100644 --- a/mkdocs_print_site_plugin/css/print-site.css +++ b/mkdocs_print_site_plugin/css/print-site.css @@ -196,6 +196,10 @@ div.print-site-add-full-url section.print-page a[href^="http"]::after{ /* Print site table of contents styling */ +/* Don't display the table of contents in HTML version */ +#print-page-toc { display: none } + + .print-page-toc-nav { padding-bottom: 2em; } @@ -321,6 +325,10 @@ For now, we added them for use only in the table of contents */ /* Remove print site banner */ #print-site-banner { display: none; } + /* display the table of contents in print version */ + #print-page-toc { display: block } + + /* Ensure all tabbed content is displayed and printed https://squidfunk.github.io/mkdocs-material/reference/content-tabs/ */ /* #print-site-page div.tabbed-content { display: block !important; } */