Socket
Socket
Sign inDemoInstall

monaco-yaml

Package Overview
Dependencies
Maintainers
5
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monaco-yaml

YAML plugin for the Monaco Editor


Version published
Maintainers
5
Created

What is monaco-yaml?

The monaco-yaml package is an extension for the Monaco Editor that provides YAML language support. It includes features such as syntax highlighting, validation, and autocompletion for YAML files.

What are monaco-yaml's main functionalities?

Syntax Highlighting

This feature allows the Monaco Editor to highlight YAML syntax, making it easier to read and write YAML files.

const monaco = require('monaco-editor');
require('monaco-yaml');

monaco.editor.create(document.getElementById('container'), {
  value: 'key: value',
  language: 'yaml'
});

Validation

This feature provides validation for YAML files based on JSON schemas, helping to ensure that the YAML content adheres to the expected structure.

const monaco = require('monaco-editor');
const monacoYaml = require('monaco-yaml');

monacoYaml.setDiagnosticsOptions({
  validate: true,
  schemas: [
    {
      uri: 'http://myserver/foo-schema.json',
      fileMatch: ['*'],
      schema: {
        type: 'object',
        properties: {
          key: {
            type: 'string'
          }
        },
        required: ['key']
      }
    }
  ]
});

monaco.editor.create(document.getElementById('container'), {
  value: 'key: value',
  language: 'yaml'
});

Autocompletion

This feature provides autocompletion for YAML files based on JSON schemas, making it easier to write valid YAML content.

const monaco = require('monaco-editor');
const monacoYaml = require('monaco-yaml');

monacoYaml.setDiagnosticsOptions({
  validate: true,
  schemas: [
    {
      uri: 'http://myserver/foo-schema.json',
      fileMatch: ['*'],
      schema: {
        type: 'object',
        properties: {
          key: {
            type: 'string'
          }
        },
        required: ['key']
      }
    }
  ]
});

monaco.editor.create(document.getElementById('container'), {
  value: 'key: ',
  language: 'yaml'
});

Other packages similar to monaco-yaml

Keywords

FAQs

Package last updated on 19 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc