Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Pre-existing bugs found while reviewing #151

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
shell
領域
cli

調査の方向性

The five bugs sit in gh-md-toc: the HTTP status check in gh_toc_load (around L38), the stdin read loop (L421-425), the error output (L160-171), and the single-line sed in gh_toc_grab (L290). The issue says to wait for #151, which changes the stdin block and error output, so check that PR first. Done means each checkbox is fixed and reproduced on both Linux and macOS, with the issue's examples giving the expected output.

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

説明

Found while reviewing #151. All of these reproduce on current master (9e0a858), #151 doesn't introduce them. Line numbers refer to gh-md-toc at 9e0a858.

  • Remote URL ignores the HTTP status (gh_toc_load, L38). curl -s only fails on network errors, so ./gh-md-toc https://github.com/ekalinin/github-markdown-toc/blob/master/NOPE-404.md prints an empty TOC and exits 0.
  • stdin input is changed before it is sent (L423-425). while read -r input; do echo "$input" >> ... strips leading whitespace, drops a last line without a trailing newline, and echo swallows lines like -n. For printf '# A\n\n # indented code\n-n\n# Last' | ./gh-md-toc - the API gets only # A, an empty line and # indented code, so the indented code block becomes a heading and # Last is lost. cat > "$gh_tmp_md" would keep the input as is.
  • The stdin temp file is never removed (L421). Every gh-md-toc - run leaves a tmp.XXXXXX file with the input markdown in $TMPDIR.
  • Errors go to stdout (L160-171). The network and rate-limit errors are printed with plain echo, so ./gh-md-toc README.md > toc.md writes the error text into toc.md under the "Table of Contents" header. The exit code is 1, but the error ends up in the output file.
  • The rate-limit hint always points to token.txt (L168-169). It's printed even when GH_TOC_TOKEN is set, and in that case token.txt is ignored.
  • Single-line HTML gives an empty TOC on macOS (gh_toc_grab, L290). BSD sed's N on the last line quits without printing, so sed -e ':a' -e 'N' -e '$!ba' ... outputs nothing for one-line input. A document with only one heading renders to one line of HTML, so printf '# A\n' | ./gh-md-toc - prints an empty TOC on macOS, while printf '# A\n\n## B\n' works.

#151 changes the stdin block and the error output, so it's easier to fix these after it's merged.

主要言語
Shell
スター
3.3k
フォーク
2.7k
平均マージ
3時間 21分
マージ済み PR(30日)
10

環境構築

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

はじめの一歩

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

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

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

似ている issue

Shell/Bash の issue をもっと見る

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

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