Codemirror addon to include indentation guidelines.
- Install the library from npm
npm i codemirror-addon-indent-guide
- Import the module addon after importing codemirror module
import 'codemirror-addon-indent-guide';
- Setup
indentGuide
andindentUnit
options when initializing codemirror editor. Example:
CodeMirror.fromTextArea(elem, {
indentUnit: 2,
indentGuide: true,
});
- Style it with some css using the classname
cm-indent-guide
. Example:
.cm-indent-guide {
position: relative;
border-left: 1px dotted #bbb;
}