Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 1.51 KB

File metadata and controls

38 lines (29 loc) · 1.51 KB

Relative Line Numbers for CM6

Installation

yarn add codemirror-line-numbers-relative

Usage

Edit cm6-relative-line-numbers-ts (with package)

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: