markdownslideshowmarp

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


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?


Solution

  • 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
    \```
    
    ---