This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.

Escape User Macro

Introduction

Due to the way the Confluence renderer works, outputting a sequence of two '\' characters right next to each other is nigh-on impossible. It can be done by using a {noformat} macro (mostly), but it will force it into it's own paragraph. The 'escape' macro lets you get around this problem.

Instructions

The way I got it to work was to create my own 'escape' macro that converted the sequence '*', where '' is any single character, in to ''. It looks like this in the macro:

Step 1: Create a new User Macro

  1. Go to the Administration section and create a new User Macro.
  2. Call it 'escape'.
  3. Enter the following as the macro content:
    ${body.replaceAll("\\(.)", "$1")}
    
  4. Save it.

Step 2: Use the macro

In the page, it use it like this:

{escape}\\\\server\\share\\dir\\\%variable\%{escape}

When rendered, it looks like this:

\\server\share\dir\%variable%

Except that you can have the value inline in any regular paragraph.

Labels

user user Delete
macro macro Delete
repository_excluded_by_user_macro repository_excluded_by_user_macro Delete
repository_excluded repository_excluded Delete
confluence14 confluence14 Delete
formatting formatting Delete
confluence13 confluence13 Delete
confluence20 confluence20 Delete
contentconverter contentconverter Delete
user-macro user-macro Delete
plugin plugin Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 18, 2007

    James Mortimer says:

    why not use a {norender} macro? Create a user macro with this content ${genera...

    why not use a {norender} macro? Create a user macro with this content

    ${generalUtil.htmlEncode($body)}

    now,

    {norender}\\server\share\dir\%variable%{norender}

    simply gives

    \\server\share\dir\%variable%
  2. Aug 16, 2006

    William W. Lin says:

    I found on a separate thread that you can do double backslashes without using no...

    I found on a separate thread that you can do double backslashes without using noformat or macro tricks by simply using the ASCII code. So this raw Wiki markup:

    \\server\share\dir\%variable%

    shows up as:
    \\server\share\dir\%variable%

    (note that I had to use the ASCII code before the %, because the backslash acts as an escape character before percentage signs)