Registry / devops / lsp-syntax-highlighter-compiler

lsp-syntax-highlighter-compiler

JSON →
library1.0.4jsnpmunverified

A compiler package for lsp-syntax-highlighter, transforming language server protocol data into syntax-highlighted HTML. Version 1.0.4. This package is the build-time component that processes grammar and theme definitions; runtime usage is handled by lsp-syntax-highlighter. Low release cadence, primarily used as a dependency. Differentiator: decouples compilation from rendering, enabling pre-compiled syntax data for performance.

npm install lsp-syntax-highlighter-compiler
INSTALL
IMPORT
SIG · LSP-SYNTAX-HIGHLIG
L
lsp-syntax-highlighter-compiler
devopsjavascriptv1.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

compile
import { compile } from 'lsp-syntax-highlighter-compiler'
const { default: compile } = require('lsp-syntax-highlighter-compiler')
ESM only; no default export.
CompilerOptions
import type { CompilerOptions } from 'lsp-syntax-highlighter-compiler'
import { CompilerOptions } from 'lsp-syntax-highlighter-compiler'
Type-only import for TypeScript users.
compileSource
import { compileSource } from 'lsp-syntax-highlighter-compiler/async'
import { compileSource } from 'lsp-syntax-highlighter-compiler'
Async variant is in subpath export '/async'. Available since v1.0.0.

Compiles grammars and themes, then renders highlighted HTML.

import { compile } from 'lsp-syntax-highlighter-compiler'; import { render } from 'lsp-syntax-highlighter'; const grammars = []; // your grammar JSON const themes = []; // your theme JSON const compiled = compile(grammars, themes); const html = render(compiled, 'source code'); console.log(html);
Debug
Known issues
gotchacompile() expects grammars and themes arrays, not single objects.
fix
Wrap single grammars/themes in arrays.
affects: >=1.0.0
gotchaCompiled output cannot be serialized to JSON directly; must use toJSON() method.
fix
Call JSON.stringify(compiled.toJSON()).
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: (intermediate value).compile is not a function
Importing default export instead of named.
fix
Use import { compile } from 'lsp-syntax-highlighter-compiler'
Error: Grammars must be an array
Passing single grammar object instead of array.
fix
Wrap grammar in array: compile([grammar], themes)
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
lsp-syntax-highlighteroptionalPeer dependency for runtime rendering of compiled output
Agent activity
4 hits · last 30 days
node
4
Resources
lsp-syntax-highlighter-compiler — npm install lsp-syntax-highlighter-compiler · libregistry