diff --git a/IPython/core/magics/code.py b/IPython/core/magics/code.py index 4f1574d..4bfe3b1 100644 --- a/IPython/core/magics/code.py +++ b/IPython/core/magics/code.py @@ -154,6 +154,8 @@ def strip_initial_indent(lines): for line in it: if line.startswith(indent): yield line[len(indent):] + elif line in ('\n', '\r\n') or len(line) == 0: + yield line else: # Less indented than the first line - stop dedenting yield line