Changing code automatically (ver. 7)


Hello, I’m using verison 7 to change a php page. The problem is, that is changes automatically some code (outside id=“content” class=“cms-editable”), like a link and meta properties. How can I do to avoid this? If I use version 5, I don’t have this problem. Thanks


Same for me. I hate the fact that version 7 edits code outside id=“content” class=“cmd-editable”


I made a conscious decision in version 7 to reformat the entire page based on the page’s existing indentation (auto-detected) because people would also complain about this:

    <div id="content" class="cms-editable"><p>First line</p>
<p>Second line</p>
<p>Third line</p></div>

In this case, only the content region was updated but the code still looks like a mess. At least in version 7 the code is now consistent.

You might ask, “why not just indent the content regions to match the existing code?”

Because trying to format only specific elements in the source while leaving everything else alone isn’t a trivial task, and many of your existing conventions and preferences won’t be reliably auto-detected so that would cause yet more types of complaints.

Rather than tackle a complicated problem like this (and probably still not get it 100% for everyone), it makes much more sense to format the entire source.

So while Surreal may format HTML differently than how you would type it, the output is at least reliable and consistent, which IMO is better than the alternatives.

Perhaps some ways to improve on this are:

  • Add a toggle for code cleanup so you can select the behavior you want (enabled or disabled)
  • Consider upgrading the formatter from JSBeautify to Prettier (people seem to really like it)
  • Let you configure formatting preferences using a config file

I’m open to ideas.


Hello Cory,

Thank you for your answer. For me it is obvious that nothing has to be changed to the code, event the indentation.

“Add a toggle for code cleanup so you can select the behavior you want (enabled or disabled)” is the right solution, I think.

At this moment I must continue with version 5 for that reason (it works so well…).


this is also causing me problems, if we only want the code to be changed inside the cms-editable and nothing else, does this require going back to version 5? is that possible?


I think it is possible… Dear Cory, it should be obvious that this could be an option, because your customers are able to code a website, they are not beginners !