Relative Line Numbers for CM6
Installation
yarn add codemirror-line-numbers-relative
Usage
import { EditorView } from "@codemirror/view";
import { EditorState } from "@codemirror/state";
import { lineNumbersRelative } from "codemirror-line-numbers-relative";
new EditorView({
state: EditorState.create({
doc: `hello world!
who doesn't love relative line numbers?`,
extensions: [lineNumbersRelative()],
}),
parent: document.querySelector("#editor"),
});
Credit
This wouldn't be possible these resources: