Skip to content

feat(docs): add --file flag to create Google Doc from Markdown#244

Closed
chrismdp wants to merge 1 commit intoopenclaw:mainfrom
chrismdp:feat/docs-create-file
Closed

feat(docs): add --file flag to create Google Doc from Markdown#244
chrismdp wants to merge 1 commit intoopenclaw:mainfrom
chrismdp:feat/docs-create-file

Conversation

@chrismdp
Copy link
Copy Markdown
Contributor

Summary

  • Adds --file flag to gog docs create that imports a Markdown file as a native Google Doc via Drive auto-conversion
  • Images in markdown (![alt](path)) are handled in a two-pass approach: stripped to placeholders during upload, then inserted inline via the Docs API InsertInlineImage
  • Local images are temporarily uploaded to Drive (with cleanup); remote URLs are used directly
  • Path traversal protection: symlinks are resolved and images must reside within the markdown file's directory

Test plan

  • go build ./... and go vet ./... pass
  • 32 unit tests covering extractMarkdownImages, findPlaceholderIndices, buildImageInsertRequests, and round-trip integration
  • Manual test: plain markdown (no images) → creates formatted Google Doc
  • Manual test: markdown with remote image URL → image inserted inline
  • Manual test: markdown with local image → uploaded, inserted, temp file cleaned up

🤖 Generated with Claude Code

Upload a Markdown file to Google Drive with auto-conversion to native
Docs format. Images are handled in a second pass: markdown image
references are replaced with placeholders during upload, then the
created document is read back via the Docs API to locate placeholder
positions and replace them with inline images (InsertInlineImage).

Local images are uploaded to Drive temporarily with public read access
(required by the Docs API), then cleaned up after insertion. Remote
URLs (http/https) are used directly. Path traversal is prevented by
resolving symlinks and verifying images stay within the markdown
file's directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@steipete
Copy link
Copy Markdown
Collaborator

Landed on main in 7ff05d5 and 49a3943. Thanks @chrismdp for the contribution and feature work.

@steipete steipete closed this Feb 13, 2026
@chrismdp
Copy link
Copy Markdown
Contributor Author

chrismdp commented Feb 13, 2026

Thanks! Also have #214 for slide creation (mistakenly thought you'd merged that one in earlier deleted comment!) feedback welcome

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.

2 participants