{"id":15645270,"url":"https://github.com/anandchowdhary/docs-markdown","last_synced_at":"2025-07-06T00:09:13.823Z","repository":{"id":38174973,"uuid":"256305961","full_name":"AnandChowdhary/docs-markdown","owner":"AnandChowdhary","description":"📝 Convert a Google Docs file (API response) to Markdown","archived":false,"fork":false,"pushed_at":"2024-07-15T21:51:56.000Z","size":560,"stargazers_count":63,"open_issues_count":10,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-06T00:09:11.391Z","etag":null,"topics":["google","google-docs","google-drive","markdown","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://anandchowdhary.github.io/docs-markdown/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnandChowdhary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-16T19:08:22.000Z","updated_at":"2025-07-02T02:11:38.000Z","dependencies_parsed_at":"2024-10-03T12:09:43.830Z","dependency_job_id":"b2be62b4-d1f7-4673-b4fd-6e957c0b5e2d","html_url":"https://github.com/AnandChowdhary/docs-markdown","commit_stats":{"total_commits":31,"total_committers":5,"mean_commits":6.2,"dds":0.3870967741935484,"last_synced_commit":"6bd4f2f4d564bc9f225f03cdbcb42522c924cac3"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":"AnandChowdhary/node.ts","purl":"pkg:github/AnandChowdhary/docs-markdown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Fdocs-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Fdocs-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Fdocs-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Fdocs-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnandChowdhary","download_url":"https://codeload.github.com/AnandChowdhary/docs-markdown/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Fdocs-markdown/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263828726,"owners_count":23516791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","google-docs","google-drive","markdown","nodejs","typescript"],"created_at":"2024-10-03T12:05:36.848Z","updated_at":"2025-07-06T00:09:13.790Z","avatar_url":"https://github.com/AnandChowdhary.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📝 Docs Markdown\n\nConvert a Google Docs file (API response) to Markdown\n\n[![Node CI](https://img.shields.io/github/workflow/status/AnandChowdhary/docs-markdown/Node%20CI?label=GitHub%20CI\u0026logo=github)](https://github.com/AnandChowdhary/docs-markdown/actions)\n[![Travis CI](https://img.shields.io/travis/AnandChowdhary/docs-markdown?label=Travis%20CI\u0026logo=travis%20ci\u0026logoColor=%23fff)](https://travis-ci.org/AnandChowdhary/docs-markdown)\n[![Coverage](https://coveralls.io/repos/github/AnandChowdhary/docs-markdown/badge.svg?branch=master\u0026v=2)](https://coveralls.io/github/AnandChowdhary/docs-markdown?branch=master)\n[![Dependencies](https://img.shields.io/librariesio/release/npm/docs-markdown)](https://libraries.io/npm/docs-markdown)\n[![License](https://img.shields.io/npm/l/docs-markdown)](https://github.com/AnandChowdhary/docs-markdown/blob/master/LICENSE)\n[![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/docs-markdown.svg)](https://snyk.io/test/npm/docs-markdown)\n[![Based on Node.ts](https://img.shields.io/badge/based%20on-node.ts-brightgreen)](https://github.com/AnandChowdhary/node.ts)\n[![npm type definitions](https://img.shields.io/npm/types/docs-markdown.svg)](https://unpkg.com/browse/docs-markdown/dist/index.d.ts)\n[![npm package](https://img.shields.io/npm/v/docs-markdown.svg)](https://www.npmjs.com/package/node.ts)\n[![npm downloads](https://img.shields.io/npm/dw/docs-markdown)](https://www.npmjs.com/package/node.ts)\n[![Contributors](https://img.shields.io/github/contributors/AnandChowdhary/docs-markdown)](https://github.com/AnandChowdhary/docs-markdown/graphs/contributors)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n[![npm](https://nodei.co/npm/docs-markdown.png)](https://www.npmjs.com/package/docs-markdown)\n\n## 💡 Usage\n\nInstall the package from [npm](https://www.npmjs.com/package/docs-markdown):\n\n```bash\nnpm install docs-markdown\n```\n\n### API\n\nThe `fetchGoogleDocsFiles` helper can download a document from Google Docs and save it as a markdown file:\n\n```ts\nimport { fetchGoogleDocsFiles } from \"docs-markdown\";\n\n// Google Docs document ID\nawait fetchGoogleDocsFiles([\"1UEUrJ98RXu9BNcFj3pMgiUALQpjIb8Y-gNu-YhlYvFQ\"]);\n\n// Google Docs document ID and file name\nawait fetchGoogleDocsFiles([\"1UEUrJ98RXu9BNcFj3pMgiUALQpjIb8Y-gNu-YhlYvFQ:filename.md\"]);\n\n// Multiple Google Docs documents (comma-separated string)\nawait fetchGoogleDocsFiles([\"documentId1\", \"documentId2\", \"documentId3\"]);\n```\n\nYou can also use the `googleDocsToMarkdown` function to manually convert documents:\n\n```ts\nimport { googleDocsToMarkdown } from \"docs-markdown\";\nimport { google } from \"googleapis\";\nimport { writeFileSync } from \"fs\";\nconst oauth2Client = new google.auth.OAuth2(); // Authenticate\n\nconst docs = google.docs(\"v1\");\nconst file = await docs.documents.get({\n  documentId: \"Google Docs document ID\",\n  auth: oauth2Client,\n});\n\nconst markdown = googleDocsToMarkdown(file.data);\nwriteFileSync(\"file.md\", markdown);\n```\n\n### CLI\n\nFetch files and save them as markdown:\n\n```bash\n# Google Docs document ID\ndocs-markdown fetch \"1UEUrJ98RXu9BNcFj3pMgiUALQpjIb8Y-gNu-YhlYvFQ\"\n\n# Google Docs document ID with file name\ndocs-markdown fetch \"1UEUrJ98RXu9BNcFj3pMgiUALQpjIb8Y-gNu-YhlYvFQ:filename.md\"\n\n# Multiple Google Docs documents\ndocs-markdown fetch \"documentId1, documentId2, documentId3\"\n\n# Convert a JSON document to markdown\ndocs-markdown convert \"path/to/file.json\"\n```\n\n### Authentication\n\nThe following environment variables are required to fetch files from Google Docs. They are not required when converting JSON documents to markdown:\n\n- `GOOGLE_DOCS_CLIENT_ID`\n- `GOOGLE_DOCS_CLIENT_SECRET`\n- `GOOGLE_DOCS_ACCESS`\n- `GOOGLE_DOCS_REFRESH`\n\nTo learn how to create a client ID and secret, read the article [Using OAuth 2.0 to Access Google APIs](https://developers.google.com/identity/protocols/oauth2). Once you've created them, create an access token and a refresh token, use the [OAuth 2.0 Playground](https://developers.google.com/oauthplayground/) with your client ID and secret.\n\n## ⭐️ Features\n\n- [x] Paragraphs\n- [x] Headings, titles, subtitles\n- [x] Bold, italic\n- [x] Lists\n- [x] Links\n- [ ] Images\n- [x] Tables\n- [ ] Header, footer\n\n## 🍳 Recipes\n\n### GitHub Actions + Google Docs CI\n\nIf you want to sync your Google Docs documents as markdown files to a GitHub repository, you can use this GitHub Actions workflow that runs every day, fetches your documents, and commit them to your repo. Make sure you have all the required environment variables stored as GitHub Secrets:\n\n```yml\nname: Google Docs\non:\n  schedule:\n    - cron: \"0 0 * * *\"\njobs:\n  release:\n    name: Fetch Google Docs\n    runs-on: ubuntu-18.04\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n      - name: Setup Node.js\n        uses: actions/setup-node@v1\n        with:\n          node-version: 12\n      - name: Download files\n        run: npx docs-markdown fetch \"1UEUrJ98RXu9BNcFj3pMgiUALQpjIb8Y-gNu-YhlYvFQ\"\n        env:\n          GOOGLE_DOCS_ACCESS: ${{ secrets.GOOGLE_DOCS_ACCESS }}\n          GOOGLE_DOCS_REFRESH: ${{ secrets.GOOGLE_DOCS_REFRESH }}\n          GOOGLE_DOCS_CLIENT_ID: ${{ secrets.GOOGLE_DOCS_CLIENT_ID }}\n          GOOGLE_DOCS_CLIENT_SECRET: ${{ secrets.GOOGLE_DOCS_CLIENT_SECRET }}\n      - name: Commit new data\n        uses: stefanzweifel/git-auto-commit-action@v4.1.1\n        with:\n          commit_message: \"Update Google Docs file\"\n          commit_user_name: GitHub Actions\n          commit_user_email: actions@github.com\n          commit_author: GitHub Actions \u003cactions@github.com\u003e\n```\n\n## 👩‍💻 Development\n\nBuild TypeScript:\n\n```bash\nnpm run build\n```\n\n## 📄 License\n\n[MIT](./LICENSE) © [Anand Chowdhary](https://anandchowdhary.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanandchowdhary%2Fdocs-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanandchowdhary%2Fdocs-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanandchowdhary%2Fdocs-markdown/lists"}