Hi, welcome to the forum! Please note that you can put your Typst code in a markdown code block to format it properly (see here for more information.)
To answer your question, you can write a rule that only affects raw blocks by writing
#show raw.where(block: true): set text(font: "PT Mono", size: 8pt)