Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Angle Brackets Bug

Aperta
#240 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Inizia dal punto di ingresso markdown2.markdown e riproduci la stringa fornita con safe_mode="escape" e safe_mode="replace". Il lavoro è completato quando il blocco di codice C preserva il simbolo minore di e la citazione seguente viene resa come un Blockquote separato in entrambi i casi rilevanti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I noticed that in some scenarios, this bug can occur:

Suppose your string is the following:

>>> string =  """
... Start of test.
...
...     for (i=0; i<3; i++) {
...         printf("Hello, world.");
...     }
...
... > This is a quote
...
... End of test.
... """

I would expect the C-code snippet to be formatted as a code block, and the quote to be formatted as a blockquote.

However, when I use safe_mode="escape" (because I want users of this to be able to use HTML in the application), markdown2 thinks that there is a big HTML tag in this block from the less than symbol to the beginning of the blockquote:

>>> import markdown2
>>> markdown2.markdown(string, safe_mode="escape")
'<p>Start of test.</p>\n\n<pre><code>for (i=0; i&lt;3; i++) {\n        printf("Hello, world.");\n    }  \n\n&gt; This is a quote\n</code></pre>\n\n<p>End of test.</p>\n'
>>> markdown2.markdown(string, safe_mode="replace")
'<p>Start of test.</p>\n\n<pre><code>for (i=0; i[HTML_REMOVED] This is a quote\n</code></pre>\n\n<p>End of test.</p>\n'
>>>

This seems to be a bug, because it means I cannot have a blockquote after a block of code that uses a < symbol.

Lingua principale
Python
Stelle
2.8k
Fork
459
Merge medio
2g 19h
PR unite (30g)
4

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di trentm/python-markdown2

Tutte le issue di trentm/python-markdown2

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.