6

From Firefox, I downloaded a .html file, with a directory with name ended in _files, by specifying "Webpage, Complete". When open the .html in emacs, even under html-mode, only the source of the html file is displayed, and the webpage is not rendered. How can I render a downloaded html file inside Emacs? It will also be the best that the files under the _files dir is also used in the rendering, but I am only need to read text most of the time.

I am mainly looking form some light-weight (even text) application rather than full-fledged one, because I have opened too many webpages in both Firefox and Chrome, and they take up too much resources.

Is it the same as browsing a webpage via its URL?

1
  • Is it the same as browsing by URL? Strictly speaking, no. Nowadays many (most?) pages are rendered somewhat dynamically. Interpretive code reads databases, and/or javascript modifies right on your browser to include fonts, what your screen size is, check licensing... That being said, a copy saved from Firefox should be pretty much a snapshot of what you saw at the moment the page was saved. (qualified enough?)
    – ericx
    Aug 8, 2014 at 23:55

3 Answers 3

4

I think you will get what you want with w3 (http://elpa.gnu.org/packages/w3.html). It's an emacs web browser in lisp. It still looks like a web-page rendered in emacs...

2

Emacs is an text editor, so the typical use case is to use Emacs to edit the HTML files, and not render them.

Use a browser to render them. Modern web pages are so complex that it is nontrivial to write a fully correct renderer, so you would most likely be disappointed even with w3.

2
  • 1
    I am mainly looking form some light-weight (even text) application rather than full-fledged one, because I have opened too many webpages in both Firefox and Chrome, and they take up too much resources.
    – Tim
    Aug 9, 2014 at 13:49
  • Look into the “links” command then. Mar 6, 2020 at 22:03
2

You can use the eww browser to do this, it's included in emacs.

Running eww-open-file does the trick for me. It renders the HTML of course, but it may not be exactly like HTML rendered online via firefox.

It's great for reading webpages offline though, and the focus is on the text. You can also enable proportional fonts with S-f to make the text easier on your eyes.

Eww is great for reading web content that is formatted how you like to read it.

You can also set up a function to toggle whether images display or not, as discussed here: https://emacs.stackexchange.com/questions/561/how-can-i-toggle-displaying-images-in-eww-without-a-page-refresh.

Finally, if you open an HTML file in emacs and it shows you the code, you are probably in HTML mode, from there you can use C-c C-v to view it rendered in EWW.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .