How do I style my code blocks in a Marp presentation?

4.7k Views Asked by At

I want to up the font of a code block on one of my Marp slides.

How can I style an individual code block without also effecting surrounding text?

1

There are 1 best solutions below

0
On BEST ANSWER

Turns out that marp respects scoped on style tags, apply the style only to the current slide.

The code blocks are likely the only item on the slide using a pre tag. Thus

---
# I am slide

<style scoped>
pre {
   font-size: 2rem;
}
</style>

```cs
// I am code block
\```

---