codemirror-addon-indent-guide

Codemirror addon to include indent guidelines

Usage no npm install needed!

<script type="module">
  import codemirrorAddonIndentGuide from 'https://cdn.skypack.dev/codemirror-addon-indent-guide';
</script>

README

codemirror-addon-indent-guide

Codemirror addon to include indentation guidelines.

How to use

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