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

features generate-docs: `$` sequences in NOTES.md and descriptions are expanded as String.replace patterns, splicing the README template into the output

オープン 初心者向け
#1,325 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

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

調査の方向性

テンプレートは src/spec-node/collectionCommonUtils/generateDocsCommandImpl.ts の170〜182行目付近で埋められており、そこでは文字列の値を使って .replace() が呼び出されています。ユーザー指定の内容(notes、name、description、オプションの説明)に対するこれらの呼び出しを、置換関数を使うように変更してから、repro を再実行してください。$ を含む NOTES.md が、テンプレートの二重コピーなしに生成された README.md にそのまま表示されるはずです。出力が期待どおりのテキストと一致し、$'、$&、$$ もそのまま通ることが確認できれば完了です。

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

説明

Problem

If a Feature's NOTES.md contains $` (for example the markdown `$`), the generated README.md gets a second copy of the README template at that point: the title, the description, and an "Example Usage" block with literal #{Registry}/#{Namespace}/<id>:#{Version} and #{Customizations}. $', $& and $$ also misbehave, and so do name, description and option descriptions in devcontainer-feature.json.

Repro (CLI 0.89.0; same on main at 155f8b2)

mkdir -p src/demo
echo '{ "id": "demo", "version": "1.0.0", "name": "Demo", "description": "A demo." }' > src/demo/devcontainer-feature.json
echo 'Escape quotes, `$` or backslashes.' > src/demo/NOTES.md
devcontainer features generate-docs -p src -n x/y
  • Expected: Escape quotes, `$` or backslashes.
  • Actual: Escape quotes, `, then the template copy (# Demo (demo), ## Example Usage, #{Registry}/#{Namespace}/demo:#{Version}, #{Customizations}), then ` or backslashes.

Cause

src/spec-node/collectionCommonUtils/generateDocsCommandImpl.ts:170-182 fills the template with .replace('#{…}', value). With a string replacement, String.prototype.replace expands $`, $', $& and $$ (MDN). The same code is in devcontainers/action src/generateDocs.ts:152-162.

Suggested fix

Pass a replacer function, as in .replace('#{Notes}', () => generateNotesMarkdown()), for every placeholder that takes user content.

Not the same as #1324, which is about how option values are sourced at build time.

主要言語
TypeScript
スター
3k
フォーク
462
平均マージ
13時間 28分
マージ済み PR(30日)
2

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

devcontainers/cli のほかの issue

devcontainers/cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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