Strip useless ANSI escape codes in notebook

This fixes issue #2385.

ANSI color escape codes get handled specially by the notebook, but other kinds of codes just get printed out.  Strip these codes out of the notebook output.