Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix markdown parser crash on emphasized text inside HTML tags#2166

Merged
UlrichB22 merged 1 commit into
moinwiki:masterfrom
apoorvdarshan:fix/1838-markdown-emphasis-in-html-tags
Feb 23, 2026
Merged

Fix markdown parser crash on emphasized text inside HTML tags#2166
UlrichB22 merged 1 commit into
moinwiki:masterfrom
apoorvdarshan:fix/1838-markdown-emphasis-in-html-tags

Conversation

@apoorvdarshan

Copy link
Copy Markdown
Contributor

Summary

  • Fixes Markdown parser crashes on emphasized text in deleted text in list item #1838: IndexError: pop from empty list when markdown like * <del>Deleted list item with _emphasized text_</del> is rendered
  • Adds a reassembly step that detects HTML tags split by markdown's inline pattern processor and wraps the fragments + intervening elements into proper DOM nodes before convert_embedded_markup processes them
  • Adds test cases for <del>, <ins>, and <kbd> with inline markdown emphasis/strong, plus a regression test for non-split HTML tags

Test plan

  • All 63 markdown_in tests pass (including 4 new tests)
  • All 71 markdown roundtrip tests pass
  • All 1132 converter tests pass with 0 regressions

@UlrichB22 UlrichB22 marked this pull request as draft February 17, 2026 16:35
@UlrichB22

Copy link
Copy Markdown
Collaborator

@apoorvdarshan, thanks for your support of the moin2 project.

There has been a lint failure for markdown_in.py. Can you have a look at the logs?

We recommend installing the pre-commit hook as described in the development documentation to avoid failed checks, please see https://moin-20.readthedocs.io/en/latest/devel/development.html#install-pre-commit-hooks

…ki#1838)

Reassemble raw HTML tags that get split by markdown's inline pattern
processor when inline syntax (e.g. _emphasis_) appears inside HTML
tags (e.g. <del>), preventing IndexError crash in convert_embedded_markup.
@apoorvdarshan apoorvdarshan force-pushed the fix/1838-markdown-emphasis-in-html-tags branch from d504946 to 9a89c00 Compare February 23, 2026 22:01
@apoorvdarshan apoorvdarshan marked this pull request as ready for review February 23, 2026 22:02
@apoorvdarshan apoorvdarshan force-pushed the fix/1838-markdown-emphasis-in-html-tags branch from 0e960bd to 9a89c00 Compare February 23, 2026 22:03
@apoorvdarshan

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I've fixed the black formatting issue in the test file and force-pushed the fix.

@UlrichB22 UlrichB22 merged commit 9513308 into moinwiki:master Feb 23, 2026
19 checks passed
gmilde added a commit to gmilde/moin that referenced this pull request Feb 25, 2026
Additional tests for PR moinwiki#2166
Some valid use cases still fail.

TODO: fix behaviour and move samples to the non-failing tests.
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.

Markdown parser crashes on emphasized text in deleted text in list item

2 participants