Line breaking in a code span can break the block structure
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Reproduce los casos reportados con los comandos de cmark del issue, especialmente las entradas de code span renderizadas con --width 3. Lee las reglas propuestas para los saltos de línea y compáralas con el comportamiento de parsing y rendering de CommonMark. Se considera terminado cuando los saltos de línea dentro de los code spans ya no cambien los encabezados, los párrafos, los bloques de código cercados ni la estructura de las listas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C
- Estrellas
- 2k
- Forks
- 698
- Métricas de merge de PR
- Sin PR fusionados en 30 d
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 commonmark/cmark
-
Incorrect `parser->offset` advancement for closing fenced code blocks in `parse_code_block_prefix`Posiblemente ocupada @cpruijsen la tomó hace 23 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
commonmark/cmark#590 · 3 comentarios ·
-
API documentation is missing an explanation of CMARK_NODE_CUSTOM_BLOCK and CMARK_NODE_CUSTOM_INLINEAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
commonmark/cmark#441 · 2 comentarios ·
-
Inline code languageAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
commonmark/cmark#626 · 4 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
commonmark/cmark#624 ·
-
Single-space blank line evicts a list-item continuationPosiblemente ocupada @afonsojanu la tomó hace 33 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
commonmark/cmark#618 ·
Todos los issues de commonmark/cmark
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
openwrt/firmware-utils#82 ·
-
area:http-gateway good first issue priority:low type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
crazy-goat/php-fpm-ng#870 ·
Los mantenedores suelen responder en 1 día
-
Discover carries headerEdges that nothing reads since #1914 moved E0507/E0517 to the compiler graphAbiertotech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
2个显示的问题Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
coolsnowwolf/lede#14209 ·
-
Cannot run pico-hsm-tool.pyAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
polhenarejos/pico-hsm#147 ·