Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

[CLOUD] Format code block on PDF export with stylesheet (CSS)?

Jeremy Hranko
Contributor
April 6, 2018

The font used for code blocks on a space export is disproportionately large with respect to the rest of the content. 

Is it possible to modify the font of the code block macro on export? 

1 answer

6 votes
Jeremy Hranko
Contributor
April 12, 2018

Eventually I was able to fix my own issue by adding the following to my CSS

 

/* Format code block macro font */ 
.code pre
{
font-size: 12px;
Erica Cunningham
Contributor
August 14, 2018

This works for server too, you saved me a lot of headaches by posting this fix. Much appreciated! 

Daniel, Ashley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2022

I have a question on this. This works very nicely but what if I have many code blocks on my page and I want each of the code block font to be a different color... do you by chance know a way to do this? code pre is what is listed for each block I do, so it if I assign it a color it does it for all.  I put a screenshot below. Any help would be great... I've been going round and round trying to modify things to add to my PDF Stylesheet

code blocks.PNG

Jeremy Hranko
Contributor
October 11, 2022

I don't know of a way to do it. You'd have to be able to distinguish between the different code blocks by using a unique class or other identifier, but the Confluence editor (at least on Cloud) doesn't give you a way to do that, as far as I can tell. 

Maybe someone more savvy than me can help out. Good luck. 

Daniel, Ashley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 14, 2022

I essentially figured out a workaround using Pre Macro.. I copied a lot of different styles and added it to the inline style box of the macro.. its still essentially the code block just now I can edit font color and stuff. 

Like Jeremy Hranko likes this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events