Code block macro issue

MPal Pal September 23, 2012

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?

Thanks

2 answers

0 votes
Felicity Chapman February 14, 2013

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.

0 votes
MPal Pal September 23, 2012

I added

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

Suggest an answer

Log in or Sign up to answer