Shortcodes and <p> tags

I don’t see any difference in the linebreaks/whitespace around these two uses. Here is the content I am trying to work with if that helps: https://gist.github.com/hnarayanan/1858d731515f29f884f6

I also see another strange behaviour that I hadn’t noticed earlier. If I shorten the title of the first figure shortcode use, the second doesn’t have the <p> tags wrapping the generated output.