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

Contents of <pre> tags wrapped in <div> tags are not left alone if they contain empty lines

Aperta
#807 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
markdown
Ambito
documentation

Direzione di ricerca

Reproduce the reduced Markdown example in the CommonMark dingus and compare it with the standalone

 case. Read the CommonMark specification and the related Markdown-it issue to determine the intended behavior for empty lines inside 
 elements wrapped in ; done means the example preserves the preformatted contents without an inserted 

element.

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

Descrizione

Contents of HTML preformatted text blocks (<pre>…</pre>) are, correctly, left alone:

e.g.,

<pre>a

b
</pre>

is rendered correctly as, with the contents untouched:

<pre>a

b
</pre>

However, if you wrap that in a <div>:

<div>
  <pre>a

  b
  </pre>
</div>

the commonmark parser starts parsing the contents of the <pre> tag following the empty line, which corrupts the resulting HTML:

<div>
  <pre>a
<p>b
</pre></p>
</div>

Notice the erroneously added <p> tag prior to b that closes following the </pre> tag.

I encountered this in Markdown-it and was able to narrow it down to this test case which is also reproducible in the commonmark parser at https://spec.commonmark.org/dingus/.

Related:

• https://github.com/markdown-it/markdown-it/issues/238

Lingua principale
Python
Stelle
5.2k
Fork
360
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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

  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 commonmark/commonmark-spec

Tutte le issue di commonmark/commonmark-spec

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.