Be careful when opening HTML files as text in text edit.
I was working on a document, and I accidentally did that. Take this html text for example:
<p>This is a paragraph.
<br>
That is a line break</p>
<h1>This is a heading</h1>
<ul><li>This is a list</li></ul>
Text edit turned that, into this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="2575.4">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Times; -webkit-text-stroke: #000000}
li.li3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times; -webkit-text-stroke: #000000}
span.s1 {font-kerning: none}
span.s2 {-webkit-text-stroke: 0px #000000}
ul.ul1 {list-style-type: disc}
</style>
</head>
<body>
<p class="p1"><span class="s1">This is a paragraph. <br>
That is a line break.</span></p>
<h1 style="margin: 0.0px 0.0px 16.1px 0.0px; font: 24.0px Times; -webkit-text-stroke: #000000"><span class="s1"><b>This is a heading.</b></span></h1>
<ul class="ul1">
<li class="li3"><span class="s2"></span><span class="s1">This is a list</span></li>
</ul>
</body>
</html>
so, be careful! If this has happened to you, my best bet is to just use find/replace.
It'll probably take you a bit, but it can be done.
If you want to disable this behavier, open the preferences for text edit, and on the open/saveing tab, make sure that Display HTML files as HTML code instead of formatted text is checked. This should get rid of that.
Thought I would just let you know.
Comments
Is there something in the HTML code above that's missing?
Or are you just warning us not to open HTML documents in TextEdit, without checking the box to show HTML code?
No. It's been documented but…
No. It's been documented but I didn't know that it would do that should this checkbox be unchecked. Thanks I guess!
https://developer.apple.com/library/archive/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Introduction/Introduction.html
Holy 2014, Batman!
Wow that is an old article. Good read though. 😜
Actually my link was 101%…
Actually my link was 101% useless I was just curious where this came from in the head :)
Just a little heads up
Was just giving you a little warning about making sure you check that box. It really annoyed me when I was working on a project earlier to the point where I felt like stopping
Ohh, TheBllindGuy07 ... (tsk…
Ohh, TheBllindGuy07 ... (tsk tsk)
You have really got to learn to read more thoroughly, before you respond.
Not once did I say it was useful. I simply said it was a good read, and I also hinted that it was incredibly old in my subject above.
Ah well, no cookie for you. 🙂↔️
And where did I imply that? …
And where did I imply that? :) Also, there are more than enough cookies on the internet for everyone and I think we can happily agree on that 😂 Let's have a cookie session together. Make sure it's the first line of code, no BOM, after the start. Because otherwise there won't be any session. Feel free to cancel me for this infinitely times repeated joke. 777 for everyone.
Re: Just a little heads up
Fair enough. 🙂✌️