Javascript required
Skip to content Skip to sidebar Skip to footer

How to Use Textedit for Html on Mac

TextEdit is a basic, yet useful word processor and text editor that is bundled with macOS on the Apple Mac, but do you use it for HTML and code editing? It can be used with a few tweaks.

Do you use TextEdit or is it too basic for your needs? I certainly would not recommend it for serious code editing, but if you find yourself on another Mac at work or at a friend's home, it may be all you have. I would normally use Brackets or BBEdit, see Best web development tools for the Apple Mac.

It can sometimes be frustrating to use, such as when you try to edit an HTML file to make some quick changes to a website or web page, which after all is just plain text. TextEdit can modify the code and this can seriously mess up any HTML file edited with it, but there is a quick and easy solution to the problem.

Let's see an HTML file loaded into TextEdit with the default settings.

An HTML file loaded into TextEdit on the Apple Mac

There are no images, so it is not quite wysiwyg but it does a reasonable job of displaying the text correctly and titles, bullet lists and paragraph text are all correctly displayed. The problem is thar if anything is edited and the file saved, it could add some code that is not allowed in HTML and that could ruin the page.

If you Ctrl+click on a .html file in a Finder window and select Open With, TextEdit.app, TextEdit opens and displays the file. However, it goes through a conversion process and in the page looks slightly different in the TextEdit window.

What's more, when you save the file after making changes, it rewrites the code in its own way and this is unlikely to be the way you want it. It adds lots of CSS code of its own, modifying what was already there. This could, in fact, break certain features in your website. It converts the .html file to a .rtfd file in the process.

TextEdit preferences

These problems can easily be solved and TexEdit can be turned into an HTML editor that could be used if nothing else is available with a few changes to the preferences.

What you must do is open TextEdit in the Applications folder and go to TextEdit, Preferences. On the New Document tab you might want to select plain text as the default format. This means that whenever you create a new file, TextEdit won't mess with the text. What you see is what you get. This is only for new files and the Format setting does not affect opening existing files.

TextEdit preferences in macOS on the Apple Mac

Down at the bottom you might want to turn off spelling and grammar checking because HTML code does not follow the normal rules. It does no harm, but you will see a lot of red wiggly underlines that are annoying.

Tick the checkbox Smart quotes and dashes in rich text documents only. You don't want TextEdit changing anything.

Select the Open and Save tab and then tick the box at the top - Display HTML files as HTML code instead of formatted text. You should also clear the tick against Add ".txt" extension to plain text files.

TextEdit

After making these changes find a .html file on the Mac's disk drive, right click it and select Open With, TextEdit.app and it now simply shows the plain text like this:

TextEdit on the Apple Mac editing an HTML file in text editing mode

This alternative editing mode does not mess around with the HTML or CSS code and it makes Text Edit useful for quick and dirty changes to web pages that are on the disk drive. It does not convert HTML and it saves files back out as .html files.

How to Use Textedit for Html on Mac

Source: http://www.rawinfopages.com/mac/turn-textedit-into-an-html-editor