mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed rendering in blog plugin with markdown.extensions.toc
This commit is contained in:
parent
fe47f40a06
commit
6ee9df6e1a
@ -242,16 +242,21 @@ class Category(View):
|
|||||||
def _patch(config: MkDocsConfig):
|
def _patch(config: MkDocsConfig):
|
||||||
config = copy(config)
|
config = copy(config)
|
||||||
|
|
||||||
# Copy configuration that needs to be patched
|
# Copy parts of configuration that needs to be patched
|
||||||
config.validation = copy(config.validation)
|
config.validation = copy(config.validation)
|
||||||
config.validation.links = copy(config.validation.links)
|
config.validation.links = copy(config.validation.links)
|
||||||
|
config.markdown_extensions = copy(config.markdown_extensions)
|
||||||
config.mdx_configs = copy(config.mdx_configs)
|
config.mdx_configs = copy(config.mdx_configs)
|
||||||
config.mdx_configs["toc"] = copy(config.mdx_configs.get("toc", {}))
|
|
||||||
|
# Make sure that the author did not add another instance of the table of
|
||||||
|
# contents extension to the configuration, as this leads to weird behavior
|
||||||
|
if "markdown.extensions.toc" in config.markdown_extensions:
|
||||||
|
config.markdown_extensions.remove("markdown.extensions.toc")
|
||||||
|
|
||||||
# In order to render excerpts for posts, we need to make sure that the
|
# In order to render excerpts for posts, we need to make sure that the
|
||||||
# table of contents extension is appropriately configured
|
# table of contents extension is appropriately configured
|
||||||
config.mdx_configs["toc"] = {
|
config.mdx_configs["toc"] = {
|
||||||
**config.mdx_configs["toc"],
|
**config.mdx_configs.get("toc", {}),
|
||||||
**{
|
**{
|
||||||
"anchorlink": True, # Render headline as clickable
|
"anchorlink": True, # Render headline as clickable
|
||||||
"baselevel": 2, # Render h1 as h2 and so forth
|
"baselevel": 2, # Render h1 as h2 and so forth
|
||||||
|
@ -242,16 +242,21 @@ class Category(View):
|
|||||||
def _patch(config: MkDocsConfig):
|
def _patch(config: MkDocsConfig):
|
||||||
config = copy(config)
|
config = copy(config)
|
||||||
|
|
||||||
# Copy configuration that needs to be patched
|
# Copy parts of configuration that needs to be patched
|
||||||
config.validation = copy(config.validation)
|
config.validation = copy(config.validation)
|
||||||
config.validation.links = copy(config.validation.links)
|
config.validation.links = copy(config.validation.links)
|
||||||
|
config.markdown_extensions = copy(config.markdown_extensions)
|
||||||
config.mdx_configs = copy(config.mdx_configs)
|
config.mdx_configs = copy(config.mdx_configs)
|
||||||
config.mdx_configs["toc"] = copy(config.mdx_configs.get("toc", {}))
|
|
||||||
|
# Make sure that the author did not add another instance of the table of
|
||||||
|
# contents extension to the configuration, as this leads to weird behavior
|
||||||
|
if "markdown.extensions.toc" in config.markdown_extensions:
|
||||||
|
config.markdown_extensions.remove("markdown.extensions.toc")
|
||||||
|
|
||||||
# In order to render excerpts for posts, we need to make sure that the
|
# In order to render excerpts for posts, we need to make sure that the
|
||||||
# table of contents extension is appropriately configured
|
# table of contents extension is appropriately configured
|
||||||
config.mdx_configs["toc"] = {
|
config.mdx_configs["toc"] = {
|
||||||
**config.mdx_configs["toc"],
|
**config.mdx_configs.get("toc", {}),
|
||||||
**{
|
**{
|
||||||
"anchorlink": True, # Render headline as clickable
|
"anchorlink": True, # Render headline as clickable
|
||||||
"baselevel": 2, # Render h1 as h2 and so forth
|
"baselevel": 2, # Render h1 as h2 and so forth
|
||||||
|
Loading…
Reference in New Issue
Block a user