{"id":17880669,"url":"https://github.com/benjamincharity/rehype-enhanced-tables","last_synced_at":"2025-08-08T04:13:18.027Z","repository":{"id":221890187,"uuid":"755693318","full_name":"benjamincharity/rehype-enhanced-tables","owner":"benjamincharity","description":"A Rehype plugin that modifies HTML tables, with support for caption, footer, custom classes, scroll-wrappers, and scopes.","archived":false,"fork":false,"pushed_at":"2024-02-10T21:24:07.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-06T15:08:06.650Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/benjamincharity.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}},"created_at":"2024-02-10T20:28:37.000Z","updated_at":"2024-02-10T21:16:28.000Z","dependencies_parsed_at":"2024-02-10T21:24:50.059Z","dependency_job_id":"b1886641-4575-4cc2-810f-86135cf84606","html_url":"https://github.com/benjamincharity/rehype-enhanced-tables","commit_stats":null,"previous_names":["benjamincharity/rehype-enhanced-tables"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/benjamincharity/rehype-enhanced-tables","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincharity%2Frehype-enhanced-tables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincharity%2Frehype-enhanced-tables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincharity%2Frehype-enhanced-tables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincharity%2Frehype-enhanced-tables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjamincharity","download_url":"https://codeload.github.com/benjamincharity/rehype-enhanced-tables/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincharity%2Frehype-enhanced-tables/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269361852,"owners_count":24404432,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"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-10-28T12:27:03.489Z","updated_at":"2025-08-08T04:13:17.061Z","avatar_url":"https://github.com/benjamincharity.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rehype-enhanced-tables\n\n![test workflow](https://github.com/benjamincharity/rehype-enhanced-tables/actions/workflows/test.yml/badge.svg)\n[![codecov](https://codecov.io/gh/benjamincharity/rehype-enhanced-tables/branch/main/graph/badge.svg?token=T3Z18P56LV)](https://codecov.io/gh/benjamincharity/rehype-enhanced-tables)\n![NPM Version](https://img.shields.io/npm/v/@benjc/rehype-enhanced-tables)\n\nA Rehype plugin that modifies HTML tables, with support for caption, footer, custom classes, scroll-wrappers, and scopes.\n\n## Install\n\n```\nnpm i -D @benjc/rehype-enhanced-tables\n```\n\n## Usage\n\n```typescript\nimport rehypeEnhancedTables from \"@benjc/rehype-enhanced-tables\";\nimport rehype from \"rehype\";\nimport rehypeParse from \"rehype-parse\";\nimport { unified } from \"unified\";\n\nconst tableStruct = `\n| heading | b  |  c |  d  |\n| -: | -: | -: | :-: |\n| cell 1 | cell 2 | 3 | 4 |\n`;\n\nunified()\n  .use(rehypeParse, { fragment: true })\n  .use(rehypeEnhancedTables)\n  .process(tableStruct);\n\n// Or with options:\nunified()\n  .use(rehypeParse, { fragment: true })\n  .use(rehypeEnhancedTables, {\n    disableWrapper: true,\n    classes: {\n      table: \"custom-class\",\n      cell: \"custom-cell\",\n      ...\n    },\n  })\n  .process(tableStruct);\n```\n\n### Input\n\n```html\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eOne\u003c/th\u003e\n      \u003cth\u003eTwo\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eCell 1\u003c/td\u003e\n      \u003ctd\u003eCell 2\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eCell 3\u003c/td\u003e\n      \u003ctd\u003eCell 4\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n```\n\n### Output\n\n```html\n\u003cdiv class=\"ret-table-wrapper\"\u003e\n  \u003ctable class=\"ret-table\"\u003e\n    \u003cthead class=\"ret-table-thead\"\u003e\n      \u003ctr class=\"ret-table-row\"\u003e\n        \u003cth scope=\"col\" class=\"ret-table-th\"\u003eOne\u003c/th\u003e\n        \u003cth scope=\"col\" class=\"ret-table-th\"\u003eTwo\u003c/th\u003e\n      \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody class=\"ret-table-body\"\u003e\n      \u003ctr class=\"ret-table-row\"\u003e\n        \u003ctd class=\"ret-table-cell\"\u003eCell 1\u003c/td\u003e\n        \u003ctd class=\"ret-table-cell\"\u003eCell 2\u003c/td\u003e\n      \u003c/tr\u003e\n      \u003ctr class=\"ret-table-row\"\u003e\n        \u003ctd class=\"ret-table-cell\"\u003eCell 3\u003c/td\u003e\n        \u003ctd class=\"ret-table-cell\"\u003eCell 4\u003c/td\u003e\n      \u003c/tr\u003e\n    \u003c/tbody\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n```\n\n## Options\n\nThe `rehype-enhanced-tables` plugin accepts an `options` object with the following properties:\n\n| Option           | Type                                         | Description                                                                                                                                                          |\n| ---------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `disableWrapper` | `boolean`                                    | If set to `true`, the plugin will not wrap the table with a div.                                                                                                     |\n| `classes`        | `Partial\u003cRehypeEnhancedTableElementClasses\u003e` | An object that maps element types to class names. The keys can be any of the following: `caption`, `footer`, `table`, `tbody`, `td`, `th`, `thead`, `tr`, `wrapper`. |\n\nThese options can be passed to the `rehype-enhanced-tables` plugin as part of the `options` object. For example:\n\n```typescript\nimport rehypeEnhancedTables from \"./index\";\n\nrehypeEnhancedTables({\n  disableWrapper: true,\n  classes: {\n    caption: \"custom-caption\",\n    table: \"custom-table\",\n    tbody: \"custom-tbody\",\n    td: \"custom-td\",\n    tfoot: \"custom-tfoot\",\n    th: \"custom-th\",\n    thead: \"custom-thead\",\n    tr: \"custom-tr\",\n    wrapper: \"custom-wrapper\",\n  },\n});\n```\n\n## License\n\n[MIT][license] © [benjamincharity][author]\n\n[license]: license\n[author]: https://www.benjamincharity.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjamincharity%2Frehype-enhanced-tables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjamincharity%2Frehype-enhanced-tables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjamincharity%2Frehype-enhanced-tables/lists"}