How do I indent text consistently within a table cell?

I'm trying to create a table for annotating an XML format in our Wiki.  The table has two columns, the left one has cells that contain XML that needs to be properly indented and have a fixed-width font.  The right is text that needs to have full formatting.

My problem is that if I make the left cells Preformatted it still doesn't honor the horizontal space within the XML snippets.  I've tried using various macros like "No Format" but it keeps screwing up the table when I insert data into the cells (not to mention that inserting dozens of these macros is a tedious process, to say the least).

I've seem some discussion about creating my own macro, but it seems that all I could reasonably do was to try to add styles to an existing table.  I'm not sure how this will solve my problem.  Any macro that needs to be inserted into every left cell is going to take forever to do.

I've also tried adding the   XML entity, but it just prints " " (presumably since I have to choose preformatted to get a fixed-width font).

Help?

4 answers

1 accepted

1 vote
Accepted answer
Steven Behnke Community Champion Feb 22, 2016

I think the real question here is, "How do I insert a non-breaking space into Confluence?"
image2016-2-22 19:18:9.png

It's... Maybe a bit silly. The non-breaking space or nbsp; can be inserted by selecting the symbol... which is invisible. In this screenshot I've 'focused' on it so it's easier to see.

image2016-2-22 19:18:21.png

The confluence content can be inserted right into the editor and it renders successfully.

image2016-2-22 19:18:27.png

 

SampleSummary
<namedGroup name="BaseDistricts">
    <RE>TEMP_.*</RE>
    <exclusions>
        <groups>
            <group name="Masters" />
            <group name="Special" />
        </groups>
    </exclusions>
</namedGroup>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Thank you, I had not seen that "non-breaking space" symbol in the symbol list. 

However, this is not really a great solution since if I cut/paste that "symbol" out of the wiki it just cuts as 0x20 (which is a normal space character).  This means that I have to copy and paste all of the XML snippets then manually go back through each line and change each leading space to the "non-breaking space" symbol.  This is painful.

Hopefully someone will chime in with a less manual solution.

Steven Behnke Community Champion Feb 22, 2016

Well good luck then... I can enter non-breaking spaces with alt-space and my text editor of choice inserts non-breaking spaces when I use 'tab.' The only reason I suggest these things is because you mentioned you were trying to use nbsp; to achieve this and well... nbsp; works just fine.

It was a lot of work, and for some reason the Wiki editor really didn't like me pasting in blocks of non-breaking spaces (it kept moving the entire block to its own line), but this did work for me in the end.  Thank you!

 

Steven Behnke Community Champion Feb 22, 2016

I'm glad. I wonder if there's a feature improvement we could raise on JAC.

BTW, when you say that your "text editor of choice" let's you insert nbsp with alt-space, do you mean that you can insert some character in an external editor and have it paste in as the right symbol in the wiki?

I tried editing the text in Word and inserting nbsp there, but the Wiki editor didn't ever paste it correctly (it was more often than not so messed up as to be unusable).  If I try pasting text out of the wiki to SlickEdit it pastes the nbsp as a normal space character (0x20).

What editor are you using and what is it inserting into the buffer in that editor when you use alt-space?  The syntax highlighting all copies just fine from SlickEdit, but if I insert the Unicode nbsp character (0xA0) it pastes into the wiki as a "?".  This would be relatively easy if I could just translate all spaces at the beginning of each line into a nbsp and then just cut and paste into the wiki.

Steven Behnke Community Champion Feb 22, 2016

I am on Confluence 5.9.5, if relevant. My client machine is on OSx so I am not sure if an OS difference is affecting us. First, I tested this with normal spaces – They do not paste cleanly and Confluence gobbles them up as "extra" whitespace (as HTML applications usually do).

I am able to use OSx shortcut AltSpace in any text editor, I tried the basic textEdit and one of my favorites Text Wrangler. Both of these editors accept the non-breaking space and further I can copy it from textEdit or Text Wrangler to Confluence easily, or I can simply write directly into Confluence. I have no issues inserting these from my keyboard into Confluence.

My scripting usually takes place in Code Runner 2, when I press Tab it inserts non-breaking spaces for me as well.

As to your feature improvement comment, I started looking into macros, but they didn't seem to be focused on the right things.  However, from an ease of use standpoint, they could allow us to put often-used macros directly in the "insert more" menu (or the context menu for "{").  I did figure out that I could search in the context menu for "{" which is better, but still not perfect since I could find no way except using the mouse (click on the macro box and then click edit) to click the nopanel check box.  I was thinking I should just write a custom macro, but hadn't really gone far down the road to do that (and there are so many now, that it's possible that one of them would do what I want).  If I were to write my own, I would make it build the proper table from an unordered list or something.

It is nice that you can highlight text and it will wrap the macro around that, and (with some difficulty) you can cut/paste macro insertions.  But it seems like there could be some syntax that would let me invoke a macro myself.  Something like 

"{macro:No Markup, nopanel="true"}text{macro}"

or something, which I could paste from the clipboard.  I'm guessing this from other comments that hint that maybe you used to be able to do that, and, in fact, their own wiki-markup tutorial mentions "{color:red}text{color}" which apparently no longer works.  All-in-all I really wish they just provided a "wiki markup" view of the page, so that I could edit the codes myself (like Wikimedia does) even if they translate them in and out of the codes under the hood to some internal format (they indicate that's what's happening anyway).

I was going to type all of this into a suggestion on jira.atlassian.com, but it was down and I didn't want to lose it.

Thanks again for your help.

Steven Behnke Community Champion Feb 22, 2016

No problem. It's too bad you've had difficulty.

Alternatives

There is a Wiki/Markdown insert option – 
image2016-2-23 0:24:21.png
image2016-2-23 0:23:41.png

 

You can also use the wiki macro – 
{wiki}

 

Finally, Server (not Cloud) has an add-on called Source editor that let's you modify the HTML – 
image2016-2-23 0:26:32.png

I'll look into the manual markup insertion.

I assume that we have "cloud" since we aren't running any Atlassian software on any of our machines.

Thanks again!

Steven Behnke Community Champion Feb 23, 2016

Confluence won't usually be running locally on your desktop or laptop, but you'll have it administered as an "application" by your IT department if it's "server" version. If you have Server version I urge you to get the Source Editor, I use it constantly as a power-user.

Here's a trick to easily tell what confluence you're on –

  • If your URL is hosted at domain.atlassian.net/wiki or domain.jira.com/wiki, you're on JIRA Cloud. (such as blackpearlpdm.atlassian.net/wiki)
  • If it's hosted anywhere else, you have Server version. (such as confluence.blackpearlpdm.com)

 

By improvement, I think there's opportunity here – You're a common use-case, code (XML even) in Confluence pages. For some reason, you're unable to easily paste non-breaking spaces into a page. Some environment variable is preventing that from working (since it works fine for me) and I think that means there's a bug or a improvement that can be made. I'm not sure how to find this bug with you though.

 

The Confluence Editor is constantly improving, I'm certain the experience will continue improving.

 

0 votes
Steven Behnke Community Champion Feb 20, 2016

It'd be nice to see an example. This is hard to visualize. 

Steven,

OK, here are two screen shots.  In the left column you can see one where I have inserted a No-Format macro, which works, but I can't do any syntax highlighting and I have to do several clicks and searches to insert every No Format, and sometimes when the No Format is inserted the remainder of the table goes awry.  The columns below are marked Preformatted and have spaces and syntax highlighting.  I've tried all sorts of suggestions mined from the forums, but nothing really works except the No Format macro, which is painful.

Obviously the page I am showing here was manufactured just for the forum, but is indicative of the problem.  There are 30-40 sections documenting the XML document format.  The way I created it (before trying the No Format macro) was to load a sample XML document into an editor (SlickEdit in this case) which provides the syntax highlighting, which I then pasted into the Wiki and started writing the documentation.  I've been living with the lack of indenting for some time, but I just added a big new feature to the XML and it just seems like this should be easier.

Thanks for any ideas.  Images below:

EditingScreenShot.jpg

PageDisplayScreenShot.jpg

0 votes
Steven Behnke Community Champion Feb 22, 2016

So... Something like this?

SampleSummary
<namedGroup name="BaseDistricts">
    <RE>TEMP_.*</RE>
    <exclusions>
        <groups>
            <group name="Masters" />
            <group name="Special" />
        </groups>
    </exclusions>
</namedGroup>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<databaseGroups>
    <group name="Clam Districts" />
</databaseGroups>
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, .
<workUnit name="Some Name"
continueOnError="false"
timeoutMinutes="10">
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

158 views 3 5
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you