[Feature] TOC for GitHub wiki pages

Abierto
#98 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
65/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
go
Área
cli

Línea de trabajo

Read the README section on “Remote files” and trace how remote URLs are routed between remotehtml and remotemd. Then inspect the existing HTML extraction path and its tests, if present, to identify how wiki page URLs can produce a TOC and how multi-input links are prefixed. Done means the supplied GitHub wiki URL yields the requested headings and links.

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.

The Bash version builds a TOC for a GitHub wiki page by its URL (see "Remote files" in its
README). Here such a URL fails:

$ gh-md-toc https://github.com/ekalinin/nodeenv/wiki/Who-Uses-Nodeenv
process "https://github.com/ekalinin/nodeenv/wiki/Who-Uses-Nodeenv": get remote HTML "https://github.com/ekalinin/nodeenv/wiki/Who-Uses-Nodeenv": unexpected content type "text/html; charset=utf-8"

Every URL outside githubusercontent.com goes to remotehtml, which asks for JSON and
reads the TOC from the payload that GitHub embeds in blob pages. A wiki page is served as
HTML only.

Describe the solution you'd like

A wiki page URL (https://github.com/<owner>/<repo>/wiki/<page>) gives a TOC, as in the
Bash version:

* [Who Uses Nodeenv?](#who-uses-nodeenv)
  * [edx](#edx)
  * [OpenStack](#openstack)
  ...

With several inputs, the links are prefixed with the page URL, as for other remote pages.

Describe alternatives you've considered

The raw Markdown of a wiki page already works, through the remotemd path:

gh-md-toc https://raw.githubusercontent.com/wiki/ekalinin/nodeenv/Who-Uses-Nodeenv.md

Additional context

Possible ways to support it: rewrite a wiki URL to its raw.githubusercontent.com/wiki/...
form, or extract the headings from a text/html answer with RegexpExtractor, as the
Bash version does with the page HTML.

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.