File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ A simple converter that parses HTML and returns beautiful text. It was mainly de
16
16
npm install html-to-text
17
17
```
18
18
19
+ Or when you want to use it as command line interface it is recommended to install it globally via
20
+
21
+ ```
22
+ npm install html-to-text -g
23
+ ```
24
+
19
25
## Usage
20
26
You can read from a file via:
21
27
@@ -55,13 +61,13 @@ It is possible to use html-to-text as command line interface. This allows an eas
55
61
` html-to-text ` uses ` stdin ` and ` stdout ` for data in and output. So you can use ` html-to-html ` the following way:
56
62
57
63
```
58
- cat examples /test.html | html-to-text > test.txt
64
+ cat example /test.html | html-to-text > test.txt
59
65
```
60
66
61
67
There also all options available as described above. You can use them like this:
62
68
63
69
```
64
- cat examples /test.html | html-to-text --tables=#invoice,.address --wordwrap=100 > test.txt
70
+ cat example /test.html | html-to-text --tables=#invoice,.address --wordwrap=100 > test.txt
65
71
```
66
72
67
73
The ` tables ` option has to be declared as comma separated list without whitespaces.
Original file line number Diff line number Diff line change @@ -14,11 +14,10 @@ process.stdin.on('data', function data(data) {
14
14
text += data ;
15
15
} ) ;
16
16
17
- process . stdout . setEncoding ( 'utf8' ) ;
18
17
process . stdin . on ( 'end' , function end ( ) {
19
18
text = htmlToText . fromString ( text , {
20
19
tables : argv . tables . split ( ',' ) ,
21
20
wordwrap : argv . wordwrap
22
21
} ) ;
23
- process . stdout . write ( text + '\n' ) ;
22
+ process . stdout . write ( text + '\n' , 'utf-8' ) ;
24
23
} ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " html-to-text" ,
3
- "version" : " 0.0.5 " ,
3
+ "version" : " 0.0.6 " ,
4
4
"description" : " Simple html to plain text converter" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
23
23
" converter"
24
24
],
25
25
"engines" : {
26
- "node" : " * "
26
+ "node" : " ~0.8.0 "
27
27
},
28
28
"bin" : {
29
29
"html-to-text" : " ./bin/cli.js"
You can’t perform that action at this time.
0 commit comments