Support multiline embedded equations

[Delivers #62999446]
Issue pull request for branch 62999446-multiline-eq

[Delivers #62999446](https://www.pivotaltracker.com/story/show/62999446)
Tidy up handling of newlines

[#62999446]
Merge branch 'master' into 62999446-multiline-eq
[#62999446]

* 62999446-multiline-eq:
  Tidy up handling of newlines
  Issue pull request for branch 62999446-multiline-eq
  Support multiline embedded equations