4

In Gmail, I can go to a web page, highlight web content, compose a Gmail message, and paste the HTML content into the email message. It works in Mail.app as well.

But what app can I use to just paste the HTML content and then save it as an HTML file?

Microsoft Word will accept pasted HTML content, but I don't want to save as gross weird Microsoft Word HTML markup. Is there an OSX app where I can easily paste and save copied HTML content from web pages?

2

Although this is an old question, it's still relevant, and here is the answer:

pbpaste -Prefer rtf | textutil -stdin -convert html -output outputfile.html

This uses the built-in OS X pbpaste utility to pipe the contents of the clipboard to stdout (-Prefer rtf is probably unnecessary but doesn't hurt), then runs it through the built-in textutil program. The -stdin argument makes textutil take its input from pbpaste; -convert html tells it to turn the input into HTML; and -output outputfile.html tells it to write the output to a file called outputfile.html.

If you find that the output has some unnecessary elements, you can exclude them with -excludedelements; for example, -excludedelements '(span, font, head, xml)'. Note that you need to have the single quotes because your shell will try to interpret the parentheses as a special shell expression.

  • 1
    A similar answer would be to paste it into a TextEdit "Rich Text" document. You do get some HTML garbage, but it's not bad. Using textutil to convert from html to html is clever. I'd tried using tidy but it didn't help as much as I thought it would. – TJ Luoma Sep 21 at 19:16
0

Why not just save the page using the browser?

  1. File → Save As… (⌘S)

  2. Choose Page Source or Web Archive

  • 1
    because web pages are filled with garbage and ads? there's no reason I would want to save all that content. Also I want to aggregate content from many different web pages. – incandescentman Feb 8 '14 at 21:58

You must log in to answer this question.

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