Skip to content

asciidoctor/codemirror-asciidoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

AsciiDoc mode for CodeMirror

This repository contains the AsciiDoc mode for CodeMirror.

Installation

$ npm install codemirror-asciidoc

Usage for CM5 with [email protected]

var codemirror = require("codemirror"),
  codemirror_asciidoc = require("codemirror-asciidoc");

codemirror.fromTextArea(document.getElementById("editor"), {
  lineNumbers: true,
  lineWrapping: true,
  mode: "asciidoc"
});

Usage for CM6 with [email protected]

import {StreamLanguage} from "@codemirror/language"
import {asciidoc} from "codemirror-asciidoc"

import {EditorView, EditorState, basicSetup} from "@codemirror/basic-setup"

let view = new EditorView({
  state: EditorState.create({
    extensions: [basicSetup, StreamLanguage.define(asciidoc)]
  })
})

License

BSD

Credits

The AsciiDoc mode for CodeMirror was generated from the AsciiDoc mode for Ace using the https://github.com/espadrine/ace2cm[ace2cm] project by https://github.com/espadrine[Thaddee Tyl].