Skip to content

feat(document): download attached images in document view#219

Merged
schpet merged 1 commit into
mainfrom
schpet/push-mrzkuuyooutn
May 19, 2026
Merged

feat(document): download attached images in document view#219
schpet merged 1 commit into
mainfrom
schpet/push-mrzkuuyooutn

Conversation

@schpet
Copy link
Copy Markdown
Owner

@schpet schpet commented May 19, 2026

Document view's rendered/raw output now downloads inline images and Linear-upload links to the same /tmp cache used by issue view, so terminal renderers and downstream tools see local file paths instead of remote URLs that require auth.

Image helpers (extractImageInfo, extractLinearLinkInfo, replaceImageUrls, getUrlHash, getLinearUploadHost, downloadMarkdownImages) move from src/commands/issue/issue-view.ts to src/utils/markdown-images.ts so both commands share one implementation. downloadIssueImages becomes downloadMarkdownImages, which takes an array of markdown sources rather than an issue-specific (description, comments) tuple.

Adds --no-download to document view (mirroring issue view) and reorders the command so the download step runs after the --json early return but before --raw, matching issue view's behavior where piped output also gets local paths.

Also adds remark-gfm to the parse/stringify pipeline used by replaceImageUrls so GFM constructs (task lists, tables, strikethrough) survive the URL rewrite. Without it, remark-stringify would re-escape - [ ] todo as * \[ ] todo whenever an image is rewritten, mangling documents and issue descriptions that lean on GFM syntax.

Document view's rendered/raw output now downloads inline images and
Linear-upload links to the same /tmp cache used by issue view, so terminal
renderers and downstream tools see local file paths instead of remote URLs
that require auth.

Image helpers (extractImageInfo, extractLinearLinkInfo, replaceImageUrls,
getUrlHash, getLinearUploadHost, downloadMarkdownImages) move from
src/commands/issue/issue-view.ts to src/utils/markdown-images.ts so both
commands share one implementation. downloadIssueImages becomes
downloadMarkdownImages, which takes an array of markdown sources rather
than an issue-specific (description, comments) tuple.

Adds --no-download to document view (mirroring issue view) and reorders
the command so the download step runs after the --json early return but
before --raw, matching issue view's behavior where piped output also gets
local paths.

Also adds remark-gfm to the parse/stringify pipeline used by
replaceImageUrls so GFM constructs (task lists, tables, strikethrough)
survive the URL rewrite. Without it, remark-stringify would re-escape
`- [ ] todo` as `* \[ ] todo` whenever an image is rewritten, mangling
documents and issue descriptions that lean on GFM syntax.
@schpet schpet merged commit eb8a659 into main May 19, 2026
15 checks passed
@schpet schpet deleted the schpet/push-mrzkuuyooutn branch May 19, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant