1.0.4 • Published 2 years ago

lang-legado-rule v1.0.4

Weekly downloads
-
License
GPL
Repository
github
Last release
2 years ago

lang-legado-rule

Legado rule support for the CodeMirror code editor

NPM npm

demo

Usage

npm install lang-legado-rule
import { autocompletion } from '@codemirror/autocomplete';
import { EditorState } from '@codemirror/state';
import { oneDark } from '@codemirror/theme-one-dark';
import { EditorView, highlightActiveLine, lineNumbers, keymap } from '@codemirror/view';
import { rule } from 'lang-legado-rule'
import { standardKeymap, history, historyKeymap } from '@codemirror/commands';

window["view"] = new EditorView({
  parent: document.getElementById('editor'),
  state: EditorState.create({
    doc: 'class.app-0.-11@tag.li[!1:2]@tag.span[-1,10]<js>let a = 1;a = 2;</js>@text##\\d[a-z]##',
    extensions: [
      rule(),
      lineNumbers(),
      history(),
      keymap.of([...standardKeymap, ...historyKeymap]),
      highlightActiveLine(),
      autocompletion(),
      oneDark,
    ],
  }),
});

Project Setup

pnpm install

Compile and Hot-Reload for Development

pnpm dev

Compile for Production

pnpm build