Code block macro issue

Hi All,

When I include an XML code block to a wiki page and export that to PDF, the xml tags don't get nicely highlighted in blue. It looks like a normal block of letters.

How can I fix this issue please?


2 answers

I added

.code-keyword { color: #222277; }
To the PDF stylesheet but still the keywords come up in black as normal text.

We hit this problem too. One of my team had a look at the code being generated on the way to the PDF export and he thinks that Confluence strips out the code highlighting intentionally. It's really frustrating because we want to export code with syntax highlighting as well.

Currently we're using a rather weird workaround which involves having two copies of every code example: one to print and one to display in the browser. The printable version is generated outside Confluence with the syntax highlighting explicitly coded into the HTML styling. We added extra styles to our CSS to work with this. Unfortunately, this uses an existing utility of ours and so I cannot tell you what steps you'd need to use to implement something similar. There are quite a few syntax highlighters out there and so you could probably create a similar workaround if this is a real problem for you.

I thought that I'd voted on an issue in Jira for this but cannot find one. The closest information that I can find is here -- which explains why they dropped export of highlighted code in 2010 but not why they haven't done anything since.

I've just raised it as a support issue. I imagine that if more people ask for this then they're more likely to do something about it.

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

288 views 38 9
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot