I was able to achieve this without custom code.
- Firstly, I would style the H1 as you need (font, size, color)
- Then select each line (one at a time) and select the ‘wrap with span’ button (screenshot below)
- Then you just create a new class for that span and add background and left/right padding
Once you have styled your spans for each line you can play around with them and tweak until you get your desired results.
Hope this helps.
Jamie