Bundle language tools with CodeMirror package

This commit is contained in:
2026-07-09 21:25:04 +09:00
parent 59cb8f31e4
commit 8eac5c5cb4
24 changed files with 155 additions and 219 deletions
+22 -2
View File
@@ -2,8 +2,8 @@
CodeMirror 6 language support for Decodal.
This package provides the Lezer parser metadata, highlighting tags, indentation rules, and block folding used by the Decodal Web playground.
It does not include the Decodal runtime or WebAssembly evaluator.
This package provides the Lezer parser metadata, highlighting tags, indentation rules, block folding, and formatter command used by the Decodal Web playground.
It does not include the Decodal runtime evaluator.
Use `decodal-wasm` when you want to evaluate Decodal in a browser.
## Install
@@ -52,3 +52,23 @@ decodal({ highlight: false })
```
Use this when you want the language support without the bundled highlight style.
## Formatting
The formatter is exposed as a separate subpath so plain syntax highlighting does not force callers to initialize WebAssembly.
```js
import {
formatDecodal,
formatDecodalCommand,
initDecodalFormatter,
} from 'decodal-codemirror/format';
import formatterWasm from 'decodal-codemirror/wasm/decodal_language_tools_bg.wasm?url';
await initDecodalFormatter(formatterWasm);
const result = formatDecodal('Server={port=Int default 8080;};');
if (result.ok) console.log(result.source);
formatDecodalCommand(view);
```