Visitar URL original
Support Markdown (.md) file attachments with --attach · Issue #14407 · cli/cli · GitHub
Skip to content

Support Markdown (.md) file attachments with --attach #14407

Agent suggestions

Public preview

Description

@dluk18b3

Describe the feature or problem you’d like to solve

Please add support for attaching Markdown (.md) files through the existing --attach flag on issue, pull request, and comment commands.

The current flag supports images and videos. It would also be useful to upload a Markdown document as a downloadable file attachment, for example an implementation plan, investigation report, or review notes, without copying the entire document into the issue or comment body.

Using --body-file report.md serves a different purpose: it reads the document into the body rather than attaching the original file.

Proposed solution

Allow .md files wherever --attach is supported:

gh issue create --title "Implementation proposal" --body "Plan attached." --attach ./plan.md
gh issue edit 123 --attach ./plan.md
gh issue comment 123 --body "Investigation report attached." --attach ./report.md
gh pr create --title "Implement feature" --body "Design notes attached." --attach ./design.md
gh pr edit 456 --attach ./design.md
gh pr comment 456 --body "Review notes attached." --attach ./review.md

Expected behavior:

  • Upload the original .md file as a GitHub attachment and preserve its filename and contents.
  • Insert a normal downloadable Markdown link, such as [report.md](<uploaded-url>), instead of an image embed or the document contents.
  • Follow the existing attachment behavior for rewriting local file references in the body and appending a link when no reference exists.
  • Support repeated --attach flags, including Markdown files alongside supported images or videos.
  • Report any API, file size, or permission limitations clearly.

Additional context

Related to #14194, which requests general file attachment upload/download support. This request specifically covers uploading .md files through the existing --attach interface; it does not request download commands or support for other document formats.

Markdown is a common format for reports and plans produced by developers and coding agents. Attaching these documents would keep issue and PR discussions concise while preserving the complete document as a separate file.

Activity

  1. cli-triage commented on Sep 9, 2026

    @cli-triage

    This looks like a clear, well-scoped enhancement request — no duplicates found (searched cli/cli for related "attach"/"markdown"/"document" issues; #14194 is a broader related tracking issue mentioned by the reporter, not a duplicate). I'm suggesting enhancement and gh-issue (the request also spans gh pr, but issue commands are the primary example given).

    Looking at the implementation, --attach currently only accepts a fixed extension allowlist in supportedContentType, backed by the contentTypes table at userasset.go#L24-L37, which lists only image and video extensions (.png, .jpg, .jpeg, .gif, .webp, .svg, .mp4, .mov, .webm). .md isn't in that table, so a .md path passed to --attach fails validation today. Supporting it would need a new "document" asset kind (distinct from imageAsset/videoAsset) that renders a plain download link (e.g. [filename.md](url)) rather than an image embed or bare player URL, plus wiring through newAsset and the upload/rewrite logic in attach.go. This is a reasonable, contained addition to the existing attachment path rather than the broader upload/download feature requested in #14194.

    Generated by Issue Triage (skills-driven) for #14407 · copilot · auto · 42.5 AIC · ⌖ 2.48 AIC · ⊞ 10K · ◷

  2. added
    enhancementa request to improve CLI
    platformProblems with the GitHub platform rather than the CLI client
    attachmentsIssues regarding `--attach`
    on Sep 9, 2026
  3. github-actions commented on Sep 9, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  4. flaviovs commented on Oct 6, 2026

    @flaviovs

    This seems like a pretty artificial limitation, and I look forward to see this implemented.

    In fact I suggest adding not only Markdown, but all file types listed in https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files#additional-file-types so that the CLI matches what can already be done in the web UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    attachmentsIssues regarding `--attach`blockedenhancementa request to improve CLIplatformProblems with the GitHub platform rather than the CLI client

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions