Hi,
Søren recently posted a request for an accessible HTML editor. Cara
answered with information about TACO, but also mentioned that you can
use TextEdit to edit HTML. There are a few tips about how to do this
in an Apple document titled "How to Set Up TextEdit as an HTML or
Plain Text Editor" available from their Knowledge Base at:
http://support.apple.com/kb/TA20406
Make sure you follow these instructions to change your TextEdit
preferences so that you can see an HTML page that you edited rendered
as code rather than as it would appear in a browser.
You can also force strict adherence to html or xhtml format under the
next category of HTML Saving Options (on the same Open and Save tab),
and choosing "HTML 4.01 Strict" or "XHTML 1.0 Strict" on the popup
button for document type, and you can set the popup button for Styling
to "No CSS" if you don't use style sheets for your web pages.
I'm appending an excerpt from a blog post on using TextEdit for HTML
editing. It's a bit long, so only read this if you're interested in
the details of TextEdit capabilities, like working with CSS or strict
HTML, but I'm posting the excerpt instead of just giving the URL,
because it's in the middle of a discussion about the author's
decisions to stop using Dreamweaver and other web-design software to
edit "clean HTML". The post appeared about two years ago and discusses
a few points like using "Open Recent" to re-edit the html file, and a
gripe about TextEdit using bold (B) instead of strong (strong).
The excerpt follows.
Cheers,
Esther
<begin excerpt from a blog titled "Musings from Mars">
However, last summer I discovered a really cool trick that TextEdit
can do, which actually makes it a halfway decent HTML editor... I've
now got most of the basics covered.
What I discovered is that TextEdit can convert rich text constructed
using the native Cocoa text, font, and style features (including lists
and tables) to well-formed HTML by selecting the proper setting in the
Open and Save tab of TextEdit's Preferences window. This preference
has been available since at least 10.4.6, but I don't know how long
before that.
Instead, what I discovered is that if you work in a native Cocoa
application like TextEdit using only the tools Apple provides for word
processing you can easily work in a WYSIWYG mode and then convert the
file to clean HTML that you won't be embarrassed to call your own.
Yes, there are many native, non-WYSIWYG HTML editors for the Mac that
can do this as well -- which don't likewise introduce extraneous code
-- but I was delighted to find I could basically develop HTML in any
native Cocoa app as well! For example, I currently do a lot of data
entry in DevonThink Pro, which -- like SohoNotes, Journaler, Yojimbo,
Curio, VoodooPad, and many others -- enables word processing through
the native Cocoa toolset. If you do the same, you'll find that you can
build tables, lists, and any other text you like in such an
application and then, if you need to convert it to HTML, simply copy
and paste it into TextEdit. You don't need to export the file to RTF
or HTML or whatever from the application in question.
Until last July, I thought TextEdit's HTML conversion ability was on a
par with that of Microsoft's Word and Apple's Pages. That's probably
because in its default mode, it is. If you select "Save as HTML" when
saving a rich-text-formatted document, TextEdit defaults to saving the
file with CSS styles so the end product looks just like the original.
However, it doesn't have to be that way, as it turns out.
The surprisingly powerful TextEdit provides some very handy, simple
options to produce clean HTML when you need that, something that no
other word processor can do, so far as I know. Here's a brief set of
steps to take advantage of this capability:
• Copy and paste your Cocoa-formatted text into a new TextEdit
document, or format the content directly in TextEdit while it's in
Rich Text mode. (Hint: TextEdit provides an Application Service (New
Window Containing Selection) in the Services menu for grabbing content
once you select it in the originating app.)
• Open TextEdit's Preferences and select the Open and Save tab.
• Change Document Type to either HTML 4.01 Strict or XHTML 1.0
Strict, depending on whether you want your code to be XHTML compliant
or not.
• Change Styling to "No CSS." Note that this will strip all font,
style, and positioning information from the file, except for the
basics like bold and italics.
• From the TextEdit menubar, select File/Save As.
• In the Save As dialog box, give your file a name and hard disk
location. Then, change the File Format selection to HTML, and click
Save. TextEdit will add the .html extension on its own.
Now, when you doubleclick on your new HTML file in the Finder, it will
open with your default web browser. If you examine the source code,
you'll see nothing but simple, pure HTML (or XHTML). The only 'bad'
thing I noticed was that the Cocoa HTML Writer that does the
conversion still uses <b> for boldface rather than the 'correct'
<strong>. But that's easy enough to fix... or ignore.
You can now take the HTML code and plop it into your blog post or any
other standard HTML file (which probably already has its own CSS
styles defined), and it will add nothing but pure content to that
file. This has proved to be a real time-saver for me, since it lets me
format lists and tables in any Cocoa app and not have to worry about
how I'm going to convert the data to HTML later on!
What's equally cool is that TextEdit can turn right around and open
that same WYSIWYG file as plain-text HTML. In its default mode, when
you open an HTML file in TextEdit, the software will basically convert
the HTML to RTF style constructs, assuming that's what you want.
However, you can override this behavior, again in the Preferences, by
selecting the checkbox "Ignore rich text commands in HTML files." With
this checked, you can open HTML files as pure source code and edit
them further if you like. Since TextEdit is a Cocoa app, it will
always have the "Open Recent..." menu item in the File menu, and
you'll find that the HTML file you just saved from TextEdit's WYSIWYG
mode is at the top of the list. So what I do is just
Save the formatted file as HTML.
Select "Open Recent..." and open it again.
Now I have my HTML source I can just tweak or copy/paste to WordPress,
Ecto, or anywhere else I need to use HTML-formatted code.
My one big gripe about TextEdit is that it has no image formatting
controls. It would be nice to be able to do basic align, float,
spacing, and resizing with images you bring into TextEdit, and it
would be awesome to have TextEdit likewise convert such documents to
HTML. As it stands now, though you can add images--and even video and
audio content--to a TextEdit file, your only HTML export option is to
write a "WebArchive", which unfortunately is a WebKit/Safari-only
format that stuffs the text and graphics into a single, non-editable
binary file. (This is a whole other topic... for Microsoft has a
similar, yet different proprietary format for doing the same thing.)
So the HTML editing trick is limited to content that has no images...
you have to add and format the image links in some other tool.
Still, I've been using TextEdit a ton more than I ever did before, and
it's saved me untold effort in preparing content for Mars these last 6
months. I'll have more tips about TextEdit in a future article!
Note to the readers who want to take issue with my statement above
about the <STRONG> being "correct." Just so you know I didn't make
that up, check out the w3c accessibility guidelines on this subject.
I'm sure that my sensitivity and technical training in web
accessibility issues is where I got the impression that <STRONG> is
preferable to <B> these days.
<end excerpt>