[ BUG ] TOC links break when a path with a space is one of several inputs
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
Línea de trabajo
El prefijo de ruta se añade en internal/core/toc/renderer.go, dentro de Renderer.Render. Lee primero esa función y las pruebas existentes del renderizador. Codifica los espacios del prefijo del enlace como %20 y luego confirma que las entradas sin espacios y los mensajes de error mantienen su salida actual; la reproducción del issue muestra el TOC esperado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
With several inputs, every TOC entry links to <input>#<anchor>, with the input as given
on the command line. When the input has a space, the link is not valid Markdown, and
GitHub renders the entry as plain text. The names of GitHub wiki pages can have spaces.
The Bash version had the same bug (ekalinin/github-markdown-toc#76) and fixed it in
ekalinin/github-markdown-toc#190.
To Reproduce
mkdir "test directory"
printf '# Title one\n\n## Section\n' > "test directory/a.md"
printf '# Title two\n' > "test directory/b.md"
gh-md-toc --hide-footer "test directory/a.md" "test directory/b.md"
Actual:
* [Title one](test directory/a.md#title-one)
* [Section](test directory/a.md#section)
* [Title two](test directory/b.md#title-two)
The GitHub Markdown API renders the first entry as
<li>[Title one](test directory/a.md#title-one)</li>, without a link.
Expected behavior
As in the Bash version, every space in the link prefix is replaced with %20, and no
other character changes:
* [Title one](test%20directory/a.md#title-one)
* [Section](test%20directory/a.md#section)
* [Title two](test%20directory/b.md#title-two)
Inputs without a space give the same output as now. Messages that show the input, such
as errors, keep it as given.
Environment (please complete the following information):
- OS: macOS (darwin/arm64)
- Version: 2.0.1, current
master(dd680f7)
Additional context
- The prefix is added in
Renderer.Render(internal/core/toc/renderer.go):
link = path + link. - With
--insert, local files get bare anchors, so the TOC written into them is not
affected.
- 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 80/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