{"id":21831710,"url":"https://github.com/w99910/html-to-table","last_synced_at":"2026-02-27T02:30:58.270Z","repository":{"id":251979346,"uuid":"839032505","full_name":"w99910/html-to-table","owner":"w99910","description":"Convert almost html layout to email-compatible table layout.","archived":false,"fork":false,"pushed_at":"2024-08-17T10:08:45.000Z","size":1195,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T07:20:46.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://w99910.github.io/html-to-table/","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/w99910.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":"2024-08-06T20:38:27.000Z","updated_at":"2024-08-17T10:08:49.000Z","dependencies_parsed_at":"2024-08-06T23:55:17.801Z","dependency_job_id":"961a7843-73b1-460a-929e-5cd98c21066c","html_url":"https://github.com/w99910/html-to-table","commit_stats":null,"previous_names":["w99910/html-to-table"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/w99910/html-to-table","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w99910%2Fhtml-to-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w99910%2Fhtml-to-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w99910%2Fhtml-to-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w99910%2Fhtml-to-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w99910","download_url":"https://codeload.github.com/w99910/html-to-table/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w99910%2Fhtml-to-table/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29883101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-11-27T19:14:31.065Z","updated_at":"2026-02-27T02:30:58.256Z","avatar_url":"https://github.com/w99910.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTML To Email-Compatible Table\n\n![cover](cover.png)\n\n\u003e DEMO: https://w99910.github.io/html-to-table/\n\n### It's zero dependency and light-weight.\n\nI have been trying to send emails using html layout but there are lots of html elements and styles that email clients\ndon't support.\n\nSo I am working on this library to convert almost html layout to email-compatible table layout.\n\n\u003e Note: I don't guarantee that this library can convert any html element to your desired layout all the time. Feel free to tune the result as you want.\n\n## Installation\n\nChoose one of the following methods.\n- NPM\n```\nnpm i html-to-table\n```\n\n- Github ESM Module\n```\nimport HTML2Table from 'https://github.com/w99910/html-to-table/blob/master/dist/html-to-table.js'\n```\n\n- Github CJS\n\n```js\nconst HTML2Table = require('https://github.com/w99910/html-to-table/blob/master/dist/html-to-table.cjs')\n```\n\n\n## Usage\n\nIt is pretty straight-forward to use.\n\n- Initialise the class\n\n```js\nlet html2table = new HTML2Table();\n```\n\n- (Optional) - You can filter the elements you don't want to include in the output using Regex Expression\n  This checks the `class` name and `id`.\n\n```js\nhtml2table.excludeElementByPattern('toolbar')\n```\n\n- Convert the element you want by calling `convert` and passing the element as parameter.\n\n```js\nhtml2table.convert(document.querySelector('your-element-to-convert'));\n```\n\n## Tips\n\n- I suggest you target mobile device layout first so that the layout will work both on mobile and desktop.\n- `Base64` image data does not work. So host the image on cloud and use it.\n- Don't use `linear-gradient` css function in inline css. Instead, create the gradient as an image and load it using `url`.\n    ```js\n    style=\"background: url('link-to-your-image')\"\n    ```\n- Use `background-color` as a fall-back background color if image would not be working in some email clients.\n- Skip using `height` property if possible since it can prevent uninteneded padding or margin.\n\n## To-DO\n\n- [ ] Converting `rem` doesn't render exactly as it is.\n- [x] even if only `border-top` is provided, all border is being rendered.\n- [x] Change the logic for `v-align` as it is giving unnecessary vertical space.\n## LICENSE\n[MIT License](LICENSE)\n\n## Articles\n\n- [Medium Article](https://medium.com/@thomasbrillion/html-to-email-compatible-table-%EF%B8%8F-fb33481d231b)\n- [Dev.to](https://dev.to/thomas_brillion/html-to-email-31k9)\n\n## CHANGELOG\n\n- **0.1.4**\n  - Drop setting `height` css property for the parent.\n  - Remove `v-align` in the output. Please tweak the output as you want.\n  - `Height` property is converted to `auto` for child nodes unless you unexplictly set it as inlined css.\n  - Append the bounding rect width as the `width` style when tranversing the child nodes. \n  - Consider the styles of the embedding classes before get the window's computed styles.\n- **0.1.2**\n  - Add `bgcolor` attribute for fall-back `background` css style.\n  - `align` and `valign` of table now consider the css properties of parent element. if there is no parent element, default value will be used. \n  -  Deprecated feature that convert SVG to Base64 PNG. \n- **0.1.1** \n  - Add `alt` and `title` to allowed attribute when it is cloned. \n  - Fix `width` being `0` in some cases.\n- **0.1.0** - Rewrite the logic by using bounding client rect to determine the layout\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw99910%2Fhtml-to-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw99910%2Fhtml-to-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw99910%2Fhtml-to-table/lists"}