codemirror-lang-turtle
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

CodeMirror TURTLE Language Support

NPM version badge

A CodeMirror extension that provides Turtle syntax highlighting and language support.

Usage

import { basicSetup } from 'codemirror';
import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { turtle } from 'codemirror-lang-turtle';

const doc = `
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix ex: <http://example.org/stuff/1.0/> .

<http://www.w3.org/TR/rdf-syntax-grammar>
  dc:title "RDF/XML Syntax Specification (Revised)" ;
  ex:editor [
    ex:fullname "Dave Beckett";
    ex:homePage <http://purl.org/net/dajobe/>
  ] .
`

new EditorView({
  state: EditorState.create({
    doc,
    extensions: [
      basicSetup,
      turtle(),
    ],
  }),
  parent: document.querySelector('#editor'),
});

Readme

Keywords

none

Package Sidebar

Install

npm i codemirror-lang-turtle

Weekly Downloads

64

Version

0.0.2

License

MIT

Unpacked Size

36.7 kB

Total Files

8

Last publish

Collaborators

  • aatauil