[Feature] TOC for GitHub wiki pages

オープン
#98 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go
領域
cli

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Go
スター
525
フォーク
89
平均マージ
6分
マージ済み PR(30日)
1

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ekalinin/github-markdown-toc.go のほかの issue

ekalinin/github-markdown-toc.go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。