How to change the font-size in code snippets when exporting to PDF?

Per Thomsen December 17, 2021

I think the subject says it all.

The monotype font in the PDF exports for code snippets is much too big for my liking. 

I have tried with some CSS, but I couldn't make the text of the code snippets change size at all. I tried changing the font-size for the '.prismjs' class, and the '.language-json' class. Nothing worked.

Anyone know how to change that font size in the PDF?

2 answers

0 votes
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 19, 2021

Hello @Per Thomsen , have you tried changing the CSS syles for code tag? If you look at the display, the code macro renders on the page as (depending on format setting):

<code class="plain plain">

</code>

Per Thomsen December 21, 2021

I tried the following: 

code.plain {font-size: 8px;}
code {font-size: 8px;} 
code.plain.plain {font-size: 8px;}
.prismjs {font-size: 8px; }
.language-json {font-size: 8px;}

For the last one, I obviously only expected it to change my JSON blocks.

None of these made a difference as far as the font size for the code snippets.

It feels like I'm barking up the wrong tree?

0 votes
Vishwas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2021

Hi @Per Thomsen 

I haven't tried this option. But this link might guide you how to customize pdf export which has font-size configure option too

https://confluence.atlassian.com/doc/advanced-pdf-export-customizations-198806890.html

Regards,

Vishwas

Per Thomsen December 18, 2021

I looked at both of the PDF export customization pages, and I can get the regular body font to change, but not the code snippets. At least I wasn't able to glean how to change the code snippet font size from those two documents.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events