`AssertionError` when parsing a page with raw HTML
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 74/100
Direzione di ricerca
Start from the traceback in markdown2.py: _hash_html_block_sub (the assert m is not None around line 927) called from _strict_tag_block_sub in _hash_html_blocks. Reproduce by feeding the pasted snippet to markdown() and confirm it fails on 2.5.5 but not 2.5.4; git log/bisect between those tags to find the regression commit. Done when the snippet parses with the HTML emitted unchanged and the existing test suite (e.g. tests/test_markdown2.py) still passes, ideally with a new regression test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
AssertionError when parsing a page with raw HTML
File "/Users/brass75/src/brassnet.biz/.venv/lib/python3.13/site-packages/render_engine_markdown/__init__.py", line 18, in parse
return markdown(
content,
extras=extras.get("markdown_extras", []) if extras else [],
)
File "/Users/brass75/src/brassnet.biz/.venv/lib/python3.13/site-packages/markdown2.py", line 210, in markdown
use_file_vars=use_file_vars, cli=cli).convert(text)
~~~~~~~^^^^^^
File "/Users/brass75/src/brassnet.biz/.venv/lib/python3.13/site-packages/markdown2.py", line 504, in convert
text = self._hash_html_blocks(text, raw=True)
File "/Users/brass75/src/brassnet.biz/.venv/lib/python3.13/site-packages/markdown2.py", line 255, in inner
text = func(md, text, *args, **kwargs)
File "/Users/brass75/src/brassnet.biz/.venv/lib/python3.13/site-packages/markdown2.py", line 991, in _hash_html_blocks
text = self._strict_tag_block_sub(text, self._block_tags_a, hash_html_block_sub)
File "/Users/brass75/src/brassnet.biz/.venv/lib/python3.13/site-packages/markdown2.py", line 1120, in _strict_tag_block_sub
block = callback(block.rstrip('\n')) # remove trailing newline
File "/Users/brass75/src/brassnet.biz/.venv/lib/python3.13/site-packages/markdown2.py", line 4417, in result
return function(*args + rest, **combined)
File "/Users/brass75/src/brassnet.biz/.venv/lib/python3.13/site-packages/markdown2.py", line 927, in _hash_html_block_sub
assert m is not None
^^^^^^^^^^^^^
AssertionError
To Reproduce
Since you've read this far I can assume that you're planning on attending PyCon US
this year. If you are planning on attending and enjoy baseball you might be interested in
coming with some folks to see either a Dodgers game ahead of the conference or an Angels
game after the first sprint day.
<blockquote class="mastodon-embed" data-embed-url="https://twit.social/@brass75/115486728122010385/embed"
style="background: #FCF8FF; border-radius: 8px; border: 1px solid #C9C4DA; margin: 0; max-width: 540px;
min-width: 270px; overflow: hidden; padding: 0;"> <a href="https://twit.social/@brass75/115486728122010385"
target="_blank" style="align-items: center; color: #1C1A25; display: flex; flex-direction: column;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell,
'Fira Sans', 'Droid Sans', 'Helvetica Neue', Roboto, sans-serif; font-size: 14px; justify-content: center;
letter-spacing: 0.25px; line-height: 20px; padding: 24px; text-decoration: none;">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"
viewBox="0 0 79 75"><path d="M63 45.3v-20c0-4.1-1-7.3-3.2-9.7-2.1-2.4-5-3.7-8.5-3.7-4.1 0-7.2 1.6-9.3
4.7l-2 3.3-2-3.3c-2-3.1-5.1-4.7-9.2-4.7-3.5 0-6.4 1.3-8.6 3.7-2.1 2.4-3.1 5.6-3.1 9.7v20h8V25.9c0-4.1
1.7-6.2 5.2-6.2 3.8 0 5.8 2.5 5.8 7.4V37.7H44V27.1c0-4.9 1.9-7.4 5.8-7.4 3.5 0 5.2 2.1 5.2
6.2V45.3h8ZM74.7 16.6c.6 6 .1 15.7.1 17.3 0 .5-.1 4.8-.1 5.3-.7 11.5-8 16-15.6 17.5-.1 0-.2 0-.3 0-4.9
1-10 1.2-14.9 1.4-1.2 0-2.4 0-3.6 0-4.8 0-9.7-.6-14.4-1.7-.1 0-.1 0-.1 0s-.1 0-.1 0 0 .1 0 .1 0 0 0
0c.1 1.6.4 3.1 1 4.5.6 1.7 2.9 5.7 11.4 5.7 5 0 9.9-.6 14.8-1.7 0 0 0 0 0 0 .1 0 .1 0 .1 0 0 .1 0 .1
0 .1.1 0 .1 0 .1.1v5.6s0 .1-.1.1c0 0 0 0 0 .1-1.6 1.1-3.7 1.7-5.6 2.3-.8.3-1.6.5-2.4.7-7.5 1.7-15.4
1.3-22.7-1.2-6.8-2.4-13.8-8.2-15.5-15.2-.9-3.8-1.6-7.6-1.9-11.5-.6-5.8-.6-11.7-.8-17.5C3.9 24.5 4 20
4.9 16 6.7 7.9 14.1 2.2 22.3 1c1.4-.2 4.1-1 16.5-1h.1C51.4 0 56.7.8 58.1 1c8.4 1.2 15.5 7.5 16.6 15.6Z"
fill="currentColor"/></svg> <div style="color: #787588; margin-top: 16px;">
Post by @[email protected]</div> <div style="font-weight: 500;">View on Mastodon</div> </a>
</blockquote> <script data-allowed-prefixes="https://twit.social/" async src="https://twit.social/embed.js"></script>
I hope to see you in Long Beach this May. And I hope you do take the plunge and submit
a talk.
Expected behavior
The included HTML is rendered unchanged.
Debug info
2.5.5 - this does not happen with 2.5.4
Any extras being used:
None.
Additional context
- Lingua principale
- Python
- Stelle
- 2.8k
- Fork
- 463
- Merge medio
- 2g 9h
- PR unite (30g)
- 8
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di trentm/python-markdown2
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
trentm/python-markdown2#733 · 1 commento ·
-
Add py.typed markerForse già presa @mac-agent l’ha presa 196 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
trentm/python-markdown2#696 ·
-
More XSS's in safe modeAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
trentm/python-markdown2#726 ·
-
markdown2 malformed HTML tokenizer CPU denial of serviceForse già presa @wolfgang-aura l’ha presa 5 giorni fa. ApertaBug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
trentm/python-markdown2#707 ·
-
Bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
trentm/python-markdown2#688 · 4 commenti ·
Tutte le issue di trentm/python-markdown2
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
vllm-project/vllm#61131 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
kubernetes-client/python#2735 ·
I maintainer di solito rispondono entro 1 giorno
-
desktop help wanted test
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Broken links found in docsApertadocs pydanty:is-working
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
pydantic/pydantic-ai#10113 ·
I maintainer di solito rispondono entro 1 giorno
-
Tutorial unit test leaks sample data into tutorial doctestForse già presa @Gambit-Checkmate l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100