0

I have been working on a html file on my mac os 10.10 via Texedit for about a week. When I started my computer today the file appeared on my machine as an rtf, and when I opened it I saw my page as rich text with no javascript of html tags. I then tried to restore it but all the versions were rtf. I then choose to view the page a plain text and restore again and now all the versions were plain text. Again no javascript or html tags. How can I restore my file as a html file?

7
  • TextEdit files are either rtf or txt never HTML - you can dave an html file as txt and krrp the formatting - so I suspect the only hell file is your original - however you could explain how you saved it first time and what your TextEdit preferences are set to
    – mmmmmm
    Jun 6, 2015 at 20:25
  • Did you Save-as .html type ?
    – Ruskes
    Jun 6, 2015 at 20:30
  • My file was a html file in plain text format. In other words you could see the various html tags and the javascript code as text. I saved it with the html extension and it appeared correctly (as html) in safari. I edited the file multiple times and again it appeared as expected in Safari. My battery then died and now I'm left with a file which I can only restore as rich text without the html tags or a plain text version of this (again without the html tags).
    – Baz
    Jun 6, 2015 at 20:30
  • Yes I saved as html and I viewed it in Safari and the file had the html extension only. Now I have no file with the html extension, instead I have one with a rtf extension.
    – Baz
    Jun 6, 2015 at 20:31
  • Where does Mac os x save the older versions of the files and can I restore their contents via emacs for example?
    – Baz
    Jun 6, 2015 at 20:34

1 Answer 1

1

I had the same problem and found this resource to help me:

  1. Create your HTML document by writing the HTML codes in TextEdit. But when you try to save do not choose Web Page in the file formats drop-down. If you choose this, all of your HTML codes will appear on the page.
  2. Go to the Format menu and choose “Make Plain Text.”
  3. Save the file with a .html extension. Then you can edit the file in any other text editor as plain HTML.

But if you need to edit it in TextEdit later, you need to change TextEdit preferences. If you don't change the TextEdit preferences, it will open your HTML file as an RTF file, and you will lose all your HTML codes. To change the preferences

  1. open TextEdit and choose “Preferences” from the TextEdit menu.
  2. Switch to the “Open and Save” tab.
  3. Make sure the checkbox is checked in front of “Display HTML files as HTML code instead of formatted text.”
  4. It also helps to have TextEdit default to text files (instead of Rich Text) if you use it to edit HTML a lot. To do this, switch back to the “New Document” tab and change the Format to “plain text.”

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