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

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
cli

調査の方向性

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.

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

説明

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.
主要言語
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 を短くまとめたダイジェスト。