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
1616npm install html-to-text
1717```
1818
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+
1925## Usage
2026You can read from a file via:
2127
@@ -55,13 +61,13 @@ It is possible to use html-to-text as command line interface. This allows an eas
5561` html-to-text ` uses ` stdin ` and ` stdout ` for data in and output. So you can use ` html-to-html ` the following way:
5662
5763```
58- cat examples /test.html | html-to-text > test.txt
64+ cat example /test.html | html-to-text > test.txt
5965```
6066
6167There also all options available as described above. You can use them like this:
6268
6369```
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
6571```
6672
6773The ` 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) {
1414 text += data ;
1515} ) ;
1616
17- process . stdout . setEncoding ( 'utf8' ) ;
1817process . stdin . on ( 'end' , function end ( ) {
1918 text = htmlToText . fromString ( text , {
2019 tables : argv . tables . split ( ',' ) ,
2120 wordwrap : argv . wordwrap
2221 } ) ;
23- process . stdout . write ( text + '\n' ) ;
22+ process . stdout . write ( text + '\n' , 'utf-8' ) ;
2423} ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " html-to-text" ,
3- "version" : " 0.0.5 " ,
3+ "version" : " 0.0.6 " ,
44 "description" : " Simple html to plain text converter" ,
55 "main" : " index.js" ,
66 "scripts" : {
2323 " converter"
2424 ],
2525 "engines" : {
26- "node" : " * "
26+ "node" : " ~0.8.0 "
2727 },
2828 "bin" : {
2929 "html-to-text" : " ./bin/cli.js"
You can’t perform that action at this time.
0 commit comments