{"id":22428340,"url":"https://github.com/momsfriendlydevco/embed-gdocs","last_synced_at":"2026-03-07T08:02:01.205Z","repository":{"id":63389508,"uuid":"567511825","full_name":"MomsFriendlyDevCo/embed-gdocs","owner":"MomsFriendlyDevCo","description":"Simple, agnostic component to embed a Google Doc into a webpage","archived":false,"fork":false,"pushed_at":"2024-07-12T03:30:40.000Z","size":311,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-22T06:01:59.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/MomsFriendlyDevCo.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":"2022-11-18T00:15:57.000Z","updated_at":"2024-07-12T03:30:44.000Z","dependencies_parsed_at":"2023-02-16T14:00:23.489Z","dependency_job_id":"09b3b310-46ed-4527-83b5-4759e1948aeb","html_url":"https://github.com/MomsFriendlyDevCo/embed-gdocs","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":0.1578947368421053,"last_synced_commit":"9f535b1a47102188a8ff713024aab8a81ddeac73"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MomsFriendlyDevCo/embed-gdocs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fembed-gdocs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fembed-gdocs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fembed-gdocs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fembed-gdocs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MomsFriendlyDevCo","download_url":"https://codeload.github.com/MomsFriendlyDevCo/embed-gdocs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fembed-gdocs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-12-05T20:14:28.898Z","updated_at":"2026-03-07T08:02:01.166Z","avatar_url":"https://github.com/MomsFriendlyDevCo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"@MomsFriendlyDevCo/Embed-GDocs\n==============================\nSimple, agnostic component to embed a Google Doc into a webpage.\n\nFeatures:\n* Simple API to include a Google-Doc embed within any webpage\n* Platform and framework agnostic - works as plain JS with no dependencies\n* Included fixes for common issues with embeds (various style fixes, unminify links, retarget links to open in other tags)\n\n\n```html\n\u003chtml\u003e\n\u003chead\u003e\n\t\u003ctitle\u003e@MomsFriendlyDevCo/Embed-GDocs Example\u003c/title\u003e\n\t\u003cscript src=\"/dist/embed-gdocs.js\"\u003e\u003c/script\u003e\n\t\u003cscript type=\"module\"\u003e\n\timport embedGDoc from '/dist/embed-gdocs.js';\n\n\twindow.addEventListener('load', ()=\u003e {\n\t\tembedGDoc({\n\t\t\tselector: '#gdoc',\n\t\t\turl: 'https://docs.google.com/document/d/e/2PACX-1vTasmjm8_rI_tzzzMs0xl5AhjafHXCPs33uyq6VShbMepnlkumS9rDBkxbEs0AAoAtdMRm-dmoGXxbR/pub?embedded=true',\n\t\t});\n\t});\n\t\u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\t\u003cdiv id=\"gdoc\"\u003e\u003c/div\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\nAPI\n===\n\nembedGDoc(url, options)\n-----------------------\n```javascript\nimport embedGDoc from '@momsfriendlydevco/embed-gdoc';\n```\n\nInsert a Google document within a given element.\n\nOptions are:\n\n| Option                | Type                     | Default        | Description                                                                                                                                                              |\n|-----------------------|--------------------------|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `selector`            | `String` / `HTMLElement` |                | Either the DOM node to replace or a selector to use                                                                                                                      |\n| `url`                 | `String`                 |                | The Google Docs published URL to embed - this generally ends in `/pub?embedded=true`                                                                                     |\n| `urlOptions`          | `Object`                 |                | Additional Fetch options when retrieving the document from the `url`                                                                                                     |\n| `keepStyle`           | `Boolean`                | `true`         | Keep the source document style, if false this removes the style completely                                                                                               |\n| `fixContentTrim`      | `Boolean`                | `true`         | Remove the outer wrapping of the element and just use the embedded content                                                                                               |\n| `fixWidth`            | `Boolean`                | `true`         | Remove page width restrictions                                                                                                                                           |\n| `fixParaMargins`      | `Boolean`                | `true`         | Add slight margin to paragraphs                                                                                                                                          |\n| `fixTableWidth`       | `Boolean`                | `true`         | Remove table width restrictions                                                                                                                                          |\n| `fixPadding`          | `Boolean`                | `true`         | Remove page padding                                                                                                                                                      |\n| `fixLinkTargets`      | `Boolean`                | `true`         | Make all links open in a new tab instead of replacing the current one                                                                                                    |\n| `fixLinkShorten`      | `Boolean`                | `true`         | Remove Google tracking URL prefix from links                                                                                                                             |\n| `fixImageTitleAsLink` | `Boolean`                | `true`         | If an image \"alternative text\" (actually the `title` attribute) looks like a link make the image linkable - this is to fix how Google Docs weirdly handles image linking |\n| `onLoad`              | `Function`               | `html =\u003e html` | Called as `(html:String)` when the HTML has been loaded, expected to return the mutated input                                                                            |\n| `onMount`             | `Function`               | `el =\u003e null`   | Called as `(el:DomElement)` when the Dom element has been created but has not yet been added into the DOM, can mutate the input element                                  |\n\n\nclean(html, options)\n--------------------\n```javascript\nimport {clean} from '@momsfriendlydevco/embed-gdoc';\n// OR\nimport clean from '@momsfriendlydevco/embed-gdoc/clean';\n```\n\nTake input HTML and return a \"clean\" version of the same fixing various issues.\nThis is the actual worker of the other supplied functions.\n\nOptions are inherited from `embedGDoc()` but also include:\n\n| Option          | Type       | Default                  | Description                 |\n|-----------------|------------|--------------------------|-----------------------------|\n| `createElement` | `Function` | `document.createElement` | How to create DOM fragments |\n\n\nhtml(html, options)\n-------------------\n```javascript\nimport {html} from '@momsfriendlydevco/embed-gdoc';\n// OR\nimport html from '@momsfriendlydevco/embed-gdoc/html';\n```\n\nSimilar to `embedGDoc()` but return only the resulting HTML.\nThis function is used mainly for backend scripts which wish to clean up the resulting HTML before serving it directly.\n\nOptions are inherited from `embedGDoc()` + `clean()`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Fembed-gdocs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomsfriendlydevco%2Fembed-gdocs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Fembed-gdocs/lists"}