How can I preview HTML documents from the command line?
One solution is to use lynx -dump
, as in
lynx -dump file.html
or
echo "<div>this is a div</div>" | lynx -dump -stdin
Better:
Use w3m -dump
, it respects the page layout. It is awesome.
sudo aptitude install w3m
w3m -dump file.html
echo "<div>x</div>" | w3m -dump -T text/html
You can set the number of columns of the terminal for getting the better layout, for example, if you are using a full-window terminal, 200 can be a good try:
w3m -dump -cols 200 file.html
You can use html2text
to look into an HTML document from command line.
sudo apt-get install html2text
html2text Webpage.html | less
but not exactly a look similar to man pages, it depends on the html input, of course.