How to Create Responsive Code Blocks - eviltoast

For my blog I thought I’d set up code blocks that can be adapted to mobile. Does anyone else bother doing this, or is it just me? You certainly don’t get this option on blog platforms like dev.to, so I’m guessing it’s not that common.

  • Aux@lemmy.world
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    1 year ago

    I’d rather have to scroll than to look at butchered code formatting. Just let me zoom out instead.

    • robjohnson@programming.devOP
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      1 year ago

      You touch on a fair point that yeah, we don’t want to go too far and fit code into a narrow viewport at absolutely any cost. But applied wisely, a little judicious indentation would go a long way.

      I don’t think zooming is a good general solution, since ultimately it makes the code harder to read.

      • Aux@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Manual zoom allows me to adjust the text to the size which is comfortable.