@imtheaman/lang-yaml
v1.0.0
Published
Enhanced YAML language support for CodeMirror with Boolean, Null, and Number type recognition
Downloads
3
Maintainers
Readme
@imtheaman/lang-yaml 
This package implements enhanced YAML language support for the CodeMirror code editor with proper recognition of Boolean, Null, and Number types.
Features
This enhanced version provides:
- Boolean type recognition: Properly highlights
true,false,yes,no,on,off(in various cases) - Null type recognition: Properly highlights
null,~,nil(in various cases) - Number type recognition: Properly highlights:
- Integers:
42,-17 - Hexadecimal:
0x2A - Octal:
0o52 - Binary:
0b101010 - Floating point:
3.14,-2.5,.5,10. - Scientific notation:
6.022e23,-1.5e-10 - Special float values:
.inf,-.inf,+.inf,.nan(and uppercase variants) - Base 60 (time values):
1:30,12:30:45,1:30:45.5
- Integers:
This package is based on the original @codemirror/lang-yaml and uses the enhanced @imtheaman/yaml parser.
This code is released under an MIT license.
Usage
import {EditorView, basicSetup} from "codemirror"
import {yaml} from "@imtheaman/lang-yaml"
const view = new EditorView({
parent: document.body,
doc: `name: Ferdinand
age: 93
active: true
score: null
rate: 3.14`,
extensions: [basicSetup, yaml()]
})