@jmkng/sen
v0.1.0
Published
A collection of CodeMirror extensions
Downloads
4
Readme
Sen
Simple, reusable CodeMirror (v6+) extensions.
Usage
The extensions are exported as functions that return an array of extensions that you can apply to your view.
Import the ones that you want, and execute them like this:
import { EditorView } from "@codemirror/view";
import { bold, heading, block } from "@jmkng/sen/markdown";
let view = new EditorView({
// ...
extensions: [
// ...
bold(), // "@jmkng/sen/editor/markdown/bold"
heading(), // "@jmkng/sen/markdown/heading"
block(), // "@jmkng/sen/markdown/block"
],
// ...
});
The extensions are designed to be mostly self contained, so you can just copy/paste most of the code into your own project if you don't want a dependency on the package.
Demo
A demo application that uses most of the plugins is available.
- Generate the
demo/dist/demo.js
bundle withnpm run bundle:demo
, ornpm run bundle:demo:-w
to watch for changes in development. - Open the
demo/index.html
file in your browser.