diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb63387..8fdea18 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,13 +7,13 @@ jobs: name: ${{matrix.node}} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{matrix.node}} - run: npm install - run: npm test - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 strategy: matrix: node: diff --git a/package.json b/package.json index acdf0e6..84a78c6 100644 --- a/package.json +++ b/package.json @@ -41,18 +41,18 @@ "@types/mdast": "^4.0.0", "@types/node": "^20.0.0", "@types/unist": "^3.0.0", - "c8": "^8.0.0", + "c8": "^10.0.0", "chalk": "^5.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-to-html": "^9.0.0", "mdast-zone": "^6.0.0", "prettier": "^3.0.0", - "remark-cli": "^11.0.0", - "remark-preset-wooorm": "^9.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", "type-coverage": "^2.0.0", - "typescript": "^5.0.0", + "typescript": "^5.5.1-rc", "unified": "^11.0.0", - "xo": "^0.56.0" + "xo": "^0.58.0" }, "scripts": { "build": "tsc --build --clean && tsc --build && type-coverage", diff --git a/readme.md b/readme.md index f13ddb0..6270121 100644 --- a/readme.md +++ b/readme.md @@ -12,35 +12,35 @@ Virtual syntax highlighting for virtual DOMs and non-HTML things based on ## Contents -* [What is this?](#what-is-this) -* [When should I use this?](#when-should-i-use-this) -* [Install](#install) -* [Use](#use) -* [API](#api) - * [`all`](#all) - * [`common`](#common) - * [`createLowlight([grammars])`](#createlowlightgrammars) - * [`lowlight.highlight(language, value[, options])`](#lowlighthighlightlanguage-value-options) - * [`lowlight.highlightAuto(value[, options])`](#lowlighthighlightautovalue-options) - * [`lowlight.listLanguages()`](#lowlightlistlanguages) - * [`lowlight.register(grammars)`](#lowlightregistergrammars) - * [`lowlight.registerAlias(aliases)`](#lowlightregisteraliasaliases) - * [`lowlight.registered(aliasOrlanguage)`](#lowlightregisteredaliasorlanguage) - * [`AutoOptions`](#autooptions) - * [`LanguageFn`](#languagefn) - * [`Options`](#options) -* [Examples](#examples) - * [Example: serializing hast as html](#example-serializing-hast-as-html) - * [Example: turning hast into preact, react, etc](#example-turning-hast-into-preact-react-etc) -* [Types](#types) -* [Data](#data) -* [CSS](#css) -* [Compatibility](#compatibility) -* [Security](#security) -* [Related](#related) -* [Projects](#projects) -* [Contribute](#contribute) -* [License](#license) +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`all`](#all) + * [`common`](#common) + * [`createLowlight([grammars])`](#createlowlightgrammars) + * [`lowlight.highlight(language, value[, options])`](#lowlighthighlightlanguage-value-options) + * [`lowlight.highlightAuto(value[, options])`](#lowlighthighlightautovalue-options) + * [`lowlight.listLanguages()`](#lowlightlistlanguages) + * [`lowlight.register(grammars)`](#lowlightregistergrammars) + * [`lowlight.registerAlias(aliases)`](#lowlightregisteraliasaliases) + * [`lowlight.registered(aliasOrlanguage)`](#lowlightregisteredaliasorlanguage) + * [`AutoOptions`](#autooptions) + * [`LanguageFn`](#languagefn) + * [`Options`](#options) +* [Examples](#examples) + * [Example: serializing hast as html](#example-serializing-hast-as-html) + * [Example: turning hast into preact, react, etc](#example-turning-hast-into-preact-react-etc) +* [Types](#types) +* [Data](#data) +* [CSS](#css) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Projects](#projects) +* [Contribute](#contribute) +* [License](#license) ## What is this? @@ -136,8 +136,8 @@ Create a `lowlight` instance. ###### Parameters -* `grammars` ([`Record`][api-language-fn], optional) - — grammars to add +* `grammars` ([`Record`][api-language-fn], optional) + — grammars to add ###### Returns @@ -149,12 +149,12 @@ Highlight `value` (code) as `language` (name). ###### Parameters -* `language` (`string`) - — programming language [name][names] -* `value` (`string`) - — code to highlight -* `options` ([`Options`][api-options], optional) - — configuration +* `language` (`string`) + — programming language [name][names] +* `value` (`string`) + — code to highlight +* `options` ([`Options`][api-options], optional) + — configuration ###### Returns @@ -184,10 +184,10 @@ Highlight `value` (code) and guess its programming language. ###### Parameters -* `value` (`string`) - — code to highlight -* `options` ([`AutoOptions`][api-auto-options], optional) - — configuration +* `value` (`string`) + — code to highlight +* `options` ([`AutoOptions`][api-auto-options], optional) + — configuration ###### Returns @@ -240,17 +240,17 @@ Register languages. ###### Signatures -* `register(name, grammar)` -* `register(grammars)` +* `register(name, grammar)` +* `register(grammars)` ###### Parameters -* `name` (`string`) - — programming language [name][names] -* `grammar` ([`LanguageFn`][api-language-fn]) - — grammar -* `grammars` ([`Record`][api-language-fn], optional) - — grammars +* `name` (`string`) + — programming language [name][names] +* `grammar` ([`LanguageFn`][api-language-fn]) + — grammar +* `grammars` ([`Record`][api-language-fn], optional) + — grammars ###### Returns @@ -282,17 +282,17 @@ Register aliases. ###### Signatures -* `registerAlias(aliases)` -* `registerAlias(name, alias)` +* `registerAlias(aliases)` +* `registerAlias(name, alias)` ###### Parameters -* `aliases` (`Record | string>`) - — map of programming language [names][] to one or more aliases -* `name` (`string`) - — programming language [name][names] -* `alias` (`Array | string`) - — one or more aliases for the programming language +* `aliases` (`Record | string>`) + — map of programming language [names][] to one or more aliases +* `name` (`string`) + — programming language [name][names] +* `alias` (`Array | string`) + — one or more aliases for the programming language ###### Returns @@ -322,8 +322,8 @@ Check whether an alias or name is registered. ###### Parameters -* `aliasOrlanguage` (`string`) - — [name][names] of a language or alias for one +* `aliasOrlanguage` (`string`) + — [name][names] of a language or alias for one ###### Returns @@ -349,10 +349,10 @@ Configuration for `highlightAuto` (TypeScript type). ###### Fields -* `prefix` (`string`, default: `'hljs-'`) - — class prefix -* `subset` (`Array`, default: all registered languages) - — list of allowed languages +* `prefix` (`string`, default: `'hljs-'`) + — class prefix +* `subset` (`Array`, default: all registered languages) + — list of allowed languages ### `LanguageFn` @@ -370,8 +370,8 @@ Configuration for `highlight` (TypeScript type). ###### Fields -* `prefix` (`string`, default: `'hljs-'`) - — class prefix +* `prefix` (`string`, default: `'hljs-'`) + — class prefix ## Examples @@ -474,198 +474,198 @@ where `xxx` is the name, such as `'highlight.js/lib/languages/wasm'`. -* [ ] `1c` — 1C:Enterprise -* [ ] `abnf` — Augmented Backus-Naur Form -* [ ] `accesslog` — Apache Access Log -* [ ] `actionscript` (`as`) — ActionScript -* [ ] `ada` — Ada -* [ ] `angelscript` (`asc`) — AngelScript -* [ ] `apache` (`apacheconf`) — Apache config -* [ ] `applescript` (`osascript`) — AppleScript -* [ ] `arcade` — ArcGIS Arcade -* [x] `arduino` (`ino`) — Arduino -* [ ] `armasm` (`arm`) — ARM Assembly -* [ ] `asciidoc` (`adoc`) — AsciiDoc -* [ ] `aspectj` — AspectJ -* [ ] `autohotkey` (`ahk`) — AutoHotkey -* [ ] `autoit` — AutoIt -* [ ] `avrasm` — AVR Assembly -* [ ] `awk` — Awk -* [ ] `axapta` (`x++`) — X++ -* [x] `bash` (`sh`) — Bash -* [ ] `basic` — BASIC -* [ ] `bnf` — Backus–Naur Form -* [ ] `brainfuck` (`bf`) — Brainfuck -* [x] `c` (`h`) — C -* [ ] `cal` — C/AL -* [ ] `capnproto` (`capnp`) — Cap’n Proto -* [ ] `ceylon` — Ceylon -* [ ] `clean` (`icl`, `dcl`) — Clean -* [ ] `clojure` (`clj`, `edn`) — Clojure -* [ ] `clojure-repl` — Clojure REPL -* [ ] `cmake` (`cmake.in`) — CMake -* [ ] `coffeescript` (`coffee`, `cson`, `iced`) — CoffeeScript -* [ ] `coq` — Coq -* [ ] `cos` (`cls`) — Caché Object Script -* [x] `cpp` (`cc`, `c++`, `h++`, `hpp`, `hh`, `hxx`, `cxx`) — C++ -* [ ] `crmsh` (`crm`, `pcmk`) — crmsh -* [ ] `crystal` (`cr`) — Crystal -* [x] `csharp` (`cs`, `c#`) — C# -* [ ] `csp` — CSP -* [x] `css` — CSS -* [ ] `d` — D -* [ ] `dart` — Dart -* [ ] `delphi` (`dpr`, `dfm`, `pas`, `pascal`) — Delphi -* [x] `diff` (`patch`) — Diff -* [ ] `django` (`jinja`) — Django -* [ ] `dns` (`bind`, `zone`) — DNS Zone -* [ ] `dockerfile` (`docker`) — Dockerfile -* [ ] `dos` (`bat`, `cmd`) — Batch file (DOS) -* [ ] `dsconfig` — undefined -* [ ] `dts` — Device Tree -* [ ] `dust` (`dst`) — Dust -* [ ] `ebnf` — Extended Backus-Naur Form -* [ ] `elixir` (`ex`, `exs`) — Elixir -* [ ] `elm` — Elm -* [ ] `erb` — ERB -* [ ] `erlang` (`erl`) — Erlang -* [ ] `erlang-repl` — Erlang REPL -* [ ] `excel` (`xlsx`, `xls`) — Excel formulae -* [ ] `fix` — FIX -* [ ] `flix` — Flix -* [ ] `fortran` (`f90`, `f95`) — Fortran -* [ ] `fsharp` (`fs`, `f#`) — F# -* [ ] `gams` (`gms`) — GAMS -* [ ] `gauss` (`gss`) — GAUSS -* [ ] `gcode` (`nc`) — G-code (ISO 6983) -* [ ] `gherkin` (`feature`) — Gherkin -* [ ] `glsl` — GLSL -* [ ] `gml` — GML -* [x] `go` (`golang`) — Go -* [ ] `golo` — Golo -* [ ] `gradle` — Gradle -* [x] `graphql` (`gql`) — GraphQL -* [ ] `groovy` — Groovy -* [ ] `haml` — HAML -* [ ] `handlebars` (`hbs`, `html.hbs`, `html.handlebars`, `htmlbars`) — Handlebars -* [ ] `haskell` (`hs`) — Haskell -* [ ] `haxe` (`hx`) — Haxe -* [ ] `hsp` — HSP -* [ ] `http` (`https`) — HTTP -* [ ] `hy` (`hylang`) — Hy -* [ ] `inform7` (`i7`) — Inform 7 -* [x] `ini` (`toml`) — TOML, also INI -* [ ] `irpf90` — IRPF90 -* [ ] `isbl` — ISBL -* [x] `java` (`jsp`) — Java -* [x] `javascript` (`js`, `jsx`, `mjs`, `cjs`) — JavaScript -* [ ] `jboss-cli` (`wildfly-cli`) — JBoss CLI -* [x] `json` — JSON -* [ ] `julia` — Julia -* [ ] `julia-repl` (`jldoctest`) — Julia REPL -* [x] `kotlin` (`kt`, `kts`) — Kotlin -* [ ] `lasso` (`ls`, `lassoscript`) — Lasso -* [ ] `latex` (`tex`) — LaTeX -* [ ] `ldif` — LDIF -* [ ] `leaf` — Leaf -* [x] `less` — Less -* [ ] `lisp` — Lisp -* [ ] `livecodeserver` — LiveCode -* [ ] `livescript` (`ls`) — LiveScript -* [ ] `llvm` — LLVM IR -* [ ] `lsl` — LSL (Linden Scripting Language) -* [x] `lua` — Lua -* [x] `makefile` (`mk`, `mak`, `make`) — Makefile -* [x] `markdown` (`md`, `mkdown`, `mkd`) — Markdown -* [ ] `mathematica` (`mma`, `wl`) — Mathematica -* [ ] `matlab` — Matlab -* [ ] `maxima` — Maxima -* [ ] `mel` — MEL -* [ ] `mercury` (`m`, `moo`) — Mercury -* [ ] `mipsasm` (`mips`) — MIPS Assembly -* [ ] `mizar` — Mizar -* [ ] `mojolicious` — Mojolicious -* [ ] `monkey` — Monkey -* [ ] `moonscript` (`moon`) — MoonScript -* [ ] `n1ql` — N1QL -* [ ] `nestedtext` (`nt`) — Nested Text -* [ ] `nginx` (`nginxconf`) — Nginx config -* [ ] `nim` — Nim -* [ ] `nix` (`nixos`) — Nix -* [ ] `node-repl` — Node REPL -* [ ] `nsis` — NSIS -* [x] `objectivec` (`mm`, `objc`, `obj-c`, `obj-c++`, `objective-c++`) — Objective-C -* [ ] `ocaml` (`ml`) — OCaml -* [ ] `openscad` (`scad`) — OpenSCAD -* [ ] `oxygene` — Oxygene -* [ ] `parser3` — Parser3 -* [x] `perl` (`pl`, `pm`) — Perl -* [ ] `pf` (`pf.conf`) — Packet Filter config -* [ ] `pgsql` (`postgres`, `postgresql`) — PostgreSQL -* [x] `php` — undefined -* [x] `php-template` — PHP template -* [x] `plaintext` (`text`, `txt`) — Plain text -* [ ] `pony` — Pony -* [ ] `powershell` (`pwsh`, `ps`, `ps1`) — PowerShell -* [ ] `processing` (`pde`) — Processing -* [ ] `profile` — Python profiler -* [ ] `prolog` — Prolog -* [ ] `properties` — .properties -* [ ] `protobuf` (`proto`) — Protocol Buffers -* [ ] `puppet` (`pp`) — Puppet -* [ ] `purebasic` (`pb`, `pbi`) — PureBASIC -* [x] `python` (`py`, `gyp`, `ipython`) — Python -* [x] `python-repl` (`pycon`) — undefined -* [ ] `q` (`k`, `kdb`) — Q -* [ ] `qml` (`qt`) — QML -* [x] `r` — R -* [ ] `reasonml` (`re`) — ReasonML -* [ ] `rib` — RenderMan RIB -* [ ] `roboconf` (`graph`, `instances`) — Roboconf -* [ ] `routeros` (`mikrotik`) — MikroTik RouterOS script -* [ ] `rsl` — RenderMan RSL -* [x] `ruby` (`rb`, `gemspec`, `podspec`, `thor`, `irb`) — Ruby -* [ ] `ruleslanguage` — Oracle Rules Language -* [x] `rust` (`rs`) — Rust -* [ ] `sas` — SAS -* [ ] `scala` — Scala -* [ ] `scheme` (`scm`) — Scheme -* [ ] `scilab` (`sci`) — Scilab -* [x] `scss` — SCSS -* [x] `shell` (`console`, `shellsession`) — Shell Session -* [ ] `smali` — Smali -* [ ] `smalltalk` (`st`) — Smalltalk -* [ ] `sml` (`ml`) — SML (Standard ML) -* [ ] `sqf` — SQF -* [x] `sql` — SQL -* [ ] `stan` (`stanfuncs`) — Stan -* [ ] `stata` (`do`, `ado`) — Stata -* [ ] `step21` (`p21`, `step`, `stp`) — STEP Part 21 -* [ ] `stylus` (`styl`) — Stylus -* [ ] `subunit` — SubUnit -* [x] `swift` — Swift -* [ ] `taggerscript` — Tagger Script -* [ ] `tap` — Test Anything Protocol -* [ ] `tcl` (`tk`) — Tcl -* [ ] `thrift` — Thrift -* [ ] `tp` — TP -* [ ] `twig` (`craftcms`) — Twig -* [x] `typescript` (`ts`, `tsx`, `mts`, `cts`) — TypeScript -* [ ] `vala` — Vala -* [x] `vbnet` (`vb`) — Visual Basic .NET -* [ ] `vbscript` (`vbs`) — VBScript -* [ ] `vbscript-html` — VBScript in HTML -* [ ] `verilog` (`v`, `sv`, `svh`) — Verilog -* [ ] `vhdl` — VHDL -* [ ] `vim` — Vim Script -* [x] `wasm` — WebAssembly -* [ ] `wren` — Wren -* [ ] `x86asm` — Intel x86 Assembly -* [ ] `xl` (`tao`) — XL -* [x] `xml` (`html`, `xhtml`, `rss`, `atom`, `xjb`, `xsd`, `xsl`, `plist`, `wsf`, `svg`) — HTML, XML -* [ ] `xquery` (`xpath`, `xq`, `xqm`) — XQuery -* [x] `yaml` (`yml`) — YAML -* [ ] `zephir` (`zep`) — Zephir +* [ ] `1c` — 1C:Enterprise +* [ ] `abnf` — Augmented Backus-Naur Form +* [ ] `accesslog` — Apache Access Log +* [ ] `actionscript` (`as`) — ActionScript +* [ ] `ada` — Ada +* [ ] `angelscript` (`asc`) — AngelScript +* [ ] `apache` (`apacheconf`) — Apache config +* [ ] `applescript` (`osascript`) — AppleScript +* [ ] `arcade` — ArcGIS Arcade +* [x] `arduino` (`ino`) — Arduino +* [ ] `armasm` (`arm`) — ARM Assembly +* [ ] `asciidoc` (`adoc`) — AsciiDoc +* [ ] `aspectj` — AspectJ +* [ ] `autohotkey` (`ahk`) — AutoHotkey +* [ ] `autoit` — AutoIt +* [ ] `avrasm` — AVR Assembly +* [ ] `awk` — Awk +* [ ] `axapta` (`x++`) — X++ +* [x] `bash` (`sh`) — Bash +* [ ] `basic` — BASIC +* [ ] `bnf` — Backus–Naur Form +* [ ] `brainfuck` (`bf`) — Brainfuck +* [x] `c` (`h`) — C +* [ ] `cal` — C/AL +* [ ] `capnproto` (`capnp`) — Cap’n Proto +* [ ] `ceylon` — Ceylon +* [ ] `clean` (`icl`, `dcl`) — Clean +* [ ] `clojure` (`clj`, `edn`) — Clojure +* [ ] `clojure-repl` — Clojure REPL +* [ ] `cmake` (`cmake.in`) — CMake +* [ ] `coffeescript` (`coffee`, `cson`, `iced`) — CoffeeScript +* [ ] `coq` — Coq +* [ ] `cos` (`cls`) — Caché Object Script +* [x] `cpp` (`cc`, `c++`, `h++`, `hpp`, `hh`, `hxx`, `cxx`) — C++ +* [ ] `crmsh` (`crm`, `pcmk`) — crmsh +* [ ] `crystal` (`cr`) — Crystal +* [x] `csharp` (`cs`, `c#`) — C# +* [ ] `csp` — CSP +* [x] `css` — CSS +* [ ] `d` — D +* [ ] `dart` — Dart +* [ ] `delphi` (`dpr`, `dfm`, `pas`, `pascal`) — Delphi +* [x] `diff` (`patch`) — Diff +* [ ] `django` (`jinja`) — Django +* [ ] `dns` (`bind`, `zone`) — DNS Zone +* [ ] `dockerfile` (`docker`) — Dockerfile +* [ ] `dos` (`bat`, `cmd`) — Batch file (DOS) +* [ ] `dsconfig` — undefined +* [ ] `dts` — Device Tree +* [ ] `dust` (`dst`) — Dust +* [ ] `ebnf` — Extended Backus-Naur Form +* [ ] `elixir` (`ex`, `exs`) — Elixir +* [ ] `elm` — Elm +* [ ] `erb` — ERB +* [ ] `erlang` (`erl`) — Erlang +* [ ] `erlang-repl` — Erlang REPL +* [ ] `excel` (`xlsx`, `xls`) — Excel formulae +* [ ] `fix` — FIX +* [ ] `flix` — Flix +* [ ] `fortran` (`f90`, `f95`) — Fortran +* [ ] `fsharp` (`fs`, `f#`) — F# +* [ ] `gams` (`gms`) — GAMS +* [ ] `gauss` (`gss`) — GAUSS +* [ ] `gcode` (`nc`) — G-code (ISO 6983) +* [ ] `gherkin` (`feature`) — Gherkin +* [ ] `glsl` — GLSL +* [ ] `gml` — GML +* [x] `go` (`golang`) — Go +* [ ] `golo` — Golo +* [ ] `gradle` — Gradle +* [x] `graphql` (`gql`) — GraphQL +* [ ] `groovy` — Groovy +* [ ] `haml` — HAML +* [ ] `handlebars` (`hbs`, `html.hbs`, `html.handlebars`, `htmlbars`) — Handlebars +* [ ] `haskell` (`hs`) — Haskell +* [ ] `haxe` (`hx`) — Haxe +* [ ] `hsp` — HSP +* [ ] `http` (`https`) — HTTP +* [ ] `hy` (`hylang`) — Hy +* [ ] `inform7` (`i7`) — Inform 7 +* [x] `ini` (`toml`) — TOML, also INI +* [ ] `irpf90` — IRPF90 +* [ ] `isbl` — ISBL +* [x] `java` (`jsp`) — Java +* [x] `javascript` (`js`, `jsx`, `mjs`, `cjs`) — JavaScript +* [ ] `jboss-cli` (`wildfly-cli`) — JBoss CLI +* [x] `json` — JSON +* [ ] `julia` — Julia +* [ ] `julia-repl` (`jldoctest`) — Julia REPL +* [x] `kotlin` (`kt`, `kts`) — Kotlin +* [ ] `lasso` (`ls`, `lassoscript`) — Lasso +* [ ] `latex` (`tex`) — LaTeX +* [ ] `ldif` — LDIF +* [ ] `leaf` — Leaf +* [x] `less` — Less +* [ ] `lisp` — Lisp +* [ ] `livecodeserver` — LiveCode +* [ ] `livescript` (`ls`) — LiveScript +* [ ] `llvm` — LLVM IR +* [ ] `lsl` — LSL (Linden Scripting Language) +* [x] `lua` — Lua +* [x] `makefile` (`mk`, `mak`, `make`) — Makefile +* [x] `markdown` (`md`, `mkdown`, `mkd`) — Markdown +* [ ] `mathematica` (`mma`, `wl`) — Mathematica +* [ ] `matlab` — Matlab +* [ ] `maxima` — Maxima +* [ ] `mel` — MEL +* [ ] `mercury` (`m`, `moo`) — Mercury +* [ ] `mipsasm` (`mips`) — MIPS Assembly +* [ ] `mizar` — Mizar +* [ ] `mojolicious` — Mojolicious +* [ ] `monkey` — Monkey +* [ ] `moonscript` (`moon`) — MoonScript +* [ ] `n1ql` — N1QL +* [ ] `nestedtext` (`nt`) — Nested Text +* [ ] `nginx` (`nginxconf`) — Nginx config +* [ ] `nim` — Nim +* [ ] `nix` (`nixos`) — Nix +* [ ] `node-repl` — Node REPL +* [ ] `nsis` — NSIS +* [x] `objectivec` (`mm`, `objc`, `obj-c`, `obj-c++`, `objective-c++`) — Objective-C +* [ ] `ocaml` (`ml`) — OCaml +* [ ] `openscad` (`scad`) — OpenSCAD +* [ ] `oxygene` — Oxygene +* [ ] `parser3` — Parser3 +* [x] `perl` (`pl`, `pm`) — Perl +* [ ] `pf` (`pf.conf`) — Packet Filter config +* [ ] `pgsql` (`postgres`, `postgresql`) — PostgreSQL +* [x] `php` — undefined +* [x] `php-template` — PHP template +* [x] `plaintext` (`text`, `txt`) — Plain text +* [ ] `pony` — Pony +* [ ] `powershell` (`pwsh`, `ps`, `ps1`) — PowerShell +* [ ] `processing` (`pde`) — Processing +* [ ] `profile` — Python profiler +* [ ] `prolog` — Prolog +* [ ] `properties` — .properties +* [ ] `protobuf` (`proto`) — Protocol Buffers +* [ ] `puppet` (`pp`) — Puppet +* [ ] `purebasic` (`pb`, `pbi`) — PureBASIC +* [x] `python` (`py`, `gyp`, `ipython`) — Python +* [x] `python-repl` (`pycon`) — undefined +* [ ] `q` (`k`, `kdb`) — Q +* [ ] `qml` (`qt`) — QML +* [x] `r` — R +* [ ] `reasonml` (`re`) — ReasonML +* [ ] `rib` — RenderMan RIB +* [ ] `roboconf` (`graph`, `instances`) — Roboconf +* [ ] `routeros` (`mikrotik`) — MikroTik RouterOS script +* [ ] `rsl` — RenderMan RSL +* [x] `ruby` (`rb`, `gemspec`, `podspec`, `thor`, `irb`) — Ruby +* [ ] `ruleslanguage` — Oracle Rules Language +* [x] `rust` (`rs`) — Rust +* [ ] `sas` — SAS +* [ ] `scala` — Scala +* [ ] `scheme` (`scm`) — Scheme +* [ ] `scilab` (`sci`) — Scilab +* [x] `scss` — SCSS +* [x] `shell` (`console`, `shellsession`) — Shell Session +* [ ] `smali` — Smali +* [ ] `smalltalk` (`st`) — Smalltalk +* [ ] `sml` (`ml`) — SML (Standard ML) +* [ ] `sqf` — SQF +* [x] `sql` — SQL +* [ ] `stan` (`stanfuncs`) — Stan +* [ ] `stata` (`do`, `ado`) — Stata +* [ ] `step21` (`p21`, `step`, `stp`) — STEP Part 21 +* [ ] `stylus` (`styl`) — Stylus +* [ ] `subunit` — SubUnit +* [x] `swift` — Swift +* [ ] `taggerscript` — Tagger Script +* [ ] `tap` — Test Anything Protocol +* [ ] `tcl` (`tk`) — Tcl +* [ ] `thrift` — Thrift +* [ ] `tp` — TP +* [ ] `twig` (`craftcms`) — Twig +* [x] `typescript` (`ts`, `tsx`, `mts`, `cts`) — TypeScript +* [ ] `vala` — Vala +* [x] `vbnet` (`vb`) — Visual Basic .NET +* [ ] `vbscript` (`vbs`) — VBScript +* [ ] `vbscript-html` — VBScript in HTML +* [ ] `verilog` (`v`, `sv`, `svh`) — Verilog +* [ ] `vhdl` — VHDL +* [ ] `vim` — Vim Script +* [x] `wasm` — WebAssembly +* [ ] `wren` — Wren +* [ ] `x86asm` — Intel x86 Assembly +* [ ] `xl` (`tao`) — XL +* [x] `xml` (`html`, `xhtml`, `rss`, `atom`, `xjb`, `xsd`, `xsl`, `plist`, `wsf`, `svg`) — HTML, XML +* [ ] `xquery` (`xpath`, `xq`, `xqm`) — XQuery +* [x] `yaml` (`yml`) — YAML +* [ ] `zephir` (`zep`) — Zephir @@ -695,25 +695,25 @@ This package is safe. ## Related -* [`refractor`][refractor] - — the same as lowlight but with [Prism][] -* [`starry-night`][starry-night] - — similar but like GitHub and really good +* [`refractor`][refractor] + — the same as lowlight but with [Prism][] +* [`starry-night`][starry-night] + — similar but like GitHub and really good ## Projects -* [`emphasize`](https://github.com/wooorm/emphasize) - — syntax highlighting in ANSI (for the terminal) -* [`react-lowlight`](https://github.com/rexxars/react-lowlight) - — syntax highlighter for [React][] -* [`react-syntax-highlighter`](https://github.com/conorhastings/react-syntax-highlighter) - — [React][] component for syntax highlighting -* [`rehype-highlight`](https://github.com/rehypejs/rehype-highlight) - — [**rehype**](https://github.com/rehypejs/rehype) plugin to highlight code - blocks -* [`jstransformer-lowlight`](https://github.com/ai/jstransformer-lowlight) - — syntax highlighting for [JSTransformers](https://github.com/jstransformers) - and [Pug](https://pugjs.org/language/filters.html) +* [`emphasize`](https://github.com/wooorm/emphasize) + — syntax highlighting in ANSI (for the terminal) +* [`react-lowlight`](https://github.com/rexxars/react-lowlight) + — syntax highlighter for [React][] +* [`react-syntax-highlighter`](https://github.com/conorhastings/react-syntax-highlighter) + — [React][] component for syntax highlighting +* [`rehype-highlight`](https://github.com/rehypejs/rehype-highlight) + — [**rehype**](https://github.com/rehypejs/rehype) plugin to highlight code + blocks +* [`jstransformer-lowlight`](https://github.com/ai/jstransformer-lowlight) + — syntax highlighting for [JSTransformers](https://github.com/jstransformers) + and [Pug](https://pugjs.org/language/filters.html) ## Contribute diff --git a/script/build-registry.js b/script/build-registry.js index ff77d85..e009446 100644 --- a/script/build-registry.js +++ b/script/build-registry.js @@ -3,7 +3,7 @@ import chalk from 'chalk' import {name as isIdentifier} from 'estree-util-is-identifier-name' const base = new URL('../node_modules/highlight.js/', import.meta.url) -const doc = String(await fs.readFile(new URL('lib/index.js', base))) +const document = String(await fs.readFile(new URL('lib/index.js', base))) const category = /\/\*.*?Category: (.*?)\r?\n/s const register = /hljs\.registerLanguage\('(.+?)'/g @@ -17,14 +17,14 @@ let uncommon = [] /** @type {RegExpMatchArray | null} */ let match -while ((match = register.exec(doc))) all.push(match[1]) +while ((match = register.exec(document))) all.push(match[1]) while (++index < all.length) { - const doc = String( + const document = String( await fs.readFile(new URL('lib/languages/' + all[index] + '.js', base)) ) - const match = category.exec(doc) + const match = category.exec(document) if (match && match[1].split(/,\s?/).includes('common')) { common.push(all[index]) diff --git a/script/support.js b/script/support.js index 097f1c2..7b61b67 100644 --- a/script/support.js +++ b/script/support.js @@ -55,9 +55,9 @@ export default function support() { */ async function item(name) { /** @type {{default: LanguageFn}} */ - const mod = await import('highlight.js/lib/languages/' + name) - const fn = mod.default - const language = fn(hljs) + const languageModule = await import('highlight.js/lib/languages/' + name) + const languageFunction = languageModule.default + const language = languageFunction(hljs) /** @type {Array} */ const content = [{type: 'inlineCode', value: name}] let index = -1