Skip to content

Fix issue with handling </>#4007

Closed
facelessuser wants to merge 2 commits intomkdocs:masterfrom
facelessuser:bugfix/bad-tag
Closed

Fix issue with handling </>#4007
facelessuser wants to merge 2 commits intomkdocs:masterfrom
facelessuser:bugfix/bad-tag

Conversation

@facelessuser
Copy link
Contributor

@facelessuser facelessuser commented Jul 2, 2025

Markdown recently made a fix for an issue handling </> which would get stripped out of content. Reference:
Python-Markdown/markdown@64a3c0f

MkDocs uses Markdown's monkey-patched HTMLParser, but does not use the HTML extractor that has the logic to handle the things that have been monkey-patched in. Because of this, MkDocs now fails when parsing </>. This fixes the issue by adding the same logic to handle the issue that Markdown uses.

Fixes #4001

Markdown recently made a fix for an issue handling `</>` which would get
stripped out of content. Reference:
Python-Markdown/markdown@64a3c0f

MkDocs uses Markdown's monkey-patched HTMLParser, but does not use the
HTML extractor that has the logic to handle the things that have been
monkey-patched in. Because of this, MkDocs now fails when parsing
`</>`. This fixes the issue by adding the same logic to handle the issue
that Markdown uses.
@facelessuser
Copy link
Contributor Author

This fixes #4001

@facelessuser
Copy link
Contributor Author

@tomchristie is this project still being maintained? I'd love to see this bug fix get merged and released.

@maxpollack
Copy link

+1, this broke our team's internal docs build. can this get merged?

@facelessuser
Copy link
Contributor Author

It seems I am unable to push this forward. I am willing to provide changes and updates if the Mkdocs team is willing to engage. If not, I guess we are not getting this fix.

@Guts
Copy link

Guts commented Nov 6, 2025

I guess we should ping @lovelydinosaur

@thomasborgen
Copy link

We also need this fix 🙏🏼

@SOV710
Copy link

SOV710 commented Jan 15, 2026

This bug is breaking our documentation. MkDocs team, would it be possible to merge this PR and release 6.1.2? Much appreciated!

@facelessuser
Copy link
Contributor Author

I had to fix some other HTML issues in Python Markdown. Because it broke MkDocs for Python Markdown, I had to resort to hackery. The good news is that the next Python Markdown, will fix this issue for MkDocs. PR is here: Python-Markdown/markdown#1593.

@mschoettle
Copy link

@facelessuser Thanks a lot! I just updated markdown to 3.10.2 and </> now renders as is 👍

@facelessuser
Copy link
Contributor Author

Yep, it was one of those things; it hadn't occurred to me that it could be fixed in Python Markdown. I'd argue it shouldn't have had to be fixed there, but necessity is the mother of invention. When Python Markdown, which uses MkDocs as its documentation engine, was now breaking due to this, a solution became necessary.

@facelessuser
Copy link
Contributor Author

This isn't needed anymore, as a fix that works here is available in the latest Python Markdown directly.

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.

AssertionError: we should not get here! from html.parser with Python 3.13.5

6 participants