[ BUG ] --insert writes LF line endings into a file with CRLF line endings
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 80/100
Línea de trabajo
Empieza por internal/core/usecase/insertmd/markers.go y sigue cómo replaceBetweenMarkers maneja los finales de línea; el issue también indica que la misma regla se aplica a --stdout (#95). Reproduce el problema con la entrada CRLF proporcionada y comprueba después que las líneas insertadas usan CRLF cuando la marca de inicio tiene un \r al final, mientras que las demás líneas permanecen sin cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
In a file with CRLF line endings, --insert finds the markers, but every line it writes
between them ends with \n only, so the file ends up with mixed line endings. The Bash
version writes these lines with \r\n when the <!--ts--> line ends with \r
(ekalinin/github-markdown-toc#119, fixed in ekalinin/github-markdown-toc#195).
To Reproduce
printf '<!--ts-->\r\n<!--te-->\r\n\r\n# Title\r\n\r\n## Section\r\n' > crlf.md
gh-md-toc --insert --no-backup crlf.md
od -c crlf.md
Actual, line by line:
<!--ts-->\r\n
* [Title](#title)\n
* [Section](#section)\n
\n
<!-- Created by https://github.com/ekalinin/github-markdown-toc.go -->\n
<!-- Added by: <user>, at: <date> -->\n
<!--te-->\r\n
\r\n
# Title\r\n
\r\n
## Section\r\n
Expected behavior
When the <!--ts--> line ends with \r, every line written between the markers (the TOC
entries, the empty line and the footer lines) ends with \r\n. Otherwise they end with
\n, as now. All other lines are kept as they are.
Environment (please complete the following information):
- OS: macOS (darwin/arm64)
- Version: 2.0.1, current
master(dd680f7)
Additional context
replaceBetweenMarkers(internal/core/usecase/insertmd/markers.go) splits the file on
\nand joins the TOC block with\n. The marker lines already keep their\r.- The same rule applies to
--stdout(#95).
- Lenguaje dominante
- Go
- Estrellas
- 525
- Forks
- 89
- Merge medio
- 6 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
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 ekalinin/github-markdown-toc.go
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
-
enhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Todos los issues de ekalinin/github-markdown-toc.go
Issues similares
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeoutPosiblemente ocupada @floriankoch la tomó hoy. Abiertotriage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
envoyproxy/gateway#10562 ·
Los mantenedores suelen responder en 1 día
-
Adding an LDAP group reports every search failure as "LDAP Group DN is not found"Posiblemente ocupada @Daksha1611 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
[Bug] K8s reconcile still resets explicit 0 to defaults for response_api, memory and flow statePosiblemente ocupada @Bevisy la tomó hoy. Abiertoneeds-acceptance
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
vllm-project/semantic-router#5998 ·
Los mantenedores suelen responder en 2 días