Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Proposing a solution for HTML-reformatting problem

A lot of people are apparently complaining about CD2 rewriting their html to be xhtml-compliant, something they don't want, don't need or just don't care about.

Joel has given valid reasons for why CD2 is rewriting the html, being that the editing of the text in normal view is not done directly on the html, but on an internal tree-based data structure.

Here's a proposal to a solution to get rid of most of the complaints, while still not changing much in the way of how CD2 is operating.

First of all, don't touch the html when switching between the views. If CD2 has to parse and build a specific internal data structure in order to view the text in normal view, do so, but don't replace the html. This would mean that you could switch between the views to look at your html rendered in all its g(l)ory looks, and still keep your carefully written html.

Secondly, if the user starts typing in normal view, or changing anything about the layout (like adding bold, etc.), rewrite the html from the internal parse tree *before* doing the modification. Then compare this rebuilt html with the html that the user has typed in, and if it doesn't match, make sure the user knows what he is about to do. For instance, a simple question like "Changing the text in normal view means that your html will be rebuilt to xhtml standards, please acknowledge that this is what you want to do". If the user answers no, abort the modification. If the user answers yes, go ahead and do the modification like CD2 is doing today.

To have CD2 keep the invalid html and still be able to edit it in normal view is not a feasible solution, because it would entail "zillion of years of development", and would result in a higher price. However, I think that simply switching views shouldn't rewrite the html.

Lasse Vågsæther Karlsen
Monday, September 1, 2003

One of the greatest features in CD is, imho, the way it treats internal links. But it is not an easy task to create links in html view. Most users will surely prefer Normal View for this so the first time you go to normal view to create a link you will be faced with the choice described above.

Jorgen Brenting
Monday, September 1, 2003

Perhaps a right-click menu entry in the html view for "Insert magic name for ..." + a dropdown of the articles/images etc. could solve that ?

Lasse Vågsæther Karlsen
Monday, September 1, 2003

It might also be a solution to go back to the way CD1 treated html. Let the program do whatever it wants with whitespace etc. In the few instances where the formatting of html is REALLY important users (i.e. designers) could simply keep away from normal view. I think this would solve a few problems here and there. I appreciate the efforts that Joel and Co has made to make all us html freaks happy, but the fact is that it's creating more problems than it solves, so why not go back to something that worked fine after all? Come on, who wants to study the html of an article anyway? If you really wants to put in some html of your own in an article it's not impossible to find your way around the solid block of code that obviously works best in CD. The problem exists around the templates only as far as I can see.

Jorgen Brenting
Monday, September 1, 2003

The problem with the "old way" to treat the HTML source is that sometimes the DHTML control goes ga-ga and eats all of it.

Leonardo Herrera
Monday, September 1, 2003

If you only want to see what a page looks like, why don't you use the Preview button instead of the HTML View button?

As for inserting links to other articles, I just do that using right click -> Copy Magic Name, then paste it into the <a href=xxx> tag.

Darren Collins
Monday, September 1, 2003

It's intriguing that staying out of normal view is the answer. As long as I stay in html view, my html is preserved.

Just as I can edit templates in an external editor (eg, FrontPage), I'd like to be see that feature extended to articles as well.

All along, CD gave us the option of having, or not having, XHTML validation.

So clean it up: let me have the option of disabling normal view to ensure that I don't accidentally click it; let me edit my articles with an external editor a la templates; put in a warning box when I click normal view (that can be disabled).

Bob Bloom
Monday, September 1, 2003

"All along, CD gave us the option of having, or not having, XHTML validation."

Did it?!

John Topley (
Tuesday, September 2, 2003

You know, if you put valid xhtml into the html view in the first place then you wouldn't have to worry about switching to normal view - it would preserve what you wrote. I mean, hand-coding valid xhtml is no different to hand-coding valid html. Or am I missing something?

John C
Tuesday, September 2, 2003

The 'old way' would not only eat whitespace for lunch, it would devour things like </li> and character entities. Even with the acknowledged problems, I prefer the new way.

My suggestion would be to concentrate on the other end of things: editing without ever looking at html view. Right now, if you want to use CSS to do your formatting (with classes and divs and such), you pretty much have to use html view. If normal view, instead of presenting a bold and an italic button, would let the user apply the css classes defined in the template, the need to switch to html would greatly decrease. Needless to say, normal view would have to change fundamentally, because right now it ignores CSS altogether.

Wednesday, September 10, 2003

The only problem I've encountered with the new way is the insertion of namespaces.  I intermix PHP with my X/HTML and occassionally CityDesk likes to throw a namespace reference into the middle of my PHP code, which then breaks upon hitting the colon in the namespace.

Other than that the new way is worlds better than the old.

Brian Schkerke
Saturday, September 13, 2003

*  Recent Topics

*  Fog Creek Home