`AssertionError` when parsing a page with raw HTML
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 74/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 2.8k
- Forks
- 463
- Merge medio
- 2 d 9 h
- PR fusionados (30 d)
- 8
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de trentm/python-markdown2
-
Reference links do not translateAbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
trentm/python-markdown2#733 · 1 comentario ·
-
Add py.typed markerPosiblemente ocupada @mac-agent la tomó hace 196 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
trentm/python-markdown2#696 ·
-
More XSS's in safe modeAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
trentm/python-markdown2#726 ·
-
markdown2 malformed HTML tokenizer CPU denial of servicePosiblemente ocupada @wolfgang-aura la tomó hace 5 días. AbiertoBug
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
trentm/python-markdown2#707 ·
-
Bug
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
trentm/python-markdown2#688 · 4 comentarios ·
Todos los issues de trentm/python-markdown2
Issues similares
-
comp/gateway comp/plugins duplicate P3 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NousResearch/hermes-agent#137019 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bot-triaged module: docs triaged
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
new-entry
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
BinWang28/audio-ai-hub#194 ·
-
confluence: a paged listing's links re-encode a parameter they carry, where real carries it as sentAbiertofidelity
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
Los mantenedores suelen responder en 1 día