feat(drive): convert Markdown uploads and strip YAML frontmatter#487
Merged
steipete merged 2 commits intosteipete:mainfrom Apr 20, 2026
Merged
Conversation
| gog drive download <fileId> --out ./downloaded.bin | ||
| gog drive download <fileId> --format pdf --out ./exported.pdf # Google Workspace files only | ||
| gog drive download <fileId> --format docx --out ./doc.docx | ||
| gog drive download <fileId> --format md --out ./note.md # Google Doc → Markdown |
Contributor
Author
There was a problem hiding this comment.
Note: The addition of gog drive download --format md ... to the README is for documentation completeness. I’ve included it here so that the Markdown import/export flows are documented together in the same section.
(The download as md feature was originally added in #282)
Map .md to Google Doc conversion with --convert, strip leading ---/--- frontmatter before upload (opt out with --keep-frontmatter), and extend tests for convert MIME and frontmatter handling.
Co-authored-by: Ben Lewis <johnbenjaminlewis@gmail.com>
213dc8a to
d9bc8f5
Compare
Owner
|
Landed in 5d332f7 after a polish pass. Changes added while landing:
Verified locally with focused upload/frontmatter tests, Thanks again @johnbenjaminlewis. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.mdas convertible to native Google Docs when usinggog drive upload --convert. (Usesapplication/vnd.google-apps.documentmetadata).---...---) by default to ensure clean Drive imports.--keep-frontmatterfor users who want to preserve the header.---literal ininternal/cmd/literals.goto satisfygoconst.docs/spec.mdto reflect new flags and existing Google Doc → Markdown export logic.User-facing changes
gog drive upload file.md --convert: Creates a Google Doc; strips frontmatter.gog drive upload file.md --convert --keep-frontmatter: Creates a Google Doc; keeps frontmatter.Test plan
make cistripYAMLFrontmatter, MIME conversion logic, and edge cases.Relates to #272 (Provides a workaround via
drive uploadimport).