[ BUG ] TOC links break when a path with a space is one of several inputs
まだ誰も着手していません。
評価
調査の方向性
パスのプレフィックスは internal/core/toc/renderer.go の Renderer.Render で追加されます。まずその関数と既存のレンダラーテストを読んでください。リンクのプレフィックス内の空白を %20 としてエンコードし、その後、空白のない入力とエラーメッセージの出力が現在のままであることを確認してください。issue の再現例が期待される TOC を示しています。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Go
- スター
- 525
- フォーク
- 89
- 平均マージ
- 6分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ekalinin/github-markdown-toc.go のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
ekalinin/github-markdown-toc.go の issue をすべて見る
似ている issue
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeout対応中かも @floriankoch が今日担当しました。 オープンtriage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
envoyproxy/gateway#10562 ·
メンテナーはふだん 1 日以内に返信
-
Adding an LDAP group reports every search failure as "LDAP Group DN is not found"対応中かも @Daksha1611 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
[Bug] K8s reconcile still resets explicit 0 to defaults for response_api, memory and flow state対応中かも @Bevisy が今日担当しました。 オープンneeds-acceptance
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
vllm-project/semantic-router#5998 ·
メンテナーはふだん 2 日以内に返信