Just noticed this was a feature in sphinx-gallery, I think I prefer the # %% over the ######:
###############################################################################
# Using the prediction pipeline in a grid search
vs
# %%
# Using the prediction pipeline in a grid search