Skip to content

Add md2gdoc skill: markdown to styled Google Docs#1

Open
Aldo Gonzalez (aldogonzalez8) wants to merge 5 commits intomainfrom
add-md2gdoc-skill
Open

Add md2gdoc skill: markdown to styled Google Docs#1
Aldo Gonzalez (aldogonzalez8) wants to merge 5 commits intomainfrom
add-md2gdoc-skill

Conversation

@aldogonzalez8
Copy link
Collaborator

Summary

  • Generic skill that converts markdown files to styled Google Docs using any template
  • Auto-generates template skeleton from a Google Doc URL (heading parsing + metadata detection)
  • Fits content via fuzzy heading matching (auto-derived from skeleton)
  • Pipeline: preprocess → fit to template → pandoc → python-docx post-processing → rclone upload
  • No bundled templates — users provide their own Google Doc URL on first use

What is included

  • md2gdoc/SKILL.md — Full skill definition with step-by-step instructions
  • md2gdoc/scripts/generate_template.py — Auto-generates skeleton from .docx
  • md2gdoc/scripts/fit_to_template.py — Maps user content to template sections
  • md2gdoc/scripts/preprocess_markdown.py — Strips preamble, converts ASCII tables
  • md2gdoc/scripts/postprocess_docx.py — Table borders, code blocks, heading styles, spacing
  • md2gdoc/templates/.gitkeep — Empty templates dir (populated on first use)

Test plan

  • Install skill and invoke /md2gdoc with a markdown file
  • Verify template auto-generation from a Google Doc URL
  • Verify output styling (tables, code blocks, headings)

🤖 Generated with Claude Code

Generic skill that converts markdown files to professionally styled
Google Docs using any template. Auto-generates template skeleton from
a Google Doc URL, fits content via fuzzy heading matching, applies
table borders, code block styling, heading hierarchy, and paragraph
spacing via pandoc + python-docx post-processing.

No bundled templates — users provide their own Google Doc URL on
first use, which gets cached for reuse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove Airbyte reference from fix_heading_hierarchy docstring
- Remove unused WD_ALIGN_PARAGRAPH import from postprocess_docx.py
- Remove unused sys import from fit_to_template.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bug 1: download_from_gdrive() used rclone copyto which treats file IDs
as filesystem paths. Replaced with Google Drive REST API export endpoint.

Bug 2: SKILL.md Steps 6 and 7 used $() shell substitution which breaks
in zsh with scm_breeze plugin. Created gdrive_utils.py with subcommands
(get-doc-url, get-access-token, set-pageless) to replace inline bash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Step 9 (rm intermediate pandoc .docx) removed — the temp dir gets
recreated each run anyway, and rm triggers shell alias conflicts.

Added guidance in Step 2 for when <50% of template sections map:
show the user the mapping, ask if they want to proceed or manually
assign sections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Python venv with airbyte-agent-google-drive connector SDK
- Add gdrive_auth.py shared helper (connector init + token refresh)
- Replace rclone upload with connector files_upload.create()
- Replace rclone lsjson with connector files.list()
- Replace urllib download with connector files_export.download_local()
- Add .env.example for Google OAuth credentials
- Drop rclone dependency entirely from the skill

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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