Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Extra leading spaces when wrapping list to fixed width

Abierto
#348 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
c
Área
cli

Línea de trabajo

Reproduce la salida del ajuste de línea de listas con el punto de entrada de línea de comandos cmark y el ancho indicado de 80. Inspecciona el renderizado y el ajuste de línea de las listas, y añade o actualiza la cobertura para el ejemplo; estará terminado cuando los elementos de lista ajustados no obtengan los dos espacios iniciales adicionales, mientras que las líneas de continuación sigan teniendo la indentación correcta.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Here is a simple Markdown list:

❯ cat ./list.md
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the list. That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on incredible stuff we're not used to see everyday](#link-3) - Line #3's description.

Re-wrapping this to a maximum length of 80 characters introduces 2 spaces before each lines:

❯ /System/Volumes/Data/usr/local/opt/cmark/bin/cmark --to commonmark --width 80 ./list.md
  - [Link 1](#link-1) - Description of line 1.
  - [Link 2](#link-2) - A very long description for the second link in the list.
    That description is more than 80 characters wide.
  - [This is a very long title, pointing to an awesome article on incredible
    stuff we're not used to see everyday](#link-3) - Line \#3's description.

Here I expect cmark to get rid of these leading spaces and render as such:

- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the list.
  That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on incredible stuff
  we're not used to see everyday](#link-3) - Line \#3's description.

Why? So we can fix a regression in pandoc. See how the previous flavor (markdown_github) behaved in that situation compared to the new one (gfm, based on cmark):

❯ pandoc --version
pandoc 2.9.2.1
Compiled with pandoc-types 1.20, texmath 0.12.0.1, skylighting 0.8.3.2

❯ pandoc ./list.md --to=markdown_github
[WARNING] Deprecated: markdown_github. Use gfm instead.
-   [Link 1](#link-1) - Description of line 1.
-   [Link 2](#link-2) - A very long description for the second link in
    the list. That description is more than 80 characters wide.
-   [This is a very long title, pointing to an awesome article on
    incredible stuff we’re not used to see everyday](#link-3) - Line
    \#3’s description.

❯ pandoc ./list.md --to=gfm
  - [Link 1](#link-1) - Description of line 1.
  - [Link 2](#link-2) - A very long description for the second link in
    the list. That description is more than 80 characters wide.
  - [This is a very long title, pointing to an awesome article on
    incredible stuff we’re not used to see everyday](#link-3) - Line
    \#3’s description.

I guess this behaviour should be somewhat configurable in cmark as pandoc does with the --tab-stop parameter:

❯ pandoc ./list.md --to=markdown_github --tab-stop=2
[WARNING] Deprecated: markdown_github. Use gfm instead.
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the
  list. That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on
  incredible stuff we’re not used to see everyday](#link-3) - Line \#3’s
  description.

For reference, here the version of cmark I'm using, installed with brew on macOS Catalina:

❯ brew install cmark
(...)
==> Downloading https://homebrew.bintray.com/bottles/cmark-0.29.0_1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/3a/3af95418f96f4b0cec4bd76abaab312f3caf4cea591f38d3b725f15068d06491?__gda__=exp=1593691219~hmac=7f6c15036b995f36438e934f5bd44ec8
######################################################################## 100.0%
==> Pouring cmark-0.29.0_1.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/cmark/0.29.0_1: 17 files, 724.9KB
❯ /System/Volumes/Data/usr/local/opt/cmark/bin/cmark --version
cmark 0.29.0 - CommonMark converter
(C) 2014-2016 John MacFarlane
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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de commonmark/cmark

Todos los issues de commonmark/cmark

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.