{"id":29429597,"url":"https://github.com/show-docs/rehype-extended-table","last_synced_at":"2025-07-12T16:11:37.935Z","repository":{"id":171990044,"uuid":"648159655","full_name":"show-docs/rehype-extended-table","owner":"show-docs","description":"Rehype plugin to support table syntax allowing colspan / rowspan","archived":false,"fork":false,"pushed_at":"2024-05-25T08:38:54.000Z","size":271,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T11:04:49.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/show-docs.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,"zenodo":null}},"created_at":"2023-06-01T10:41:40.000Z","updated_at":"2024-05-25T08:38:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"b23ecbdf-ed70-4e85-8435-e2f53b2adda6","html_url":"https://github.com/show-docs/rehype-extended-table","commit_stats":null,"previous_names":["nice-move/rehype-extended-table"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/show-docs/rehype-extended-table","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/show-docs%2Frehype-extended-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/show-docs%2Frehype-extended-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/show-docs%2Frehype-extended-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/show-docs%2Frehype-extended-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/show-docs","download_url":"https://codeload.github.com/show-docs/rehype-extended-table/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/show-docs%2Frehype-extended-table/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265018286,"owners_count":23698650,"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":[],"created_at":"2025-07-12T16:11:32.797Z","updated_at":"2025-07-12T16:11:37.899Z","avatar_url":"https://github.com/show-docs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rehype-extended-table\n\nRehype plugin to support table syntax allowing colspan / rowspan.\n\n[![npm][npm-badge]][npm-url]\n[![github][github-badge]][github-url]\n![node][node-badge]\n\n[npm-url]: https://www.npmjs.com/package/rehype-extended-table\n[npm-badge]: https://img.shields.io/npm/v/rehype-extended-table.svg?style=flat-square\u0026logo=npm\n[github-url]: https://github.com/nice-move/rehype-extended-table\n[github-badge]: https://img.shields.io/npm/l/rehype-extended-table.svg?style=flat-square\u0026colorB=blue\u0026logo=github\n[node-badge]: https://img.shields.io/node/v/rehype-extended-table.svg?style=flat-square\u0026colorB=green\u0026logo=node.js\n\n## Feature\n\n- support [extended table syntax][] of [markdown-preview-enhanced][] which allows colspan / rowspan cells\n- same base syntax support with [remark-extended-table]\n\n```markdown\n| Head 1 | Head 2 | Head 3 | Head 4 | Head 5 |\n| ------ | ------ | ------ | ------ | ------ |\n| \u003e      | (2x1)  | Cell   | Cell   | Cell   |\n| (1x3)  | \u003e      | (2x2)  | \u003e      | (2x2)  |\n| ^      | \u003e      | ^      | Cell   | Cell   |\n| ^      | \u003e      | \u003e      | (3x1)  | Cell   |\n```\n\n↓↓\n\n```html\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eHead 1\u003c/th\u003e\n      \u003cth\u003eHead 2\u003c/th\u003e\n      \u003cth\u003eHead 3\u003c/th\u003e\n      \u003cth\u003eHead 4\u003c/th\u003e\n      \u003cth\u003eHead 5\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd colspan=\"2\"\u003e(2x1)\u003c/td\u003e\n      \u003ctd\u003eCell\u003c/td\u003e\n      \u003ctd\u003eCell\u003c/td\u003e\n      \u003ctd\u003eCell\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd rowspan=\"3\"\u003e(1x3)\u003c/td\u003e\n      \u003ctd colspan=\"2\" rowspan=\"2\"\u003e(2x2)\u003c/td\u003e\n      \u003ctd colspan=\"2\"\u003e(2x2)\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eCell\u003c/td\u003e\n      \u003ctd\u003eCell\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd colspan=\"3\"\u003e(3x1)\u003c/td\u003e\n      \u003ctd\u003eCell\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n```\n\n[remark-gfm]: https://github.com/remarkjs/remark-gfm\n[remark-extended-table]: https://www.npmjs.com/package/remark-extended-table\n[extended table syntax]: https://shd101wyy.github.io/markdown-preview-enhanced/#/markdown-basics?id=table\n[markdown-preview-enhanced]: https://github.com/shd101wyy/markdown-preview-enhanced\n\n## Installation\n\n```bash\nnpm install rehype-extended-table --save-dev\n```\n\n## Usage\n\n```js\nimport { rehypeExtendedTable } from 'rehype-extended-table';\nimport rehypeStringify from 'rehype-stringify';\nimport remarkGFM from 'remark-gfm';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport { unified } from 'unified';\n\nunified()\n  .use(remarkParse)\n  .use(remarkGFM)\n  .use(remarkRehype)\n  .use(rehypeExtendedTable)\n  .use(rehypeStringify)\n  .process(markdown);\n```\n\n### Options\n\n[remark-extended-table]: https://www.npmjs.com/package/remark-extended-table\n\n#### options.mergeTo\n\n- enum: ['right', 'left']\n- default: 'right'\n- description: Direction of table merge columns, using `right` is same as [remark-extended-table], using `left` is same as Excel.\n\nWhen using `left`, Write:\n\n```markdown\n| Head 1 | Head 2 | Head 3 | Head 4 | Head 4 |\n| :----: | :----: | :----: | :----: | :----: |\n| (2x1)  |   \u003c    |  Cell  |  Cell  |  Cell  |\n| (1x3)  | (2x2)  |   \u003c    | (2x2)  |   \u003c    |\n|   ^    |   ^    |   \u003c    |  Cell  |  Cell  |\n|   ^    | (3x1)  |   \u003c    |   \u003c    |  Cell  |\n```\n\n## Tips\n\n### Why do I need this plugin?\n\n[remark-extended-table] is good, but it wiil overrides [remark-gfm] behaviors, and have to inject handlers to [remark-rehype](https://www.npmjs.com/package/remark-rehype):\n\n```js\nimport rehypeStringify from 'rehype-stringify';\nimport {\n  extendedTableHandlers,\n  remarkExtendedTable\n} from 'remark-extended-table';\nimport remarkGfm from 'remark-gfm';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport { unified } from 'unified';\n\nunified()\n  .use(remarkParse)\n  .use(remarkGfm)\n  .use(remarkExtendedTable)\n  .use(remarkRehype, null, {\n    handlers: {\n      ...extendedTableHandlers\n    }\n  })\n  .use(rehypeStringify)\n  .process(markdown);\n```\n\nSome times we can't do that, you can use this plugin instead.\n\nFor example, in [Docusaurus](https://docusaurus.io/) projects:\n\n```mjs\n// docusaurus.config.mjs\nimport { rehypeExtendedTable } from 'rehype-extended-table';\n\nexport default {\n  presets: [\n    [\n      'classic',\n      {\n        docs: {\n          rehypePlugins: [\n            [\n              rehypeExtendedTable,\n              {\n                // ...options here\n              }\n            ]\n          ]\n        }\n      }\n    ]\n  ]\n};\n```\n\n### Different with `rehype-table-merge`\n\n- rehype-extended-table support MDX props name by default.\n- rehype-extended-table can handle complex [merge case](./test/fixtures/1.md) without bug\n- support `options.mergeTo`\n\n## Related\n\n- [markdown-code-block-meta](https://github.com/nice-move/markdown-code-block-meta)\n- [remark-code-example](https://github.com/nice-move/remark-code-example)\n- [remark-kroki](https://github.com/nice-move/remark-kroki)\n- [remark-docusaurus](https://github.com/nice-move/remark-docusaurus)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshow-docs%2Frehype-extended-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshow-docs%2Frehype-extended-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshow-docs%2Frehype-extended-table/lists"}