Fork me on GitHub


HTML Formatting with TextEdit

December 7, 2005 | Web Design & Development

I imagine that I’m not alone in my job duties of having to format long passages of text into html for inclusion in a web site. A lot of time can be wasted hand formatting lots of text with tables and lists. I was pretty surprised when I found that TextEdit in OS X 10.4 Tiger could save XTHML Strict pages with ISO-8859-1 or UTF character encodings and with embedded CSS. I stumbled on this ability in TextEdit while searching for an easy way of converting to numbered html entities instead of using named html entities (For what its worth, XML files don’t like named entities outside of the standard 5).

Hopefully I’m not going into something that the rest of you have found and that is painfully obvious by writing this.

It just takes a quick trip into the preferences to set up the correct settings for your environment (as illustrated below). Set your HTML output type, character encoding and type of CSS styling, open your document and save as an HTML file.

(story continues after image)


The file is constructed complete with a valid (X)HTML header. The only real drawback is that you’ll get <b> and <i> tags instead of <strong> and <em> and there is no way that I know of to change it. Another drawback, one that I won’t run into nearly as much is the use of align attributes for table cells. Since I don’t use tables much it won’t be too much of an issue.

I’ve been using this at work for a little while to format press releases for upload. Since I’m currently putting HTML into the database for press releases this works out perfectly (I’ve thought about implementing a bb-code style setup so other, non-experienced, users can upload press releases but that may wait for a while since this is saving so much time.

Now, I believe that this functionality is provided by the command line utility textutil so the next step could be to set up an automated system for batch processing files. Who knows… maybe I’ll get the time to play with that.

3 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  • hey, that’s pretty nifty. i might have to do that for quick stuff from now on.

    Tobias, December 19, 2005 12:58 am | permalink

  • Would’ve been nice if you captured your screenshots with the cursor.

    Tom, December 9, 2005 2:42 pm | permalink

  • hmmm… I’ve recently started using TextEdit to write because it uses the Spell Check Core Service which is very handy and seemingly absent from many other apps including XPress. I hadn’t used it at all for anything before that. But this is curious. I’ll have to experiment with it for exporting XHTML. It could be a fine time saver.

    I think there are a lot of mundane tasks that I do involving mark-up, and if this can take the work out of most of them, I’m interested.

    I suspect I’d still need to go through and tweak it, but heh, any time saver is a good time saver.

    John Pennypacker, December 8, 2005 4:31 pm | permalink

Comments are closed