Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
2 added 8 characters in body
source | link

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

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.

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.

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
source | link

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.