A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.npmjs.com/package/gcode-lang-codemirror below:

gcode-lang-codemirror - npm

gcode-lang-codemirror

G-Code Language Support for CodeMirror 6

Overview Features

This support language includes syntax highlighting for the G-Code language.

There is also support for tooltip hovering so when a command is hovered over a description of what that command does will be displayed.

Installation

gcode-lang-codemirror is available through the npm registry:

$ npm install gcode-lang-codemirror
Usage

Example usage with a basic editor and G-Code language suport

editor.js
// Import codemirror aspects
import { EditorState, EditorView, basicSetup } from '@codemirror/basic-setup';

// Import the language
import { GCodeLanguage } from 'gcode-lang-codemirror';

// Create the editor state pre-filled with some G-Code
let state = EditorState.create({
  doc: 'G1 X30.00 Y90\nG90\nG0', 
  extensions: [
    basicSetup,
    GCodeLanguage(),
  ]
});

// Create the editor view and bind to the element in the DOM
const view = new EditorView({
  state, 
  parent: document.querySelector('#editor')
});
License

MIT

Copyright (c) 2021-present, OneIsland Limited


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4