Random Formatting problem in Confluence
Asked by Mick Davidson:

Hello,  
I've just had another case of a random but recurring formatting problem in Confluence.

In this case, the user has been editing a page that already existed but only contained one short sentence and the TOC and Children Display macros. These were both inside Column macros that were inside a Section macro.

He had entered various bits of text above the Section/Column area, saving the page as he went along.

He then entered a new line of text and pressed return to start a second, which he then tried to format as a heading using the drop down menu to select heading 3.

This is where it all goes wrong.

Instead of the new line being formatted as H3, the text in BOTH the Column macros became H3, and the cursor jumped from the page into the first of the two Column macros.

We had a look at the HTML, but couldn't see any reason for this happening, though we could see the result - see the HTML for the macros below.

Having fixed this in the HTML, my colleague saved the page and the problem went away. He's had this problem in the past, as I said above, so this isn't a one off. It's just random.

The page he was working on was one of a set of pages that we automatically create using a Python script. So this might be part of the problem. However, no one else has had the same problem as far as I know. If I find out that they have, I'll update this question.

So, any clues?  
Cheers.

<br />

PAGE HTML

\<h1\>Title\</h1\>  
\<p\>Design Document - sometexthere (sometexthere)\</p\>  
\<h1\>heading\</h1\>  
\<p\>sometexthere.\</p\>  
\<h1\>heading\</h1\>  
\<p\>sometexthere.\</p\>  
\<h3\>heading\</h3\>  
\<p\>sometexthere.\</p\>  
\<p\>sometexthere - \&lt;Name\&gt;\<br/\>sometexthere - \&lt;Name\&gt;\<br/\>sometexthere - \&lt;Name\&gt;\</p\>  
\<p\>sometexthere - \&lt;Name\&gt;\</p\>  
\<h3\>heading\</h3\>  
\<p\>sometexthere.\</p\>  
\<p\>sometexthere - \&lt;Name\&gt;\<br/\>sometexthere - \&lt;Name\&gt;\<br/\>sometexthere - \&lt;Name\&gt;\<br/\>sometexthere - \&lt;Name\&gt;\<br/\>sometexthere - \&lt;Name\&gt;\</p\>  
\<p\>sometexthere - \&lt;Name\&gt;\</p\>  
\<p\>sometexthere.\</p\>  
\<h3\>heading\</h3\>  
\<p\>sometexthere.\</p\>  
\<p\>sometexthere \&lt;HERE\&gt;.\</p\>  
\<p\>sometexthere.\</p\>  
\<h3\>heading\</h3\>  
\<p\>\&lt;sometexthere\&gt;\</p\>  
\<p\>sometexthere\</p\>  
\<h3\>heading\</h3\>  
\<p\>\&lt;sometexthere\&gt;\</p\>  
\<p\>sometexthere\</p\>  
\<h3\>heading\</h3\>  
\<p\>\&lt;sometexthere\&gt;\</p\>  
\<p\>sometexthere\</p\>  
\<ac:macro ac:name="section"\>  
\<ac:rich-text-body\>  
\<ac:macro ac:name="column"\>  
\<ac:rich-text-body\>  
\<h3\>  
\<strong\>Contents\</strong\>  
\</h3\>  
\<h3\>  
\<ac:macro ac:name="toc"\>  
\<ac:parameter ac:name="maxLevel"\>2\</ac:parameter\>  
\</ac:macro\>  
\</h3\>  
\</ac:rich-text-body\>  
\</ac:macro\>  
\<ac:macro ac:name="column"\>  
\<ac:rich-text-body\>  
\<h3\>  
\<strong\>Further Information\</strong\>  
\</h3\>  
\<h3\>  
\<ac:macro ac:name="children"\>  
\<ac:parameter ac:name="style"\>h5\</ac:parameter\>  
\<ac:parameter ac:name="page"\>Ports Expansion\</ac:parameter\>  
\<ac:parameter ac:name="depth"\>1\</ac:parameter\>  
\</ac:macro\>  
\</h3\>  
\</ac:rich-text-body\>  
\</ac:macro\>  
\</ac:rich-text-body\>  
\</ac:macro\>


Answers:
author: Phil Sanderson
body: Hi this issue is still occurring randomly but regular enough to be really annoying.


author: Dave Theodore [Coyote Creek Consulting]
body: Are you using any macros that encapsulate code? I've seen problems like this where you use an encapulation macro incorrectly. The most recent example I've seen was where someone used an HTML macro to encapsulate text from a configuration file that happened to contain "\<" and "\>" that were not HTML tags. This caused funky behavior with the TOC.

An easy way to troubleshoot the problem is to create a test page and copy one section of the broken page at a time and paste them to the test page. Everything will display properly until you get to a point where it breaks and you can isolate the problematic section. I've seen cases where things display properly in "Preview" mode, but not when the page is saved, so you might want to use "Save" rather than "Preview." I hope that helps.

comments: author: Matt Doar
body: Dave's right, simple as possible and add more on. I've also found starting from a known good page created by hand, exporting it and looking at the XHTML helps a lot.


author: Mick Davidson
body: Dave,

No we aren't doing that. The HTML above is the entire HTML for the page, minus the confidential content.

You're other idea might be helpful though. I'll try to remember it the next time this problem randomly happens. :)


author: Mick Davidson
body: Matt,

that's also a good idea, one I'll have to find some time to investigate. :)


author: Mick Davidson
body: See also: [https://answers.atlassian.com/questions/181017/formatting-changing-randomly-in-confluence](/questions/181017/formatting-changing-randomly-in-confluence)

and: [https://answers.atlassian.com/questions/169904/formatting-randomly-changing-in-confluence](/questions/169904/formatting-randomly-changing-in-confluence)


author: Mick Davidson
body: I've just spoken to my colleague who runs the Python script, and she says no one has ever reported formatting problems to her. Which doesn't prove very much either way, but at least we know now. :)


Tags: format

python