| batch |
|
||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| gdoc_url | https://docs.google.com/document/d/14kt6q7FAKfWdSV3nNz8X5qMvZ49TTiSH8c2bqyS_Wk4/edit |
This guide will walk you through setting up Google API credentials for mdsync.
brew install chasemp/tap/mdsyncRun the setup script:
./setup.shOr manually:
pip install -r requirements.txt- Go to the Google Cloud Console
- Click on the project dropdown at the top
- Click "New Project"
- Give it a name (e.g., "mdsync") and click "Create"
- In your project, go to "APIs & Services" > "Library"
- Search for "Google Docs API" and click "Enable"
- Search for "Google Drive API" and click "Enable"
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- If prompted, configure the OAuth consent screen:
- Choose "External" (unless you have a Google Workspace)
- Fill in the required fields (App name, User support email, Developer contact)
- Click "Save and Continue"
- Skip adding scopes (click "Save and Continue")
- Add your email as a test user
- Click "Save and Continue"
- Back on the credentials page, click "Create Credentials" > "OAuth client ID"
- Choose "Desktop app" as the application type
- Give it a name (e.g., "mdsync client")
- Click "Create"
- After creating the OAuth client, you'll see a dialog with your client ID and secret
- Click "Download JSON"
- Save the downloaded file as
credentials.jsonin the mdsync directory
Run a test command:
./mdsync.py --helpOn first run with a Google Doc, you'll be prompted to authorize the application in your browser.
Make sure you've downloaded the OAuth credentials and saved them as credentials.json in the project directory.
Make sure you've enabled both the Google Docs API and Google Drive API in your project.
Make sure you've added your email as a test user in the OAuth consent screen configuration.
If you hit rate limits, you may need to wait or request a quota increase in the Google Cloud Console.
Once you have mdsync set up, you can create batch documents that combine multiple markdown files with automatic table of contents generation.
Basic batch with table of contents:
mdsync --batch file1.md file2.md file3.md --batch-tocBatch with file titles as headers and TOC:
mdsync --batch file1.md file2.md --batch-headers --batch-tocFull featured batch document:
mdsync --batch file1.md file2.md file3.md --batch-title "Project Documentation" --batch-headers --batch-horizontal-sep --batch-toc- Without
--batch-headers: Uses existing H1 headings (# heading) from your markdown files - With
--batch-headers: File titles become H1 headings (# File Title) - TOC links: Automatically generated and clickable in Google Docs
- Navigation: Appears at the top of the document for easy navigation
-
Create individual markdown files with H1 headings:
# Getting Started This section covers basic setup... # Installation Follow these steps to install...
-
Combine into batch document:
mdsync --batch getting-started.md installation.md --batch-toc
-
Result: A Google Doc with a clickable table of contents linking to each H1 section.