Line breaking in a code span can break the block structure
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Riproduci i casi segnalati con i comandi cmark nell’issue, in particolare gli input dei code span sottoposti a rendering con --width 3. Leggi le regole proposte per le interruzioni di riga e confrontale con il comportamento di parsing e rendering di CommonMark. Il lavoro è completato quando le interruzioni di riga all’interno dei code span non modificano più le intestazioni, i paragrafi, i blocchi di codice delimitati o la struttura degli elenchi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In CommonMark rendering, line breaking in a code span can break the block structure. Here are just a few examples:
$ printf '`xx --- xx`' | cmark -t commonmark --width 3 | cmark -t html
<h2>`xx</h2>
<p>xx`</p>
$ printf '`xx ``` xx`' | cmark -t commonmark --width 3 | cmark -t html
<p>`xx</p>
<pre><code>xx`
</code></pre>
$ printf '`xx + x xx`' | cmark -t commonmark --width 3 | cmark -t html
<p>`xx</p>
<ul>
<li>x
xx`</li>
</ul>
In case anyone wants to discuss, here is my attempt to specify how I think CommonMark rendering should work:
Line breaking is only implemented inside a paragraph, not inside a heading or an HTML block.
Except inside raw HTML (which I've not thought about), any group of consecutive whitespace characters will turn into a single space or a newline followed by the current line prefix.
Break each line at the last breakable space that doesn't make the line too long. So a line will be wider than the specified width only if it contains no breakable spaces.
In code spans a space is breakable if and only if the following group of non-space characters does not match any of the following Perl regular expressions:
/^[#*-=_]+$/ thematic break, heading
/^(```|~~~)/ fenced code block
/^[<>]/ HTML block, block quote
/^[*+-]$/ list item
/^[0-9]+[).]$/ list item
In textual content all spaces are breakable. A backslash is inserted for the following groups of characters:
/[*<[\\_`]/ escape, code, emphasis, links, images, raw HTML
/[&][#A-Za-z]/ entity or numeric character reference
/^[#*-=_]+$/ thematic break, heading
/^(```|~~~)/ fenced code block
/^[<>]/ HTML block, block quote
/^[*+-]$/ list item
/^[0-9]+[).]$/ list item
In these expressions, ^ means the start of a line (perhaps following a line prefix) and $ means space or the end of the line.
The backslash is inserted in front of each group, except in the last case, where it is inserted in front of the parenthesis or dot.
I've almost certainly forgotten something in there.
- Lingua principale
- C
- Stelle
- 2k
- Fork
- 698
- 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
- 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 commonmark/cmark
-
Incorrect `parser->offset` advancement for closing fenced code blocks in `parse_code_block_prefix`Forse già presa @cpruijsen l’ha presa 23 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
commonmark/cmark#590 · 3 commenti ·
-
API documentation is missing an explanation of CMARK_NODE_CUSTOM_BLOCK and CMARK_NODE_CUSTOM_INLINEAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
commonmark/cmark#441 · 2 commenti ·
-
Inline code languageAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
commonmark/cmark#626 · 4 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
commonmark/cmark#624 ·
-
Single-space blank line evicts a list-item continuationForse già presa @afonsojanu l’ha presa 33 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
commonmark/cmark#618 ·
Tutte le issue di commonmark/cmark
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openwrt/firmware-utils#82 ·
-
area:http-gateway good first issue priority:low type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
crazy-goat/php-fpm-ng#870 ·
I maintainer di solito rispondono entro 1 giorno
-
Discover carries headerEdges that nothing reads since #1914 moved E0507/E0517 to the compiler graphApertatech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
2个显示的问题Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
coolsnowwolf/lede#14209 ·
-
Cannot run pico-hsm-tool.pyAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
polhenarejos/pico-hsm#147 ·