I don't see a way to change indentation unit to two-space or best, make it automatically detect the unit: http://codemirror.net/mode/python/index.html
As you can see, the if
showed read since it got cm-error
class. It has two-space indent. But the print
is fine. Although this code block works fine.
So:
Is there a way to make the code using two-space indentation?
Is it possible to make automatic indentation unit?
I tried to play around with http://codemirror.net/mode/python/python.js and cannot come up with any conclusion.
See the indentUnit
option. There's no auto-detection in the library, but you might be able to write a little script that finds the first line that's indented more than the one above it, and take the difference as a likely guess.