https://github.com/jasiek-net/google-docs-to-markdown
Save Google Docs in Markdown format
https://github.com/jasiek-net/google-docs-to-markdown
gatsby gatsby-markdown google-docs google-drive jekyll jekyll-markdow markdown
Last synced: 26 days ago
JSON representation
Save Google Docs in Markdown format
- Host: GitHub
- URL: https://github.com/jasiek-net/google-docs-to-markdown
- Owner: jasiek-net
- Created: 2022-08-15T16:26:41.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-26T16:00:54.000Z (almost 4 years ago)
- Last Synced: 2025-06-09T14:17:09.998Z (12 months ago)
- Topics: gatsby, gatsby-markdown, google-docs, google-drive, jekyll, jekyll-markdow, markdown
- Language: JavaScript
- Homepage:
- Size: 72.3 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GD2MD
This is a simple wrapper around [gatsby-source-google-docs](https://github.com/cedricdelpoux/gatsby-source-google-docs). It allows you to export Google Drive to Markdown with keeping folders structure and downloading all images. Before running the script prepare `.env` file and run steps below. For more details checkout offical documentation of [gatsby-source-google-docs](https://github.com/cedricdelpoux/gatsby-source-google-docs).
```
yarn install
cp ./gatsby-source-filesystem.js ./node_modules/gatsby-source-filesystem/index.js
cp ./gsgd-google-drive.js ./node_modules/gatsby-source-google-docs/utils/google-drive.js
cp ./gsgd-google-document.js ./node_modules/gatsby-source-google-docs/utils/google-document.js
ts-node index.ts
```
#### Structure of the .env file
```
GOOGLE_OAUTH_CLIENT_ID=
GOOGLE_OAUTH_CLIENT_SECRET=
GOOGLE_DOCS_TOKEN=
GOOGLE_DOCS_FOLDER=
MARKDOWN_PATH=
IMAGES_PATH=
```
To generate google oauth variables, you can use script from `gatsby-source-google-docs`:
```
npx gatsby-source-google-docs-token
```
## Features
- save markdown locally
- save images locally
- first image as cover
- frontmatter in Google Docs
- jekyll filename convention
### Cover image
If you put image as a first element in Google Docs, it will be moved to frontmatter.
```
cover:
image: /path/to/image.png
alt: 'Alt text'
title: 'Title text'
```
### Frontmatter in Docs
Just put frontmatter in your Google Docs, this script will remove it from markdown body and put in the header!
```
tags: [Hello, World]
description: 'Some important description'
```
### Filename convention
If you use jekyll naming convention in Google Drive (`2022-08-22 Hello world!`), it will be treated in jekyll's way:
Fields where date will be kept:
```
name: 2022-08-22 Hello world!
path: /post/2022-08-22-hello-world
```
Fields were date will be removed:
```
title: Hello world!
slug: /post/hello-world
breadcrumbs:
- { name: post, slug: /post }
- { name: 'Hello world!', slug: /post/hello-world }
```