Update: 2011-09-20 With the release of Confluence 4.0, this post obsolete.

A simple Confluence user macro to hide access to the View Wiki Markup menu link...



One thing I love about Confluence is the way that you can browse other people's pages and steal their superior layout ideas for your own wiki pages.

It's dead easy to do. Go to the Tools drop down menu and click on the View Wiki Markup link. A new window will open containing the wiki markup for the page. You can now copy the bits you like and discard the rest. Your friends and colleagues will be impressed by your wiki skills and you can continue on your path to becoming a wiki ninja.

But what if you don't want to share those wiki markup skills?
That's not very collaborative, I know. But there are entirely valid reasons that you'd wish to disable this feature.
An example of this is use of the {sql} plugin. This is a really powerful plugin that allows you to query databases and tabulate the results in Confluence. Wrap this in a {chart} macro and you have an instant graph. Nice work! There's a great blog post at Atlassian that use this to great effect.


However, using this kind of markup on a public website is a bad idea. Exposing the structure of your databases to people you don't know and can't trust is somewhat short sighted. On a company intranet, the risk is still there, but hopefully it is not so dangerous. Even so, it's really best not to show this information in the first place.

What can we do about it?

The best solution would be additional security in the product that allows editors to prevent others from viewing wiki markup. It would probably go in the Restrictions screen. This does seem somewhat like a paranoid feature request, but call me paranoid.

Another way is to use Javascript to remove the link from the DOM. This is not a replacement for good security, but will stop the casual user from accessing the wiki markup.

It is easily done in a user macro:

As a Confluence administrator, go to Confluence Admin | User Macros and click on Create a User Macro.

Fill out the form...
Macro name: hide-wiki-markup
Output: Macro generates HTML markup

<script type="text/javascript">
jQuery('#action-view-source-link').parent().hide(); /*Updated from .remove(); Aug 2010*/