I'm really impressed by the styling options in https://carbon.now.sh for producing images of code.
I'm often dissatisfied with my options for displaying code samples in slides, this might be a better option. Line numbers and (light background) syntax highlighting matter.