A pure JavaScript library for syntax-highlighting SQL queries, supporting both terminal (ANSI escape codes) and HTML output. Current stable version is 6.1.0, actively maintained with frequent releases. It has zero runtime dependencies, ships TypeScript definitions, and offers a simple API with a single highlight function and a getSegments method for custom rendering. Unlike heavier alternatives like Prism or highlight.js, sql-highlight focuses solely on SQL and requires no CSS or language grammars beyond its built-in parser.
npm install sql-highlightNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Highlights a SQL query as HTML with custom CSS class prefix and inserts it into a DOM element.
npm install sql-highlight@latest
Use a library like lodash.escape or the DOM's createTextNode for escaping.
Update Node.js to version 14 or later, or use an older version of the library (e.g., 4.x).
Add "type": "module" to package.json, or use require('sql-highlight') instead.Use import { highlight } from 'sql-highlight'.Run npm install sql-highlight and ensure the import path is 'sql-highlight' (not a relative path).
No dependency data recorded yet.