[Feature] Bullet character: --bullet *|-|+

Abierto
#94 0 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
76/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
cli

Línea de trabajo

Start with flag handling in cmd/gh-md-toc/config.go, then follow the configuration into coretoc.Config and Renderer.Render in internal/core/toc/renderer.go. Check the existing flag and renderer tests, and README.md for documentation conventions. Done means --bullet accepts *, - or + across the stated input modes, rejects invalid combinations, and keeps the default output unchanged.

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

Descripción

enhancement

Is your feature request related to a problem? Please describe.

Every TOC entry starts with *, and there is no way to use another bullet, for example
a dash. The marker is hardcoded in internal/core/toc/renderer.go
(indent+"* ["+text+"]("+link+")"). The same request for the Bash version is
ekalinin/github-markdown-toc#71, and it is implemented there in
ekalinin/github-markdown-toc#182.

Describe the solution you'd like

The same option as in the Bash version: --bullet <CHAR> with *, - or + (the
three bullet markers of CommonMark), which starts every entry with that character:

- [Title one](#title-one)
  - [Section](#section)
- [Title two](#title-two)

Behavior in the Bash version:

  • The default stays *, so without --bullet the output does not change.
  • The bullet applies to stdin, local files, remote URLs, several inputs and --insert.
  • An unknown character is an error with exit code 1, before any network call.
  • --bullet with --numbered list is an error: an ordered list has no bullet.
    With --numbered outline the bullet replaces *: - [2.1. Section](#section).

Describe alternatives you've considered

  • Replace the marker after generation:
    gh-md-toc README.md | sed 's/^\( *\)\* \[/\1- [/'. It does not work with
    --insert, which writes the TOC into the file directly.

Additional context

  • --numbered is not implemented here yet (#92). The two --numbered rules above apply
    to whichever of the two options lands second.
  • Places to change, as for the other flags: the flag in cmd/gh-md-toc/config.go, a new
    field in coretoc.Config (default *), and the marker in Renderer.Render. Plus
    tests and README.md.
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

  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 ekalinin/github-markdown-toc.go

Todos los issues de ekalinin/github-markdown-toc.go

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.