Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erikh/gdocs-export
export google documents and convert them to markdown or HTML
https://github.com/erikh/gdocs-export
docs document google google-docs-api html markdown
Last synced: 26 days ago
JSON representation
export google documents and convert them to markdown or HTML
- Host: GitHub
- URL: https://github.com/erikh/gdocs-export
- Owner: erikh
- License: mit
- Created: 2021-01-12T21:43:20.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-30T12:18:15.000Z (almost 4 years ago)
- Last Synced: 2024-10-04T19:11:03.549Z (about 2 months ago)
- Topics: docs, document, google, google-docs-api, html, markdown
- Language: Go
- Homepage:
- Size: 3.25 MB
- Stars: 7
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Export Google Docs to Markdown, HTML, and more
In this repository lives the `gdexport` command which will fetch Google Docs by URL and attempt to convert them to Markdown or just download them in the JSON representation that Google docs provides. It also provides a minimal UI if you'd prefer to go that route.
The formatting is not perfect yet and may not be for some time. This is still a beta work. Check out the [examples directory](example-output) for some output examples.
## Installation
Check out the [releases page](https://github.com/erikh/gdocs-export/releases).
Building requires a [golang](https://golang.org) version 1.14 or greater currently. Many system packages will not work, so install Golang by hand if you need to.
### OAuth2 Credentials
First, create a [credentials.json per this example](https://developers.google.com/docs/api/quickstart/go) (click on
"enable the Google Docs API" and follow the prompts).If you do not do the `import-credentials` step below, the `fetch` command **will not work**.
```bash
gdexport import-credentials credentials.json
```The first time you launch the program to fetch a document, you will be prompted to visit something in your browser and insert a code to STDIN.
### Installing the repository and setting it up
```bash
export GOBIN=$HOME/bin
go get -u github.com/erikh/gdocs-export/...
```## Usage
There are the following sub-commands:
- `import-credentials`: import a `credentials.json` downloaded from the google docs API. Needed to use the `fetch` command.
- `fetch`: Download a document and optionally convert it. `gdexport help fetch` for more information.
- `convert`: Convert a document on disk. `gdexport help convert` for more information.
- `serve`: Boot the UI to do online conversions. Starts on `http://localhost:4000` by default.## Notes
- Consolas is the font used to make code blocks. Set the font in gdocs to consolas to enable them.
- Image tags are not `![]()`, they are `` in markdown; this is legal and we can use dimensions safer this way.
- The markdown & html sanitizing code is _not_ safe for automated use. Always validate the docs before you publish them.
- Bullets are differently laid out in html specifically with regards to inline paragraph and image content, because of the differences between gdocs and html in this regard.## Author
Erik Hollensbe