Skip to content

Commit 08648ce

Browse files
authored
Merge pull request #136 from Xiaokang2022/master
feat: use the value provided by markdown extensions as the default value for the table of contents title (#131)
2 parents 8a5712e + 8d3dfb9 commit 08648ce

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/mkdocs_print_site_plugin/plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class PrintSitePlugin(BasePlugin):
2929
("print_page_title", config_options.Type(str, default="Print Site")),
3030
("print_page_basename", config_options.Type(str, default="print_page")),
3131
("add_table_of_contents", config_options.Type(bool, default=True)),
32-
("toc_title", config_options.Type(str, default="Table of Contents")),
32+
("toc_title", config_options.Type(str, default=None)),
3333
("toc_depth", config_options.Type(int, default=3)),
3434
("add_full_urls", config_options.Type(bool, default=False)),
3535
("enumerate_headings", config_options.Type(bool, default=True)),
@@ -59,6 +59,11 @@ def on_config(self, config, **kwargs):
5959
assert self.config.get("enumerate_headings_depth") >= 1
6060
assert self.config.get("enumerate_headings_depth") <= 6
6161

62+
# If the user does not specify a value for the item
63+
if self.config.get("toc_title") is None:
64+
self.config["toc_title"] = config.get(
65+
"mdx_configs", {}).get("toc", {}).get("title", "Table of Contents")
66+
6267
# Because other plugins can alter the navigation
6368
# (and thus which pages should be in the print page)
6469
# it is important 'print-site' is defined last in the 'plugins'

0 commit comments

Comments
 (0)