Skip to content

Commit 2348915

Browse files
committed
Readme fix
1 parent 2db4a6e commit 2348915

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Cheerio-tableparser parse HTML tables, group them by columns, with colspan and r
1818
| | | 4b | 5b |
1919
| | 2b |-----------|
2020
| 1a | | | 5c |
21-
| |-----------| 4c |---- |
21+
| |-----------| 4c |-----|
2222
| | | 3d | | 5d |
2323
| | 2d |-----------------|
2424
| | | 3e | 4e | 5e |
@@ -39,7 +39,7 @@ $ = cheerio.load("<table id='complex'> \
3939
</table>");
4040

4141
cheerioTableparser($);
42-
var data = $("#complex").parsetable(true, true, false);
42+
var data = $("#complex").parsetable(true, true, true);
4343
//data = >
4444
//[ [ 'A', '1a', '1a', '1a', '1a', '1a' ],
4545
// [ 'B', '2a', '2b', '2b', '2d', '2d' ],
@@ -174,6 +174,17 @@ var data = $("#html").parsetable(false, false, false);
174174
//data = >
175175
//[ [ '<strong>A</strong>', '<div class="table-text">1a</div>' ],
176176
// [ '<strong>B</strong>', '<div class="table-text">2a</div>' ] ]
177+
178+
//To make jquery object from string use $('<div>' + data[0][0]+ '</div>');
179+
//additional "div" needed if data[0][0] is not valid html string.
180+
181+
//Example:
182+
var strong = $('<div>' + data[0][0] + '</div>').find('strong').text();
183+
//strong = > 'A'
184+
185+
var tableText = $('<div>' + data[0][1] + '</div>').find('.table-text').text();
186+
//tableText = > '1a'
187+
177188
```
178189

179190
#### Return data as Text

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cheerio-tableparser",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "The tables parser plugin for cheerio",
55
"main": "index.js",
66
"keywords": [

0 commit comments

Comments
 (0)