Skip to content

Conversation

@waylan
Copy link
Member

@waylan waylan commented Jan 10, 2024

While the _ExtractTitleTreeprocessor already extracts text from the etree, postprocessors may add more markup. Therefore, markupsafe's striptags is used to ensure all markup is removed. Conveniently, markupsafe is already a dependency and available. Fixes #3357.

While the `_ExtractTitleTreeprocessor` already extracts text from the
etree, postprocessors may add more markup. Therefore, markupsafe's
`striptags`  is used to ensure all markup is removed. Conveniently,
`markupsafe` is already a dependency and available. Fixes mkdocs#3357.
@waylan
Copy link
Member Author

waylan commented Jan 10, 2024

Hmm, the failing lint check seems nonsensical to me. Not sure what to do there.

@ofek
Copy link
Contributor

ofek commented Jan 10, 2024

The suggestion is correct because that is a third party package and currently it is in the standard library block.

pg.read_source(cfg)
pg.render(cfg, fl)
self.assertEqual(pg.title, '*Hello — beautiful world')
self.assertEqual(pg.title, '*Hello — beautiful world')
Copy link
Member Author

@waylan waylan Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced this behavior is desired here. I expect we do not want HTML entities to be unescaped. If so, we will need to clone the striptags function and eliminate the call to unescape. See this comment for more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Header and navigation sidebars display incorrectly arbitrary markup

2 participants