fix n^2 performance issue in coalesce_streams preprocessor

for n consecutive stream outputs, `\r` fix would be compiled n times,
and applied to each output (n-i) times.

- move pattern to module level
- apply replacement after coalescing outputs
improve logging in nbconvert preprocessors

also cleanup spelling and grammar in a few docstrings
output_type should not be optional in new_output

and fix bug that this would have revealed
Merge pull request #5535 from minrk/nbconvert-debug

fix n^2 performance issue in coalesce_streams preprocessor