From 63052bc1be0a06fee8578c7dc2b508f971589dca Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Wed, 2 Aug 2023 11:45:35 +0200 Subject: [PATCH] Correct detection of dropping anchorlink from page title (#3325) --- mkdocs/structure/pages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs/structure/pages.py b/mkdocs/structure/pages.py index 34c0bc76..e42faffc 100644 --- a/mkdocs/structure/pages.py +++ b/mkdocs/structure/pages.py @@ -437,7 +437,7 @@ class _ExtractTitleTreeprocessor(markdown.treeprocessors.Treeprocessor): for el in root: if el.tag == 'h1': # Drop anchorlink from the element, if present. - if len(el) > 0 and el[-1].tag == 'a' and not (el.tail or '').strip(): + if len(el) > 0 and el[-1].tag == 'a' and not (el[-1].tail or '').strip(): el = copy.copy(el) del el[-1] # Extract the text only, recursively.