How do I remove link in code block?

This question is in reference to Atlassian Documentation: Code Block Macro

I have some XML that I want to show in a code block. An element in this XML happens to have an attribute that is a URL. For example:

<add key="SomeUrl" value="https://example.com" />

I don't want the URL to be clickable. Any way to do this?

3 answers

1 accepted

0 votes
Accepted answer

Does it need to be a code block?  When I want pure vanilla, I use the no format macro.  The URL will not be clickable.

Code Block

&lt;add key="CNN" value="https://www.cnn.com" /&gt;

No Format

&lt;add key="CNN" value="https://www.cnn.com" /&gt;

But then you lose syntax highlighting. Although in my particular case, that would be quite acceptable since my XML snippet has only four lines. I'd rather do without syntax highlighting than have reader accidentally open link when attempting to select text for copy/pasting.

@Peter Milakovich automatic links in code is also extremely undesirable at my company too, especially when documenting our api.   There are a number of links that trigger actions such as tracking counts etc and it is a problem.     

This should be controllable at least by adding a css style to each page or code block.

I don't think it is possible without changing the code block marco code.

There are other ways to achieve similar formatting visualization, but if you want the code block I am afraid this is how it works.

I feared so. Although I can't see why having active links in a code block should be desirable. But that's ok, I'll live with it. Thanks.

agreed, this can be very annoying especially when the links have "effects" 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,084 views 17 14
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