Portable MoonBit syntax highlighting with per-line UTF-16 spans
import {
"bobzhang/codemirror-lang" @highlight,
}let lines = @highlight.tokenize("Go", "package main\r\n").unwrap()
let first = lines[0][0] // offsets 0..7, style Some("keyword")let lines = @diff.tokenize("+hello\r\n")
let first = lines[0][0] // offsets 0..6, style Some("positive")test {
let lines = @highlight.tokenize("Go", "package main\r\n").unwrap()
assert_eq(lines[0][0], { start: 0, end: 7, style: Some("keyword"), })
assert_eq(lines[1], [])
}Install
Download zipPortable MoonBit syntax highlighting with per-line UTF-16 spans