monaco-yaml-inline
v1.0.0
Published
Monaco Editor YAML support without Web Workers.
Maintainers
Readme
monaco-yaml-inline
monaco-yaml-inline is a non‑worker alternative to monaco-yaml.
It respects and follows the monaco-yaml API surface and behavior, but runs the YAML language
service inline on the main thread instead of using a Web Worker.
This project is intentionally aligned with monaco-yaml’s design and API. If you can use Web Workers, monaco-yaml is still the recommended and more performant choice.
Why this exists
Some environments can’t (or don’t want to) use Web Workers:
- embedded editors (inside native apps or constrained iframes)
- custom bundlers without worker support
- SSR + hydration setups where worker URLs are hard to manage
This project provides the same YAML features while keeping integration simple and universal.
Trade‑offs
Pros
- Works in any Monaco Editor environment without worker setup
- Easy to integrate with custom bundlers or CDN usage
Cons
- No Web Worker → YAML analysis runs on the main thread
- Large YAML files can cause noticeable UI slowdowns
Features
- YAML validation (schema-based)
- Completion
- Hover
- Definitions
- Document formatting
- On-type formatting
- Code actions
- Document symbols, links, folding, selection ranges
Install
npm install monaco-yaml-inlinemonaco-editor is a peer dependency. yaml-language-server is bundled internally.
Usage (CDN)
import { init } from "https://esm.sh/modern-monaco";
const { configureMonacoYaml } = await import(
"https://esm.sh/monaco-yaml-inline?bundle&target=es2020"
);
const monaco = await init();
configureMonacoYaml(monaco, {
schemas: [
{
uri: "inmemory://schema.yaml",
fileMatch: ["**/*.yaml", "**/*.yml"],
schema: {
type: "object",
properties: {
name: { type: "string" }
}
}
}
]
});API
configureMonacoYaml(monaco, options)
Registers YAML language features on a Monaco instance. Returns a handle:
dispose()– removes providers and markersupdate(options)– updates settings and revalidates
Options
completion,hover,validate,formatcustomTags,schemas,enableSchemaRequestyamlVersion,isKubernetesschemaRequestService
License
MIT
