Parsing table element of Cheerio into 2D array.
[![License][license_badge]][license] [![Pipelines][pipelines_badge]][pipelines] [![Coverage][coverage_badge]][pipelines] [![NPM][npm_badge]][npm]
Parsing table element of Cheerio into 2D array.
```
npm install @joshuaavalon/cheerio-table-parser
`typescript
import cheerio from "cheerio";
import { parseTable } from "@joshuaavalon/cheerio-table-parser";
const dom = cheerio.load(html);
table = parseTable(dom("table")[0], {
parser: (element) => cheerio(element).text(),
});
/*
[
["A", "B", "C", "D", "E"],
["1a", "2a", "3a", "4a", "5a"],
["1a", "2b", "2b", "4b", "5b"],
["1a", "2b", "2b", "4c", "5c"],
["1a", "2d", "3d", "4c", "5d"],
["1a", "2d", "3e", "4e", "5e"]
]
*/
`
According to [HTML table specifications][table], it depends on how user agent render the table. Most browsers render it as overlapping cell.
However, this is not possible in this library. Therefore, it will favour rowspan over colspan.
,
, should be handled separately. This is not consider in this library. However, you can pass in instead of