fix: markdown版本调整

This commit is contained in:
JiXinHui 2025-07-10 09:41:17 +08:00 committed by yangzhe
parent fb2d3d80ce
commit bc128e016b
1366 changed files with 53675 additions and 79517 deletions

View File

@ -6,16 +6,16 @@
<script> <script>
import marked from 'marked'; import marked from 'marked';
import { highlight } from 'highlight.js'; import hljs from 'highlight.js';
// marked // marked
marked.setOptions({ marked.setOptions({
renderer: new marked.Renderer(), renderer: new marked.Renderer(),
highlight: function(code, lang) { highlight: function(code, lang) {
try { try {
return highlight(lang, code).value; return hljs.highlightAuto(code, [lang]).value;
} catch (e) { } catch (e) {
return highlight('plaintext', code).value; return hljs.highlightAuto(code).value;
} }
}, },
gfm: true, gfm: true,

View File

@ -18,6 +18,9 @@
"peerDependencies": { "peerDependencies": {
"@dcloudio/uni-app": ">=2.0.0" "@dcloudio/uni-app": ">=2.0.0"
}, },
"engines": {
"node": ">=12.0.0"
},
"author": "YourName", "author": "YourName",
"license": "MIT" "license": "MIT"
} }

16
node_modules/.package-lock.json generated vendored
View File

@ -1,7 +1,7 @@
{ {
"name": "uView", "name": "uView",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 3, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"node_modules/base64-arraybuffer": { "node_modules/base64-arraybuffer": {
@ -26,9 +26,9 @@
} }
}, },
"node_modules/highlight.js": { "node_modules/highlight.js": {
"version": "11.11.1", "version": "11.8.0",
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.11.1.tgz", "resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.8.0.tgz",
"integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==", "integrity": "sha512-MedQhoqVdr0U6SSnWPzfiadUcDHfN/Wzq25AkXiQv9oiOO/sG0S7XkvpFIqWBl9Yq1UYyYOOVORs5UW2XlPyzg==",
"engines": { "engines": {
"node": ">=12.0.0" "node": ">=12.0.0"
} }
@ -56,14 +56,14 @@
"integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w==" "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
}, },
"node_modules/marked": { "node_modules/marked": {
"version": "16.0.0", "version": "4.3.0",
"resolved": "https://registry.npmmirror.com/marked/-/marked-16.0.0.tgz", "resolved": "https://registry.npmmirror.com/marked/-/marked-4.3.0.tgz",
"integrity": "sha512-MUKMXDjsD/eptB7GPzxo4xcnLS6oo7/RHimUMHEDRhUooPwmN9BEpMl7AEOJv3bmso169wHI2wUF9VQgL7zfmA==", "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==",
"bin": { "bin": {
"marked": "bin/marked.js" "marked": "bin/marked.js"
}, },
"engines": { "engines": {
"node": ">= 20" "node": ">= 12"
} }
}, },
"node_modules/mp-html": { "node_modules/mp-html": {

291
node_modules/highlight.js/CHANGES.md generated vendored
View File

@ -1,290 +1,3 @@
## Version 11.11.1
- Fixes regression with Rust grammar.
## Version 11.11.0
CAVEATS / POTENTIALLY BREAKING CHANGES
- Nothing yet.
Core Grammars:
- fix(rust) - adds emoji support in single quote strings [joshgoebel][]
- fix(apache) - support line continuation via `\` [Josh Goebel][]
- fix(makefile) - allow strings inside `$()` expressions [aneesh98][]
- enh(arcade) updated to ArcGIS Arcade version 1.29 [Kristian Ekenes][]
- enh(css) add all properties listed on MDN (96 additions including `anchor-name`, `aspect-ratio`, `backdrop-filter`, `container`, `margin-trim`, `place-content`, `scroll-timeline`, ...) [BaliBalo][]
- enh(excel) add built-in functions for Excel 365 release to 2024 [Danny Winrow][]
- enh(erlang) OTP 27 triple-quoted strings [nixxquality][]
- enh(erlang) OTP 27 doc attribute [nixxquality][]
- enh(erlang) OTP 27 Sigil type [nixxquality][]
- enh(erlang) OTP25/27 maybe statement [nixxquality][]
- enh(dart) Support digit-separators in number literals [Sam Rawlins][]
- enh(csharp) add Contextual keywords `file`, `args`, `dynamic`, `record`, `required` and `scoped` [Alvin Joy][]
- enh(lua) add 'pluto' as an alias [Sainan]
- enh(bash) add reserved keywords `time` and `coproc` [Álvaro Mondéjar][]
- enh(nix) update keywords [h7x4][]
- enh(nix) support paths [h7x4][]
- enh(nix) support lookup paths [h7x4][]
- enh(nix) support operators [h7x4][]
- enh(nix) support REPL keywords [h7x4][]
- enh(nix) support markdown comments [h7x4][]
- enh(nix) support basic function params [h7x4][]
- enh(nix) better parsing of attrsets [h7x4][]
- fix(c) - Fixed hex numbers with decimals [Dxuian]
- fix(typescript) - Fixedoptional property not highlighted correctly [Dxuian]
- fix(ruby) - fix `|=` operator false positives (as block arguments) [Aboobacker MK]
- enh(gcode) rewrote language for modern gcode support [Barthélémy Bonhomme][]
- fix(sql) - Fixed sql primary key and foreign key spacing issue [Dxuian]
- fix(cpp) added flat_set and flat_map as a part of cpp 23 version [Lavan]
- fix(yaml) - Fixed special chars in yaml [Dxuian]
- fix(basic) - Fixed closing quotation marks not required for a PRINT statement [Somya]
- fix(nix) remove `add` builtin [h7x4][]
- fix(nix) mark `or` as builtin instead of literal [h7x4][]
- fix(nix) handle `'''` string escapes [h7x4][]
- fix(nix) handle backslash string escapes [h7x4][]
- fix(nix) don't mix escapes for `"` and `''` strings [h7x4][]
- fix(swift) - Fixed syntax highlighting for class func/var declarations [guuido]
- fix(yaml) - Fixed wrong escaping behavior in single quoted strings [guuido]
- enh(nim) - Add `concept` and `defer` to list of Nim keywords [Jake Leahy]
New Grammars:
- added 3rd party TTCN-3 grammar to SUPPORTED_LANGUAGES [Osmocom][]
- added 3rd party Odin grammar to SUPPORTED_LANGUAGES [clsource][]
- added 3rd party Liquid grammar to SUPPORTED_LANGUAGES [Laurel King][]
Developer Tools:
- Nothing yet.
Themes:
- Added `Rosé Pine` theme [William Wilkinson][]
- Added `Cybertopia Cherry` theme [Alexandre ZANNI][]
- Added `Cybertopia Dimmer` theme [Alexandre ZANNI][]
- Added `Cybertopia Icecap` theme [Alexandre ZANNI][]
- Added `Cybertopia Saturated` theme [Alexandre ZANNI][]
Improvements:
- Resolve the memory leak problem when creating multiple Highlight.js instances [Imken][]
CONTRIBUTORS
[Josh Goebel]: https://github.com/joshgoebel
[aneesh98]: https://github.com/aneesh98
[BaliBalo]: https://github.com/BaliBalo
[William Wilkinson]: https://github.com/wilkinson4
[nixxquality]: https://github.com/nixxquality
[srawlins]: https://github.com/srawlins
[Alvin Joy]: https://github.com/alvinsjoy
[Dxuian]:https://github.com/Dxuian
[Aboobacker MK]: https://github.com/tachyons
[Imken]: https://github.com/immccn123
[Sainan]: https://github.com/Sainan
[Osmocom]: https://github.com/osmocom
[Álvaro Mondéjar]: https://github.com/mondeja
[Alexandre ZANNI]: https://github.com/noraj
[Barthélémy Bonhomme]: https://github.com/barthy-koeln
[Lavan]: https://github.com/jvlavan
[Somya]: https://github.com/somya-05
[guuido]: https://github.com/guuido
[clsource]: https://github.com/clsource
[Jake Leahy]: https://github.com/ire4ever1190
[Laurel King]: https://github.com/laurelthorburn
[Kristian Ekenes]: https://github.com/ekenes
[Danny Winrow]: https://github.com/dannywinrow
## Version 11.10.0
CAVEATS / POTENTIALLY BREAKING CHANGES
- Drops support for Node 16.x, which is no longer supported by Node.js.
Core Grammars:
- enh(typescript) add support for `satisfies` operator [Kisaragi Hiu][]
- enc(c) added more C23 keywords [Melkor-1][]
- enh(json) added jsonc as an alias [BackupMiles][]
- enh(gml) updated to latest language version (GML v2024.2) [gnysek][]
- enh(c) added more C23 keywords and preprcoessor directives [Eisenwave][]
- enh(js/ts) support namespaced tagged template strings [Aral Balkan][]
- enh(perl) fix false-positive variable match at end of string [Josh Goebel][]
- fix(cpp) not all kinds of number literals are highlighted correctly [Lê Duy Quang][]
- fix(css) fix overly greedy pseudo class matching [Bradley Mackey][]
- enh(arcade) updated to ArcGIS Arcade version 1.24 [Kristian Ekenes][]
- fix(typescript): params types [Mohamed Ali][]
- fix(rust) fix escaped double quotes in string [Mohamed Ali][]
- fix(rust) fix for r# raw identifier not being highlighted correctly. [JaeBaek Lee][]
- enh(rust) Adding union to be recognized as a keyword in Rust. [JaeBaek Lee][]
- fix(yaml) fix for yaml with keys having brackets highlighted incorrectly [Aneesh Kulkarni][]
- fix(csharp) add raw string highlighting for C# 11. [Tara][]
- fix(bash) fix # within token being detected as the start of a comment [Felix Uhl][]
- fix(python) fix `or` conflicts with string highlighting [Mohamed Ali][]
- enh(python) adds a scope to the `self` variable [Lee Falin][]
- enh(delphi) allow digits to be omitted for hex and binary literals [Jonah Jeleniewski][]
- enh(delphi) add support for digit separators [Jonah Jeleniewski][]
- enh(delphi) add support for character strings with non-decimal numerics [Jonah Jeleniewski][]
- fix(javascript) incorrect function name highlighting [CY Fung][]
- fix(1c) fix escaped symbols "+-;():=,[]" literals [Vitaly Barilko][]
- fix(swift) correctly highlight generics and conformances in type definitions [Bradley Mackey][]
- enh(swift) add package keyword [Bradley Mackey][]
- fix(swift) ensure keyword attributes highlight correctly [Bradley Mackey][]
- fix(types) fix interface LanguageDetail > keywords [Patrick Chiu]
- enh(java) add `goto` to be recognized as a keyword in Java [Alvin Joy][]
- enh(bash) add keyword `sudo` [Alvin Joy][]
- fix(haxe) captures `new` keyword without capturing it within variables/class names [Cameron Taylor][]
- fix(go) fix go number literals to accept `_` separators, add hex p exponents [Lisa Ugray][]
- enh(markdown) add entity support [David Schach][] [TaraLei][]
- enh(css) add `justify-items` and `justify-self` attributes [Vasily Polovnyov][]
- enh(css) add `accent-color`, `appearance`, `color-scheme`, `rotate`, `scale` and `translate` attributes [Carl Räfting][]
- fix(fortran) fixes parsing of keywords delimited by dots [Julien Bloino][]
- enh(css) add `select`, `option`, `optgroup`, `picture` and `source` to list of known tags [Vasily Polovnyov][]
- enh(css) add `inset`, `inset-*`, `border-start-*-radius` and `border-end-*-radius` attributes [Vasily Polovnyov][]
- enh(css) add `text-decoration-skip-ink`, `text-decoration-thickness` and `text-underline-offset` attributes [Vasily Polovnyov][]
- enh(java) add `when` to be recognized as a keyword in Java [Chiel van de Steeg][]
New Grammars:
- added 3rd party CODEOWNERS grammar to SUPPORTED_LANGUAGES [nataliia-radina][]
- added 3rd party Luau grammar to SUPPORTED_LANGUAGES [Robloxian Demo][]
- added 3rd party ReScript grammar to SUPPORTED_LANGUAGES [Paul Tsnobiladzé][]
- added 3rd party Zig grammar to SUPPORTED_LANGUAGES [Hyou BunKen][]
- added 3rd party WGSL grammar to SUPPORTED_LANGUAGES [Arman Uguray][]
- added 3rd party Unison grammar to SUPPORTED_LANGUAGES [Rúnar Bjarnason][]
- added 3rd party Phix grammar to SUPPORTED_LANGUAGES [PeteLomax][]
- added 3rd party Mirth grammar to SUPPORTED_LANGUAGES [Sierra][]
- added 3rd party JSONata grammar to SUPPORTED_LANGUAGES [Vlad Dimov][]
Developer Tool:
- enh(tools): order CSS options picklist [David Schach][]
- enh(tools): remove duplicate CSS options [David Schach][]
- (typescript): deprecate old `highlight` API [Misha Kaletsky][]
Themes:
- Added `1c-light` theme a like in the IDE 1C:Enterprise 8 (for 1c) [Vitaly Barilko][]
[Kisaragi Hiu]: https://github.com/kisaragi-hiu
[Melkor-1]: https://github.com/Melkor-1
[PeteLomax]: https://github.com/petelomax
[gnysek]: https://github.com/gnysek
[Eisenwave]: https://github.com/Eisenwave
[Aral Balkan]: https://github.com/aral
[Lê Duy Quang]: https://github.com/leduyquang753
[Mohamed Ali]: https://github.com/MohamedAli00949
[JaeBaek Lee]: https://github.com/ThinkingVincent
[Bradley Mackey]: https://github.com/bradleymackey
[Kristian Ekenes]: https://github.com/ekenes
[Aneesh Kulkarni]: https://github.com/aneesh98
[Bruno Meneguele]: https://github.com/bmeneg
[Tara]: https://github.com/taralei
[Felix Uhl]: https://github.com/iFreilicht
[nataliia-radina]: https://github.com/Nataliia-Radina
[Robloxian Demo]: https://github.com/RobloxianDemo
[Paul Tsnobiladzé]: https://github.com/tsnobip
[Jonah Jeleniewski]: https://github.com/cirras
[Josh Goebel]: https://github.com/joshgoebel
[CY Fung]: https://github.com/cyfung1031
[Vitaly Barilko]: https://github.com/Diversus23
[Patrick Chiu]: https://github.com/patrick-kw-chiu
[Alvin Joy]: https://github.com/alvinsjoy
[Lisa Ugray]: https://github.com/lugray
[TaraLei]: https://github.com/TaraLei
[Cameron Taylor]: https://github.com/ninjamuffin99
[Vasily Polovnyov]: https://github.com/vast
[Arman Uguray]: https://github.com/armansito
[Rúnar Bjarnason]: https://github.com/runarorama
[Carl Räfting]: https://github.com/carlrafting
[BackupMiles]: https://github.com/BackupMiles
[Julien Bloino]: https://github.com/jbloino
[Sierra]: https://github.com/casuallyblue
[Vlad Dimov]: https://github.com/DevDimov
[Chiel van de Steeg]: https://github.com/cvdsteeg
## Version 11.9.0
CAVEATS / POTENTIALLY BREAKING CHANGES
- Drops support for Node 14.x, which is no longer supported by Node.js.
- In the `node` build `styles/*.css` files now ship un-minified
with minified counterparts as: `styles/*.min.css` [mvorisek][]
(this makes things consistent with our `cdn` builds)
Parser:
- (enh) prevent re-highlighting of an element [joshgoebel][]
- (chore) Remove discontinued badges from README [Bradley Mackey][]
- (chore) Fix build size report [Bradley Mackey][]
New Grammars:
- added 3rd party Iptables grammar to SUPPORTED_LANGUAGES [Checconio][]
- added 3rd party x86asmatt grammar to SUPPORTED_LANGUAGES [gondow][]
- added 3rd party riscv64 grammar to SUPPORTED_LANGUAGES [aana-h2][]
- added 3rd party Ballerina grammar to SUPPORTED_LANGUAGES [Yasith Deelaka][]
Core Grammars:
- fix(cpp) fixed highlighter break state [Md Saad Akhtar][]
- fix(rust) added negative-lookahead for callable keywords `if` `while` `for` [Omar Hussein][]
- enh(armasm) added `x0-x30` and `w0-w30` ARMv8 registers [Nicholas Thompson][]
- enh(haxe) added `final`, `is`, `macro` keywords and `$` identifiers [Robert Borghese][]
- enh(haxe) support numeric separators and suffixes [Robert Borghese][]
- fix(haxe) fixed metadata arguments and support non-colon syntax [Robert Borghese][]
- fix(haxe) differentiate `abstract` declaration from keyword [Robert Borghese][]
- fix(bash) do not delimit a string by an escaped apostrophe [hancar][]
- enh(swift) support `macro` keyword [Bradley Mackey][]
- enh(swift) support parameter pack keywords [Bradley Mackey][]
- enh(swift) regex literal support [Bradley Mackey][]
- enh(swift) `@unchecked` and `@Sendable` support [Bradley Mackey][]
- enh(scala) add using directives support `//> using foo bar` [Jamie Thompson][]
- fix(scala) fixed comments in constructor arguments not being properly highlighted [Isaac Nonato][]
- enh(swift) ownership modifiers support [Bradley Mackey][]
- enh(nsis) Add `!assert` compiler flag [idleberg][]
- fix(haskell) do not treat double dashes inside infix operators as comments [Zlondrej][]
- enh(rust) added `eprintln!` macro [qoheniac][]
- enh(leaf) update syntax to 4.0 [Samuel Bishop][]
- fix(reasonml) simplify syntax and align it with ocaml [jchavarri][]
- fix(swift) `warn_unqualified_access` is an attribute [Bradley Mackey][]
- enh(swift) macro attributes are highlighted as keywords [Bradley Mackey][]
- enh(stan) updated for version 2.33 (#3859) [Brian Ward][]
- enh(llvm) match additional types [wtz][]
- fix(css) added '_' css variable detection [Md Saad Akhtar][]
- enh(groovy) add `record` and `var` as keywords [Guillaume Laforge][]
Developer Tool:
- (chore) Update dev tool to use the new `highlight` API. [Shah Shabbir Ahmmed][]
- (enh) Auto-update the highlighted output when the language dropdown changes. [Shah Shabbir Ahmmed][]
[Robert Borghese]: https://github.com/RobertBorghese
[Isaac Nonato]: https://github.com/isaacnonato
[Shah Shabbir Ahmmed]: https://github.com/shabbir23ah
[Josh Goebel]: https://github.com/joshgoebel
[Checconio]: https://github.com/Checconio
[Bradley Mackey]: https://github.com/bradleymackey
[mvorisek]: https://github.com/mvorisek
[qoheniac]: https://github.com/qoheniac
[Samuel Bishop]: https://github.com/dannflor
[gondow]: https://github.com/gondow
[jchavarri]: https://github.com/jchavarri
[aana-h2]: https://github.com/aana-h2
[Nicholas Thompson]: https://github.com/NAThompson
[Yasith Deelaka]: https://github.com/YasithD
[Brian Ward]: https://github.com/WardBrian
[wtz]: https://github.com/wangtz0607
[Md Saad Akhtar]: https://github.com/akhtarmdsaad
[Guillaume Laforge]: https://github.com/glaforge
## Version 11.8.0 ## Version 11.8.0
Parser engine: Parser engine:
@ -326,7 +39,6 @@ Core Grammars:
[AdamRaichu]: https://github.com/AdamRaichu [AdamRaichu]: https://github.com/AdamRaichu
[Ali Ukani]: https://github.com/ali [Ali Ukani]: https://github.com/ali
[Jeroen van Vianen]: https://github.com/morinel [Jeroen van Vianen]: https://github.com/morinel
[gnysek]: https://github.com/gnysek
[Rijenkii]: https://github.com/rijenkii [Rijenkii]: https://github.com/rijenkii
[faga295]: https://github.com/faga295 [faga295]: https://github.com/faga295
[rvanasa]: https://github.com/rvanasa [rvanasa]: https://github.com/rvanasa
@ -335,8 +47,6 @@ Core Grammars:
[Keyacom]: https://github.com/Keyacom [Keyacom]: https://github.com/Keyacom
[Boris Verkhovskiy]: https://github.com/verhovsky [Boris Verkhovskiy]: https://github.com/verhovsky
[Cyrus Kao]: https://github.com/CyrusKao [Cyrus Kao]: https://github.com/CyrusKao
[Zlondrej]: https://github.com/zlondrej
## Version 11.7.0 ## Version 11.7.0
@ -425,7 +135,6 @@ Grammars:
[Mousetail]: https://github.com/mousetail [Mousetail]: https://github.com/mousetail
[Gabriel Gonçalves]: https://github.com/KTSnowy [Gabriel Gonçalves]: https://github.com/KTSnowy
[Nikita Sobolev]: https://github.com/sobolevn [Nikita Sobolev]: https://github.com/sobolevn
[Misha Kaletsky]: https://github.com/mmkal
## Version 11.5.0 ## Version 11.5.0

113
node_modules/highlight.js/README.md generated vendored
View File

@ -8,8 +8,10 @@
[![jsDelivr CDN downloads](https://badgen.net/jsdelivr/hits/gh/highlightjs/cdn-release?label=jsDelivr+CDN&color=purple)](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release) [![jsDelivr CDN downloads](https://badgen.net/jsdelivr/hits/gh/highlightjs/cdn-release?label=jsDelivr+CDN&color=purple)](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release)
[![ci status](https://badgen.net/github/checks/highlightjs/highlight.js/main?label=build)](https://github.com/highlightjs/highlight.js/actions/workflows/tests.js.yml) [![ci status](https://badgen.net/github/checks/highlightjs/highlight.js/main?label=build)](https://github.com/highlightjs/highlight.js/actions/workflows/tests.js.yml)
[![CodeQL](https://github.com/highlightjs/highlight.js/workflows/CodeQL/badge.svg)](https://github.com/highlightjs/highlight.js/actions/workflows/github-code-scanning/codeql) [![code quality](https://badgen.net/lgtm/grade/g/highlightjs/highlight.js/js?label=code+quality)](https://lgtm.com/projects/g/highlightjs/highlight.js/?mode=list)
[![vulnerabilities](https://badgen.net/snyk/highlightjs/highlight.js)](https://snyk.io/test/github/highlightjs/highlight.js?targetFile=package.json) [![vulnerabilities](https://badgen.net/snyk/highlightjs/highlight.js)](https://snyk.io/test/github/highlightjs/highlight.js?targetFile=package.json)
![dev deps](https://badgen.net/david/dev/highlightjs/highlight.js?label=dev+deps)
[![discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=pink)](https://discord.gg/M24EbU7ja9) [![discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=pink)](https://discord.gg/M24EbU7ja9)
[![open issues](https://badgen.net/github/open-issues/highlightjs/highlight.js?label=issues)](https://github.com/highlightjs/highlight.js/issues) [![open issues](https://badgen.net/github/open-issues/highlightjs/highlight.js?label=issues)](https://github.com/highlightjs/highlight.js/issues)
@ -41,15 +43,14 @@ detection.
- [Using with Vue.js](#using-with-vuejs) - [Using with Vue.js](#using-with-vuejs)
- [Using Web Workers](#using-web-workers) - [Using Web Workers](#using-web-workers)
- [Importing the Library](#importing-the-library) - [Importing the Library](#importing-the-library)
- [Node.js CommonJS Modules / `require`](#nodejs-commonjs-modules--require) - [Node.js / `require`](#nodejs--require)
- [Node.js ES6 Modules / `import`](#nodejs-es6-modules--import) - [ES6 Modules / `import`](#es6-modules--import)
- [Browser ES6 Modules](#browser-es6-modules)
- [Getting the Library](#getting-the-library) - [Getting the Library](#getting-the-library)
- [Fetch via CDN](#fetch-via-cdn) - [Fetch via CDN](#fetch-via-cdn)
- [cdnjs (link)](#cdnjs-link) - [cdnjs (link)](#cdnjs-link)
- [jsdelivr (link)](#jsdelivr-link) - [jsdelivr (link)](#jsdelivr-link)
- [unpkg (link)](#unpkg-link) - [unpkg (link)](#unpkg-link)
- [Download prebuilt CDN assets](#download-prebuilt-cdn-assets) - [Download prebuilt CDN assets](#download-prebuilt-cdn-assets)
- [Download from our website](#download-from-our-website) - [Download from our website](#download-from-our-website)
- [Install via NPM package](#install-via-npm-package) - [Install via NPM package](#install-via-npm-package)
- [Build from Source](#build-from-source) - [Build from Source](#build-from-source)
@ -84,7 +85,7 @@ library along with one of the themes and calling [`highlightAll`][1]:
This will find and highlight code inside of `<pre><code>` tags; it tries This will find and highlight code inside of `<pre><code>` tags; it tries
to detect the language automatically. If automatic detection doesnt to detect the language automatically. If automatic detection doesnt
work for you, or you simply prefer to be explicit, you can specify the language manually by using the `class` attribute: work for you, or you simply prefer to be explicit, you can specify the language manually in the using the `class` attribute:
```html ```html
@ -241,7 +242,7 @@ onmessage = (event) => {
First, you'll likely be installing the library via `npm` or `yarn` -- see [Getting the Library](#getting-the-library). First, you'll likely be installing the library via `npm` or `yarn` -- see [Getting the Library](#getting-the-library).
### Node.js CommonJS Modules / `require` ### Node.js / `require`
Requiring the top-level library will load all languages: Requiring the top-level library will load all languages:
@ -267,7 +268,10 @@ const highlightedCode = hljs.highlight('<span>Hello World!</span>', {language: '
``` ```
### Node.js ES6 Modules / `import` ### ES6 Modules / `import`
*Note: You can also import directly from fully static URLs, such as our very own pre-built
ES6 Module CDN resources. See [Fetch via CDN](#fetch-via-cdn) for specific examples.*
The default import will register all languages: The default import will register all languages:
@ -290,53 +294,6 @@ import hljs from 'highlight.js';
import 'highlight.js/styles/github.css'; import 'highlight.js/styles/github.css';
``` ```
### Browser ES6 Modules
*Note: For now you'll want to install `@highlightjs/cdn-assets` package instead of `highlight.js`.
See [Download prebuilt CDN assets](#download-prebuilt-cdn-assets)*
To import the library and register only those languages that you need:
```js
import hljs from './assets/js/@highlightjs/cdn-assets/es/core.js';
import javascript from './assets/js/@highlightjs/cdn-assets/es/languages/javascript.min.js';
hljs.registerLanguage('javascript', javascript);
```
To import the library and register all languages:
```js
import hljs from './assets/js/@highlightjs/cdn-assets/es/highlight.js';
```
*Note: The path to these files will vary depending on where you have installed/copied them
within your project or site. The above path is only an example.*
You can also use [`importmap`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) to import in similar way as Node:
```html
<script type="importmap">
{
"imports": {
"@highlightjs": "./assets/js/@highlightjs/cdn-assets/es/"
}
}
</script>
```
Use the above code in your HTML. After that, your JavaScript can import using the named key from
your `importmap`, for example `@highlightjs` in this case:
```js
import hljs from '@highlightjs/core.js';
import javascript from '@highlightjs/languages/javascript.min.js';
hljs.registerLanguage('javascript', javascript);
```
*Note: You can also import directly from fully static URLs, such as our very own pre-built ES6 Module CDN resources. See [Fetch via CDN](#fetch-via-cdn) for specific examples.*
## Getting the Library ## Getting the Library
@ -370,20 +327,20 @@ see [DIGESTS.md](https://github.com/highlightjs/cdn-release/blob/main/DIGESTS.md
##### Common JS <!-- omit in toc --> ##### Common JS <!-- omit in toc -->
```html ```html
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages --> <!-- and it's easy to individually load additional languages -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/languages/go.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/go.min.js"></script>
``` ```
##### ES6 Modules <!-- omit in toc --> ##### ES6 Modules <!-- omit in toc -->
````html ````html
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/dark.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/dark.min.css">
<script type="module"> <script type="module">
import hljs from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/es/highlight.min.js'; import hljs from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/es/highlight.min.js';
// and it's easy to individually load additional languages // and it's easy to individually load additional languages
import go from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/es/languages/go.min.js'; import go from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/es/languages/go.min.js';
hljs.registerLanguage('go', go); hljs.registerLanguage('go', go);
</script> </script>
@ -395,20 +352,20 @@ hljs.registerLanguage('go', go);
##### Common JS <!-- omit in toc --> ##### Common JS <!-- omit in toc -->
```html ```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/styles/default.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/default.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages --> <!-- and it's easy to individually load additional languages -->
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/languages/go.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/languages/go.min.js"></script>
``` ```
##### ES6 Modules <!-- omit in toc --> ##### ES6 Modules <!-- omit in toc -->
```html ```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/styles/default.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/default.min.css">
<script type="module"> <script type="module">
import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/es/highlight.min.js'; import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/es/highlight.min.js';
// and it's easy to individually load additional languages // and it's easy to individually load additional languages
import go from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/es/languages/go.min.js'; import go from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/es/languages/go.min.js';
hljs.registerLanguage('go', go); hljs.registerLanguage('go', go);
</script> </script>
``` ```
@ -418,20 +375,20 @@ hljs.registerLanguage('go', go);
##### Common JS <!-- omit in toc --> ##### Common JS <!-- omit in toc -->
```html ```html
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/default.min.css"> <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.8.0/styles/default.min.css">
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/highlight.min.js"></script> <script src="https://unpkg.com/@highlightjs/cdn-assets@11.8.0/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages --> <!-- and it's easy to individually load additional languages -->
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/languages/go.min.js"></script> <script src="https://unpkg.com/@highlightjs/cdn-assets@11.8.0/languages/go.min.js"></script>
``` ```
##### ES6 Modules <!-- omit in toc --> ##### ES6 Modules <!-- omit in toc -->
```html ```html
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/default.min.css"> <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.8.0/styles/default.min.css">
<script type="module"> <script type="module">
import hljs from 'https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/highlight.min.js'; import hljs from 'https://unpkg.com/@highlightjs/cdn-assets@11.8.0/es/highlight.min.js';
// and it's easy to individually load & register additional languages // and it's easy to individually load & register additional languages
import go from 'https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/languages/go.min.js'; import go from 'https://unpkg.com/@highlightjs/cdn-assets@11.8.0/es/languages/go.min.js';
hljs.registerLanguage('go', go); hljs.registerLanguage('go', go);
</script> </script>
``` ```
@ -440,7 +397,7 @@ hljs.registerLanguage('go', go);
**Note:** *The CDN-hosted `highlight.min.js` package doesn't bundle every language.* It would be **Note:** *The CDN-hosted `highlight.min.js` package doesn't bundle every language.* It would be
very large. You can find our list of "common" languages that we bundle by default on our [download page][5]. very large. You can find our list of "common" languages that we bundle by default on our [download page][5].
### Download prebuilt CDN assets #### Download prebuilt CDN assets
You can also download and self-host the same assets we serve up via our own CDNs. We publish those builds to the [cdn-release](https://github.com/highlightjs/cdn-release) GitHub repository. You can easily pull individual files off the CDN endpoints with `curl`, etc; if say you only needed `highlight.min.js` and a single CSS file. You can also download and self-host the same assets we serve up via our own CDNs. We publish those builds to the [cdn-release](https://github.com/highlightjs/cdn-release) GitHub repository. You can easily pull individual files off the CDN endpoints with `curl`, etc; if say you only needed `highlight.min.js` and a single CSS file.
@ -463,14 +420,6 @@ npm install highlight.js
yarn add highlight.js yarn add highlight.js
``` ```
There is also another npm package [@highlightjs/cdn-assets](https://www.npmjs.com/package/@highlightjs/cdn-assets) that contains prebuilt CDN assets including [ES6 Modules that can be imported in browser](#browser-es6-modules):
```bash
npm install @highlightjs/cdn-assets
# or
yarn add @highlightjs/cdn-assets
```
Alternatively, you can build the NPM package from source. Alternatively, you can build the NPM package from source.

View File

@ -29,7 +29,6 @@ The table below shows the full list of languages (and corresponding classes/alia
| AutoHotkey | autohotkey | | | AutoHotkey | autohotkey | |
| AutoIt | autoit | | | AutoIt | autoit | |
| Awk | awk, mawk, nawk, gawk | | | Awk | awk, mawk, nawk, gawk | |
| Ballerina | ballerina, bal | [highlightjs-ballerina](https://github.com/highlightjs/highlightjs-ballerina) |
| Bash | bash, sh, zsh | | | Bash | bash, sh, zsh | |
| Basic | basic | | | Basic | basic | |
| BBCode | bbcode | [highlightjs-bbcode](https://github.com/RedGuy12/highlightjs-bbcode) | | BBCode | bbcode | [highlightjs-bbcode](https://github.com/RedGuy12/highlightjs-bbcode) |
@ -45,8 +44,7 @@ The table below shows the full list of languages (and corresponding classes/alia
| Cache Object Script | cos, cls | | | Cache Object Script | cos, cls | |
| Candid | candid, did | [highlightjs-motoko](https://github.com/rvanasa/highlightjs-motoko) | | Candid | candid, did | [highlightjs-motoko](https://github.com/rvanasa/highlightjs-motoko) |
| CMake | cmake, cmake.in | | | CMake | cmake, cmake.in | |
| COBOL | cobol, standard-cobol | [highlightjs-cobol](https://github.com/otterkit/highlightjs-cobol) | | COBOL | cobol, standard-cobol | [highlightjs-cobol](https://github.com/otterkit/highlightjs-cobol) |
| CODEOWNERS | codeowners | [highlightjs-codeowners](https://github.com/highlightjs/highlightjs-codeowners) |
| Coq | coq | | | Coq | coq | |
| CSP | csp | | | CSP | csp | |
| CSS | css | | | CSS | css | |
@ -80,7 +78,7 @@ The table below shows the full list of languages (and corresponding classes/alia
| Erlang | erlang, erl | | | Erlang | erlang, erl | |
| Excel | excel, xls, xlsx | | | Excel | excel, xls, xlsx | |
| Extempore | extempore, xtlang, xtm | [highlightjs-xtlang](https://github.com/highlightjs/highlightjs-xtlang) | | Extempore | extempore, xtlang, xtm | [highlightjs-xtlang](https://github.com/highlightjs/highlightjs-xtlang) |
| F# | fsharp, fs, fsx, fsi, fsscript | | | F# | fsharp, fs | |
| FIX | fix | | | FIX | fix | |
| Flix | flix | [highlightjs-flix](https://github.com/flix/highlightjs-flix) | | Flix | flix | [highlightjs-flix](https://github.com/flix/highlightjs-flix) |
| Fortran | fortran, f90, f95 | | | Fortran | fortran, f90, f95 | |
@ -96,7 +94,7 @@ The table below shows the full list of languages (and corresponding classes/alia
| Grammatical Framework | gf | [highlightjs-gf](https://github.com/johnjcamilleri/highlightjs-gf) | | Grammatical Framework | gf | [highlightjs-gf](https://github.com/johnjcamilleri/highlightjs-gf) |
| Golo | golo, gololang | | | Golo | golo, gololang | |
| Gradle | gradle | | | Gradle | gradle | |
| GraphQL | graphql, gql | | | GraphQL | graphql | |
| Groovy | groovy | | | Groovy | groovy | |
| GSQL | gsql | [highlightjs-gsql](https://github.com/DanBarkus/highlightjs-gsql) | | GSQL | gsql | [highlightjs-gsql](https://github.com/DanBarkus/highlightjs-gsql) |
| HTML, XML | xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist, svg | | | HTML, XML | xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist, svg | |
@ -110,14 +108,11 @@ The table below shows the full list of languages (and corresponding classes/alia
| Ini, TOML | ini, toml | | | Ini, TOML | ini, toml | |
| Inform7 | inform7, i7 | | | Inform7 | inform7, i7 | |
| IRPF90 | irpf90 | | | IRPF90 | irpf90 | |
| Iptables | iptables | [highlightjs-iptables](https://github.com/highlightjs/highlightjs-iptables) | | JSON | json | |
| JSON | json, jsonc | |
| JSONata | jsonata | [highlightjs-jsonata](https://github.com/DevDimov/highlightjs-jsonata) |
| Java | java, jsp | | | Java | java, jsp | |
| JavaScript | javascript, js, jsx | | | JavaScript | javascript, js, jsx | |
| Jolie | jolie, iol, ol | [highlightjs-jolie](https://github.com/xiroV/highlightjs-jolie) | | Jolie | jolie, iol, ol | [highlightjs-jolie](https://github.com/xiroV/highlightjs-jolie) |
| Julia | julia, jl | | | Julia | julia, julia-repl | |
| Julia REPL | julia-repl | |
| Kotlin | kotlin, kt | | | Kotlin | kotlin, kt | |
| Lang | | [highlightjs-lang](https://github.com/highlightjs/highlightjs-lang) | Lang | | [highlightjs-lang](https://github.com/highlightjs/highlightjs-lang)
| LaTeX | tex | | | LaTeX | tex | |
@ -126,13 +121,11 @@ The table below shows the full list of languages (and corresponding classes/alia
| Lasso | lasso, ls, lassoscript | | | Lasso | lasso, ls, lassoscript | |
| Less | less | | | Less | less | |
| LDIF | ldif | | | LDIF | ldif | |
| Liquid | liquid | [highlightjs-liquid](https://github.com/highlightjs/highlightjs-liquid) |
| Lisp | lisp | | | Lisp | lisp | |
| LiveCode Server | livecodeserver | | | LiveCode Server | livecodeserver | |
| LiveScript | livescript, ls | | | LiveScript | livescript, ls | |
| LookML | lookml | [highlightjs-lookml](https://github.com/spectacles-ci/highlightjs-lookml) | | LookML | lookml | [highlightjs-lookml](https://github.com/spectacles-ci/highlightjs-lookml) |
| Lua | lua, pluto | | | Lua | lua | |
| Luau | luau | [highlightjs-luau](https://github.com/highlightjs/highlightjs-luau) |
| Macaulay2 | macaulay2 | [highlightjs-macaulay2](https://github.com/d-torrance/highlightjs-macaulay2) | | Macaulay2 | macaulay2 | [highlightjs-macaulay2](https://github.com/d-torrance/highlightjs-macaulay2) |
| Makefile | makefile, mk, mak, make | | | Makefile | makefile, mk, mak, make | |
| Markdown | markdown, md, mkdown, mkd | | | Markdown | markdown, md, mkdown, mkd | |
@ -141,10 +134,8 @@ The table below shows the full list of languages (and corresponding classes/alia
| Maxima | maxima | | | Maxima | maxima | |
| Maya Embedded Language | mel | | | Maya Embedded Language | mel | |
| Mercury | mercury | | | Mercury | mercury | |
| MetaPost | metapost | [highlightjs-metapost](https://github.com/chupinmaxime/highlightjs-metapost) | |
| MIPS Assembler | mips, mipsasm | | | MIPS Assembler | mips, mipsasm | |
| Mint | mint | [highlightjs-mint](https://github.com/mint-lang/highlightjs-mint) | | Mint | mint | [highlightjs-mint](https://github.com/mint-lang/highlightjs-mint) |
| Mirth | mirth | [highlightjs-mirth](https://github.com/highlightjs/highlightjs-mirth) |
| mIRC Scripting Language | mirc, mrc | [highlightjs-mirc](https://github.com/highlightjs/highlightjs-mirc) | | mIRC Scripting Language | mirc, mrc | [highlightjs-mirc](https://github.com/highlightjs/highlightjs-mirc) |
| Mizar | mizar | | | Mizar | mizar | |
| MKB | mkb | [highlightjs-mkb](https://github.com/Dereavy/highlightjs-mkb) | | MKB | mkb | [highlightjs-mkb](https://github.com/Dereavy/highlightjs-mkb) |
@ -163,7 +154,6 @@ The table below shows the full list of languages (and corresponding classes/alia
| Object Constraint Language | ocl | [highlightjs-ocl](https://github.com/nhomble/highlightjs-ocl) | | Object Constraint Language | ocl | [highlightjs-ocl](https://github.com/nhomble/highlightjs-ocl) |
| OCaml | ocaml, ml | | | OCaml | ocaml, ml | |
| Objective C | objectivec, mm, objc, obj-c, obj-c++, objective-c++ | | | Objective C | objectivec, mm, objc, obj-c, obj-c++, objective-c++ | |
| Odin | odin | [highlightjs-odin](https://github.com/NinjasCL/highlightjs-odin) |
| OpenGL Shading Language | glsl | | | OpenGL Shading Language | glsl | |
| OpenSCAD | openscad, scad | | | OpenSCAD | openscad, scad | |
| Oracle Rules Language | ruleslanguage | | | Oracle Rules Language | ruleslanguage | |
@ -173,12 +163,10 @@ The table below shows the full list of languages (and corresponding classes/alia
| Papyrus | papyrus, psc |[highlightjs-papyrus](https://github.com/Pickysaurus/highlightjs-papyrus) | | Papyrus | papyrus, psc |[highlightjs-papyrus](https://github.com/Pickysaurus/highlightjs-papyrus) |
| Parser3 | parser3 | | | Parser3 | parser3 | |
| Perl | perl, pl, pm | | | Perl | perl, pl, pm | |
| Phix | phix | [highlightjs-phix](https://github.com/highlightjs/highlightjs-phix) |
| Pine Script | pine, pinescript | [highlightjs-pine](https://github.com/jeyllani/highlightjs-pine) | | Pine Script | pine, pinescript | [highlightjs-pine](https://github.com/jeyllani/highlightjs-pine) |
| Plaintext | plaintext, txt, text | | | Plaintext | plaintext, txt, text | |
| Pony | pony | | | Pony | pony | |
| PostgreSQL & PL/pgSQL | pgsql, postgres, postgresql | | | PostgreSQL & PL/pgSQL | pgsql, postgres, postgresql | |
| PowerOn | poweron, po | [highlightjs-poweron](https://github.com/libum-llc/highlightjs-poweron) |
| PowerShell | powershell, ps, ps1 | | | PowerShell | powershell, ps, ps1 | |
| Processing | processing | | | Processing | processing | |
| Prolog | prolog | | | Prolog | prolog | |
@ -192,18 +180,12 @@ The table below shows the full list of languages (and corresponding classes/alia
| Q | k, kdb | | | Q | k, kdb | |
| QML | qml | | | QML | qml | |
| R | r | | | R | r | |
| Raku | raku, perl6, p6, pm6, rakumod | [highlightjs-raku](https://github.com/highlightjs/highlightjs-raku) |
| RakuDoc | pod6, rakudoc | [highlightjs-raku](https://github.com/highlightjs/highlightjs-raku) |
| RakuQuoting | rakuquoting | [highlightjs-raku](https://github.com/highlightjs/highlightjs-raku) |
| RakuRegexe | rakuregexe | [highlightjs-raku](https://github.com/highlightjs/highlightjs-raku) |
| Razor CSHTML | cshtml, razor, razor-cshtml | [highlightjs-cshtml-razor](https://github.com/highlightjs/highlightjs-cshtml-razor) | | Razor CSHTML | cshtml, razor, razor-cshtml | [highlightjs-cshtml-razor](https://github.com/highlightjs/highlightjs-cshtml-razor) |
| ReasonML | reasonml, re | | | ReasonML | reasonml, re | |
| Rebol & Red | redbol, rebol, red, red-system | [highlightjs-redbol](https://github.com/oldes/highlightjs-redbol) | | Rebol & Red | redbol, rebol, red, red-system | [highlightjs-redbol](https://github.com/oldes/highlightjs-redbol) |
| RenderMan RIB | rib | | | RenderMan RIB | rib | |
| RenderMan RSL | rsl | | | RenderMan RSL | rsl | |
| ReScript | rescript, res | [highlightjs-rescript](https://github.com/tsnobip/highlightjs-rescript) |
| RiScript | risc, riscript | [highlightjs-riscript](https://github.com/highlightjs/highlightjs-riscript) | | RiScript | risc, riscript | [highlightjs-riscript](https://github.com/highlightjs/highlightjs-riscript) |
| RISC-V Assembly | riscv, riscvasm | [highlightjs-riscvasm](https://github.com/highlightjs/highlightjs-riscvasm) |
| Roboconf | graph, instances | | | Roboconf | graph, instances | |
| Robot Framework | robot, rf | [highlightjs-robot](https://github.com/highlightjs/highlightjs-robot) | | Robot Framework | robot, rf | [highlightjs-robot](https://github.com/highlightjs/highlightjs-robot) |
| RPM spec files | rpm-specfile, rpm, spec, rpm-spec, specfile | [highlightjs-rpm-specfile](https://github.com/highlightjs/highlightjs-rpm-specfile) | | RPM spec files | rpm-specfile, rpm, spec, rpm-spec, specfile | [highlightjs-rpm-specfile](https://github.com/highlightjs/highlightjs-rpm-specfile) |
@ -231,7 +213,7 @@ The table below shows the full list of languages (and corresponding classes/alia
| Stylus | stylus, styl | | | Stylus | stylus, styl | |
| SubUnit | subunit | | | SubUnit | subunit | |
| Supercollider | supercollider, sc | [highlightjs-supercollider](https://github.com/highlightjs/highlightjs-supercollider) | | Supercollider | supercollider, sc | [highlightjs-supercollider](https://github.com/highlightjs/highlightjs-supercollider) |
| Svelte | svelte | [highlight.svelte](https://github.com/moonlitgrace/highlight.svelte) | | Svelte | svelte | [highlightjs-svelte](https://github.com/AlexxNB/highlightjs-svelte) |
| Swift | swift | | | Swift | swift | |
| Tcl | tcl, tk | | | Tcl | tcl, tk | |
| Terraform (HCL) | terraform, tf, hcl | [highlightjs-terraform](https://github.com/highlightjs/highlightjs-terraform) | | Terraform (HCL) | terraform, tf, hcl | [highlightjs-terraform](https://github.com/highlightjs/highlightjs-terraform) |
@ -240,11 +222,9 @@ The table below shows the full list of languages (and corresponding classes/alia
| Toit | toit | [toit-highlight](https://github.com/snxx-lppxx/toit-highlight) | | Toit | toit | [toit-highlight](https://github.com/snxx-lppxx/toit-highlight) |
| TP | tp | | | TP | tp | |
| Transact-SQL | tsql | [highlightjs-tsql](https://github.com/highlightjs/highlightjs-tsql) | | Transact-SQL | tsql | [highlightjs-tsql](https://github.com/highlightjs/highlightjs-tsql) |
| TTCN-3 | ttcn, ttcnpp, ttcn3 | [highlightjs-ttcn3](https://gitea.osmocom.org/ttcn3/highlightjs-ttcn3) |
| Twig | twig, craftcms | | | Twig | twig, craftcms | |
| TypeScript | typescript, ts, tsx, mts, cts | | | TypeScript | typescript, ts, tsx, mts, cts | |
| Unicorn Rails log | unicorn-rails-log | [highlightjs-unicorn-rails-log](https://github.com/sweetppro/highlightjs-unicorn-rails-log) | | Unicorn Rails log | unicorn-rails-log | [highlightjs-unicorn-rails-log](https://github.com/sweetppro/highlightjs-unicorn-rails-log) |
| Unison | unison, u | [highlightjs-unison](https://github.com/highlightjs/highlightjs-unison) |
| VB.Net | vbnet, vb | | | VB.Net | vbnet, vb | |
| VBA | vba | [highlightjs-vba](https://github.com/dullin/highlightjs-vba) | | VBA | vba | [highlightjs-vba](https://github.com/dullin/highlightjs-vba) |
| VBScript | vbscript, vbs | | | VBScript | vbscript, vbs | |
@ -252,17 +232,14 @@ The table below shows the full list of languages (and corresponding classes/alia
| Vala | vala | | | Vala | vala | |
| Verilog | verilog, v | | | Verilog | verilog, v | |
| Vim Script | vim | | | Vim Script | vim | |
| WGSL | wgsl | [highlightjs-wgsl](https://github.com/highlightjs/highlightjs-wgsl) |
| X# | xsharp, xs, prg | [highlightjs-xsharp](https://github.com/InfomindsAg/highlightjs-xsharp) | | X# | xsharp, xs, prg | [highlightjs-xsharp](https://github.com/InfomindsAg/highlightjs-xsharp) |
| X++ | axapta, x++ | | | X++ | axapta, x++ | |
| x86 Assembly | x86asm | | | x86 Assembly | x86asm | |
| x86 Assembly (AT&T) | x86asmatt | [highlightjs-x86asmatt](https://github.com/gondow/highlightjs-x86asmatt) |
| XL | xl, tao | | | XL | xl, tao | |
| XQuery | xquery, xpath, xq, xqm | | | XQuery | xquery, xpath, xq | |
| YAML | yml, yaml | | | YAML | yml, yaml | |
| ZenScript | zenscript, zs |[highlightjs-zenscript](https://github.com/highlightjs/highlightjs-zenscript) | | ZenScript | zenscript, zs |[highlightjs-zenscript](https://github.com/highlightjs/highlightjs-zenscript) |
| Zephir | zephir, zep | | | Zephir | zephir, zep | |
| Zig | zig |[highlightjs-zig](https://github.com/fwx5618177/highlightjs-zig) |
<!-- LANGLIST_END --> <!-- LANGLIST_END -->
<!-- document it until we can fix it --> <!-- document it until we can fix it -->

View File

@ -443,12 +443,6 @@ function _1c(hljs) {
] ]
}; };
const PUNCTUATION = {
match: /[;()+\-:=,]/,
className: "punctuation",
relevance: 0
};
// comment : комментарии // comment : комментарии
const COMMENTS = hljs.inherit(hljs.C_LINE_COMMENT_MODE); const COMMENTS = hljs.inherit(hljs.C_LINE_COMMENT_MODE);
@ -535,8 +529,7 @@ function _1c(hljs) {
SYMBOL, SYMBOL,
NUMBERS, NUMBERS,
STRINGS, STRINGS,
DATE, DATE
PUNCTUATION
] ]
}; };
} }

View File

@ -2,7 +2,6 @@
Language: Augmented Backus-Naur Form Language: Augmented Backus-Naur Form
Author: Alex McKibben <alex@nullscope.net> Author: Alex McKibben <alex@nullscope.net>
Website: https://tools.ietf.org/html/rfc5234 Website: https://tools.ietf.org/html/rfc5234
Category: syntax
Audit: 2020 Audit: 2020
*/ */

View File

@ -73,10 +73,6 @@ function apache(hljs) {
relevance: 0, relevance: 0,
keywords: { literal: 'on off all deny allow' }, keywords: { literal: 'on off all deny allow' },
contains: [ contains: [
{
scope: "punctuation",
match: /\\\n/
},
{ {
className: 'meta', className: 'meta',
begin: /\s\[/, begin: /\s\[/,

View File

@ -1,51 +1,41 @@
/* /*
Language: ArcGIS Arcade Language: ArcGIS Arcade
Category: scripting Category: scripting
Author: John Foster <jfoster@esri.com>
Website: https://developers.arcgis.com/arcade/ Website: https://developers.arcgis.com/arcade/
Description: ArcGIS Arcade is an expression language used in many Esri ArcGIS products such as Pro, Online, Server, Runtime, JavaScript, and Python Description: ArcGIS Arcade is an expression language used in many Esri ArcGIS products such as Pro, Online, Server, Runtime, JavaScript, and Python
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function arcade(hljs) { function arcade(hljs) {
const regex = hljs.regex;
const IDENT_RE = '[A-Za-z_][0-9A-Za-z_]*'; const IDENT_RE = '[A-Za-z_][0-9A-Za-z_]*';
const KEYWORDS = { const KEYWORDS = {
keyword: [ keyword: [
"break",
"case",
"catch",
"continue",
"debugger",
"do",
"else",
"export",
"for",
"function",
"if", "if",
"import", "for",
"in", "while",
"new",
"of",
"return",
"switch",
"try",
"var", "var",
"new",
"function",
"do",
"return",
"void", "void",
"while" "else",
"break"
], ],
literal: [ literal: [
"BackSlash", "BackSlash",
"DoubleQuote", "DoubleQuote",
"false",
"ForwardSlash", "ForwardSlash",
"Infinity", "Infinity",
"NaN", "NaN",
"NewLine", "NewLine",
"null",
"PI", "PI",
"SingleQuote", "SingleQuote",
"Tab", "Tab",
"TextFormatting", "TextFormatting",
"false",
"null",
"true", "true",
"undefined" "undefined"
], ],
@ -70,22 +60,19 @@ function arcade(hljs) {
"BufferGeodetic", "BufferGeodetic",
"Ceil", "Ceil",
"Centroid", "Centroid",
"ChangeTimeZone",
"Clip", "Clip",
"Concatenate", "Concatenate",
"Console", "Console",
"Constrain", "Constrain",
"Contains", "Contains",
"ConvertDirection", "ConvertDirection",
"ConvexHull",
"Cos", "Cos",
"Count", "Count",
"Crosses", "Crosses",
"Cut", "Cut",
"Date|0", "Date",
"DateAdd", "DateAdd",
"DateDiff", "DateDiff",
"DateOnly",
"Day", "Day",
"Decode", "Decode",
"DefaultValue", "DefaultValue",
@ -96,7 +83,6 @@ function arcade(hljs) {
"Disjoint", "Disjoint",
"Distance", "Distance",
"DistanceGeodetic", "DistanceGeodetic",
"DistanceToCoordinate",
"Distinct", "Distinct",
"Domain", "Domain",
"DomainCode", "DomainCode",
@ -108,41 +94,30 @@ function arcade(hljs) {
"Expects", "Expects",
"Extent", "Extent",
"Feature", "Feature",
"FeatureInFilter",
"FeatureSet", "FeatureSet",
"FeatureSetByAssociation", "FeatureSetByAssociation",
"FeatureSetById", "FeatureSetById",
"FeatureSetByName", "FeatureSetByName",
"FeatureSetByPortalItem", "FeatureSetByPortalItem",
"FeatureSetByRelationshipClass",
"FeatureSetByRelationshipName", "FeatureSetByRelationshipName",
"Filter", "Filter",
"FilterBySubtypeCode",
"Find", "Find",
"First|0", "First",
"Floor", "Floor",
"FromCharCode", "FromCharCode",
"FromCodePoint", "FromCodePoint",
"FromJSON", "FromJSON",
"Front",
"GdbVersion", "GdbVersion",
"Generalize", "Generalize",
"Geometry", "Geometry",
"GetEnvironment",
"GetFeatureSet", "GetFeatureSet",
"GetFeatureSetInfo",
"GetUser", "GetUser",
"GroupBy", "GroupBy",
"Guid", "Guid",
"HasKey",
"HasValue",
"Hash", "Hash",
"HasKey",
"Hour", "Hour",
"IIf", "IIf",
"ISOMonth",
"ISOWeek",
"ISOWeekday",
"ISOYear",
"Includes", "Includes",
"IndexOf", "IndexOf",
"Insert", "Insert",
@ -150,9 +125,12 @@ function arcade(hljs) {
"Intersects", "Intersects",
"IsEmpty", "IsEmpty",
"IsNan", "IsNan",
"ISOMonth",
"ISOWeek",
"ISOWeekday",
"ISOYear",
"IsSelfIntersecting", "IsSelfIntersecting",
"IsSimple", "IsSimple",
"KnowledgeGraphByPortalItem",
"Left|0", "Left|0",
"Length", "Length",
"Length3D", "Length3D",
@ -162,7 +140,6 @@ function arcade(hljs) {
"Map", "Map",
"Max", "Max",
"Mean", "Mean",
"MeasureToCoordinate",
"Mid", "Mid",
"Millisecond", "Millisecond",
"Min", "Min",
@ -170,17 +147,14 @@ function arcade(hljs) {
"Month", "Month",
"MultiPartToSinglePart", "MultiPartToSinglePart",
"Multipoint", "Multipoint",
"NearestCoordinate",
"NearestVertex",
"NextSequenceValue", "NextSequenceValue",
"None", "None",
"Now", "Now",
"Number", "Number",
"Offset", "Offset|0",
"OrderBy", "OrderBy",
"Overlaps", "Overlaps",
"Point", "Point",
"PointToCoordinate",
"Polygon", "Polygon",
"Polyline", "Polyline",
"Pop", "Pop",
@ -188,7 +162,6 @@ function arcade(hljs) {
"Pow", "Pow",
"Proper", "Proper",
"Push", "Push",
"QueryGraph",
"Random", "Random",
"Reduce", "Reduce",
"Relate", "Relate",
@ -209,8 +182,6 @@ function arcade(hljs) {
"Splice", "Splice",
"Split", "Split",
"Sqrt", "Sqrt",
"StandardizeFilename",
"StandardizeGuid",
"Stdev", "Stdev",
"SubtypeCode", "SubtypeCode",
"SubtypeName", "SubtypeName",
@ -219,18 +190,15 @@ function arcade(hljs) {
"SymmetricDifference", "SymmetricDifference",
"Tan", "Tan",
"Text", "Text",
"Time",
"TimeZone",
"TimeZoneOffset",
"Timestamp", "Timestamp",
"ToCharCode", "ToCharCode",
"ToCodePoint", "ToCodePoint",
"Today",
"ToHex", "ToHex",
"ToLocal", "ToLocal",
"ToUTC",
"Today",
"Top|0", "Top|0",
"Touches", "Touches",
"ToUTC",
"TrackAccelerationAt", "TrackAccelerationAt",
"TrackAccelerationWindow", "TrackAccelerationWindow",
"TrackCurrentAcceleration", "TrackCurrentAcceleration",
@ -255,49 +223,14 @@ function arcade(hljs) {
"Variance", "Variance",
"Week", "Week",
"Weekday", "Weekday",
"When|0", "When",
"Within", "Within",
"Year|0", "Year"
] ]
}; };
const PROFILE_VARS = [
"aggregatedFeatures",
"analytic",
"config",
"datapoint",
"datastore",
"editcontext",
"feature",
"featureSet",
"feedfeature",
"fencefeature",
"fencenotificationtype",
"graph",
"join",
"layer",
"locationupdate",
"map",
"measure",
"measure",
"originalFeature",
"record",
"reference",
"rowindex",
"sourcedatastore",
"sourcefeature",
"sourcelayer",
"target",
"targetdatastore",
"targetfeature",
"targetlayer",
"userInput",
"value",
"variables",
"view"
];
const SYMBOL = { const SYMBOL = {
className: 'symbol', className: 'symbol',
begin: '\\$' + regex.either(...PROFILE_VARS) begin: '\\$[datastore|feature|layer|map|measure|sourcefeature|sourcelayer|targetfeature|targetlayer|value|view]+'
}; };
const NUMBER = { const NUMBER = {
className: 'number', className: 'number',

View File

@ -52,44 +52,9 @@ function cPlusPlus(hljs) {
const NUMBERS = { const NUMBERS = {
className: 'number', className: 'number',
variants: [ variants: [
// Floating-point literal. { begin: '\\b(0b[01\']+)' },
{ begin: { begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)' },
"[+-]?(?:" // Leading sign. { begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
// Decimal.
+ "(?:"
+"[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?"
+ "|\\.[0-9](?:'?[0-9])*"
+ ")(?:[Ee][+-]?[0-9](?:'?[0-9])*)?"
+ "|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*"
// Hexadecimal.
+ "|0[Xx](?:"
+"[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?"
+ "|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*"
+ ")[Pp][+-]?[0-9](?:'?[0-9])*"
+ ")(?:" // Literal suffixes.
+ "[Ff](?:16|32|64|128)?"
+ "|(BF|bf)16"
+ "|[Ll]"
+ "|" // Literal suffix is optional.
+ ")"
},
// Integer literal.
{ begin:
"[+-]?\\b(?:" // Leading sign.
+ "0[Bb][01](?:'?[01])*" // Binary.
+ "|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*" // Hexadecimal.
+ "|0(?:'?[0-7])*" // Octal or just a lone zero.
+ "|[1-9](?:'?[0-9])*" // Decimal.
+ ")(?:" // Literal suffixes.
+ "[Uu](?:LL?|ll?)"
+ "|[Uu][Zz]?"
+ "|(?:LL?|ll?)[Uu]?"
+ "|[Zz][Uu]"
+ "|" // Literal suffix is optional.
+ ")"
// Note: there are user-defined literal suffixes too, but perhaps having the custom suffix not part of the
// literal highlight actually makes it stand out more.
}
], ],
relevance: 0 relevance: 0
}; };
@ -247,8 +212,6 @@ function cPlusPlus(hljs) {
'counting_semaphore', 'counting_semaphore',
'deque', 'deque',
'false_type', 'false_type',
'flat_map',
'flat_set',
'future', 'future',
'imaginary', 'imaginary',
'initializer_list', 'initializer_list',
@ -574,7 +537,7 @@ function cPlusPlus(hljs) {
[ [
PREPROCESSOR, PREPROCESSOR,
{ // containers: ie, `vector <int> rooms (9);` { // containers: ie, `vector <int> rooms (9);`
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)', begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function)\\s*<(?!<)',
end: '>', end: '>',
keywords: CPP_KEYWORDS, keywords: CPP_KEYWORDS,
contains: [ contains: [
@ -607,10 +570,8 @@ Language: Arduino
Author: Stefania Mellai <s.mellai@arduino.cc> Author: Stefania Mellai <s.mellai@arduino.cc>
Description: The Arduino® Language is a superset of C++. This rules are designed to highlight the Arduino® source code. For info about language see http://www.arduino.cc. Description: The Arduino® Language is a superset of C++. This rules are designed to highlight the Arduino® source code. For info about language see http://www.arduino.cc.
Website: https://www.arduino.cc Website: https://www.arduino.cc
Category: system
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function arduino(hljs) { function arduino(hljs) {
const ARDUINO_KW = { const ARDUINO_KW = {

View File

@ -32,10 +32,6 @@ function armasm(hljs) {
+ 'ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ', + 'ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ',
built_in: built_in:
'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 ' // standard registers 'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 ' // standard registers
+ 'w0 w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 ' // 32 bit ARMv8 registers
+ 'w16 w17 w18 w19 w20 w21 w22 w23 w24 w25 w26 w27 w28 w29 w30 '
+ 'x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 ' // 64 bit ARMv8 registers
+ 'x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 '
+ 'pc lr sp ip sl sb fp ' // typical regs plus backward compatibility + 'pc lr sp ip sl sb fp ' // typical regs plus backward compatibility
+ 'a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 ' // more regs and fp + 'a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 ' // more regs and fp
+ 'p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 ' // coprocessor regs + 'p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 ' // coprocessor regs

View File

@ -3,7 +3,6 @@ Language: AspectJ
Author: Hakan Ozler <ozler.hakan@gmail.com> Author: Hakan Ozler <ozler.hakan@gmail.com>
Website: https://www.eclipse.org/aspectj/ Website: https://www.eclipse.org/aspectj/
Description: Syntax Highlighting for the AspectJ Language which is a general-purpose aspect-oriented extension to the Java programming language. Description: Syntax Highlighting for the AspectJ Language which is a general-purpose aspect-oriented extension to the Java programming language.
Category: system
Audit: 2020 Audit: 2020
*/ */

View File

@ -3,7 +3,6 @@ Language: Awk
Author: Matthew Daly <matthewbdaly@gmail.com> Author: Matthew Daly <matthewbdaly@gmail.com>
Website: https://www.gnu.org/software/gawk/manual/gawk.html Website: https://www.gnu.org/software/gawk/manual/gawk.html
Description: language definition for Awk scripts Description: language definition for Awk scripts
Category: scripting
*/ */
/** @type LanguageFn */ /** @type LanguageFn */

View File

@ -3,7 +3,7 @@ Language: Bash
Author: vah <vahtenberg@gmail.com> Author: vah <vahtenberg@gmail.com>
Contributrors: Benjamin Pannell <contact@sierrasoftworks.com> Contributrors: Benjamin Pannell <contact@sierrasoftworks.com>
Website: https://www.gnu.org/software/bash/ Website: https://www.gnu.org/software/bash/
Category: common, scripting Category: common
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
@ -38,18 +38,6 @@ function bash(hljs) {
end: /\)/, end: /\)/,
contains: [ hljs.BACKSLASH_ESCAPE ] contains: [ hljs.BACKSLASH_ESCAPE ]
}; };
const COMMENT = hljs.inherit(
hljs.COMMENT(),
{
match: [
/(^|\s)/,
/#.*$/
],
scope: {
2: 'comment'
}
}
);
const HERE_DOC = { const HERE_DOC = {
begin: /<<-?\s*(?=\w+)/, begin: /<<-?\s*(?=\w+)/,
starts: { contains: [ starts: { contains: [
@ -72,16 +60,15 @@ function bash(hljs) {
}; };
SUBST.contains.push(QUOTE_STRING); SUBST.contains.push(QUOTE_STRING);
const ESCAPED_QUOTE = { const ESCAPED_QUOTE = {
match: /\\"/ className: '',
begin: /\\"/
}; };
const APOS_STRING = { const APOS_STRING = {
className: 'string', className: 'string',
begin: /'/, begin: /'/,
end: /'/ end: /'/
}; };
const ESCAPED_APOS = {
match: /\\'/
};
const ARITHMETIC = { const ARITHMETIC = {
begin: /\$?\(\(/, begin: /\$?\(\(/,
end: /\)\)/, end: /\)\)/,
@ -123,7 +110,6 @@ function bash(hljs) {
"else", "else",
"elif", "elif",
"fi", "fi",
"time",
"for", "for",
"while", "while",
"until", "until",
@ -132,7 +118,6 @@ function bash(hljs) {
"done", "done",
"case", "case",
"esac", "esac",
"coproc",
"function", "function",
"select" "select"
]; ];
@ -185,7 +170,6 @@ function bash(hljs) {
"read", "read",
"readarray", "readarray",
"source", "source",
"sudo",
"type", "type",
"typeset", "typeset",
"ulimit", "ulimit",
@ -371,10 +355,7 @@ function bash(hljs) {
return { return {
name: 'Bash', name: 'Bash',
aliases: [ aliases: [ 'sh' ],
'sh',
'zsh'
],
keywords: { keywords: {
$pattern: /\b[a-z][a-z0-9._-]+\b/, $pattern: /\b[a-z][a-z0-9._-]+\b/,
keyword: KEYWORDS, keyword: KEYWORDS,
@ -394,13 +375,12 @@ function bash(hljs) {
hljs.SHEBANG(), // to catch unknown shells but still highlight the shebang hljs.SHEBANG(), // to catch unknown shells but still highlight the shebang
FUNCTION, FUNCTION,
ARITHMETIC, ARITHMETIC,
COMMENT, hljs.HASH_COMMENT_MODE,
HERE_DOC, HERE_DOC,
PATH_MODE, PATH_MODE,
QUOTE_STRING, QUOTE_STRING,
ESCAPED_QUOTE, ESCAPED_QUOTE,
APOS_STRING, APOS_STRING,
ESCAPED_APOS,
VAR VAR
] ]
}; };

View File

@ -3,7 +3,6 @@ Language: BASIC
Author: Raphaël Assénat <raph@raphnet.net> Author: Raphaël Assénat <raph@raphnet.net>
Description: Based on the BASIC reference from the Tandy 1000 guide Description: Based on the BASIC reference from the Tandy 1000 guide
Website: https://en.wikipedia.org/wiki/Tandy_1000 Website: https://en.wikipedia.org/wiki/Tandy_1000
Category: system
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
@ -198,13 +197,7 @@ function basic(hljs) {
keyword: KEYWORDS keyword: KEYWORDS
}, },
contains: [ contains: [
{ hljs.QUOTE_STRING_MODE,
// Match strings that start with " and end with " or a line break
scope: 'string',
begin: /"/,
end: /"|$/,
contains: [ hljs.BACKSLASH_ESCAPE ]
},
hljs.COMMENT('REM', '$', { relevance: 10 }), hljs.COMMENT('REM', '$', { relevance: 10 }),
hljs.COMMENT('\'', '$', { relevance: 0 }), hljs.COMMENT('\'', '$', { relevance: 0 }),
{ {

View File

@ -1,7 +1,6 @@
/* /*
Language: BackusNaur Form Language: BackusNaur Form
Website: https://en.wikipedia.org/wiki/BackusNaur_form Website: https://en.wikipedia.org/wiki/BackusNaur_form
Category: syntax
Author: Oleg Efimov <efimovov@gmail.com> Author: Oleg Efimov <efimovov@gmail.com>
*/ */

View File

@ -57,21 +57,20 @@ function c(hljs) {
const NUMBERS = { const NUMBERS = {
className: 'number', className: 'number',
variants: [ variants: [
{ match: /\b(0b[01']+)/ }, { begin: '\\b(0b[01\']+)' },
{ match: /(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/ }, { begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)' },
{ match: /(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/ }, { begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
{ match: /(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/ } ],
],
relevance: 0 relevance: 0
}; };
const PREPROCESSOR = { const PREPROCESSOR = {
className: 'meta', className: 'meta',
begin: /#\s*[a-z]+\b/, begin: /#\s*[a-z]+\b/,
end: /$/, end: /$/,
keywords: { keyword: keywords: { keyword:
'if else elif endif define undef warning error line ' 'if else elif endif define undef warning error line '
+ 'pragma _Pragma ifdef ifndef elifdef elifndef include' }, + 'pragma _Pragma ifdef ifndef include' },
contains: [ contains: [
{ {
begin: /\\\n/, begin: /\\\n/,
@ -115,8 +114,6 @@ function c(hljs) {
"restrict", "restrict",
"return", "return",
"sizeof", "sizeof",
"typeof",
"typeof_unqual",
"struct", "struct",
"switch", "switch",
"typedef", "typedef",
@ -151,26 +148,14 @@ function c(hljs) {
"char", "char",
"void", "void",
"_Bool", "_Bool",
"_BitInt",
"_Complex", "_Complex",
"_Imaginary", "_Imaginary",
"_Decimal32", "_Decimal32",
"_Decimal64", "_Decimal64",
"_Decimal96",
"_Decimal128", "_Decimal128",
"_Decimal64x",
"_Decimal128x",
"_Float16",
"_Float32",
"_Float64",
"_Float128",
"_Float32x",
"_Float64x",
"_Float128x",
// modifiers // modifiers
"const", "const",
"static", "static",
"constexpr",
// aliases // aliases
"complex", "complex",
"bool", "bool",

View File

@ -3,7 +3,6 @@ Language: C/AL
Author: Kenneth Fuglsang Christensen <kfuglsang@gmail.com> Author: Kenneth Fuglsang Christensen <kfuglsang@gmail.com>
Description: Provides highlighting of Microsoft Dynamics NAV C/AL code files Description: Provides highlighting of Microsoft Dynamics NAV C/AL code files
Website: https://docs.microsoft.com/en-us/dynamics-nav/programming-in-c-al Website: https://docs.microsoft.com/en-us/dynamics-nav/programming-in-c-al
Category: enterprise
*/ */
/** @type LanguageFn */ /** @type LanguageFn */

View File

@ -2,7 +2,6 @@
Language: Ceylon Language: Ceylon
Author: Lucas Werkmeister <mail@lucaswerkmeister.de> Author: Lucas Werkmeister <mail@lucaswerkmeister.de>
Website: https://ceylon-lang.org Website: https://ceylon-lang.org
Category: system
*/ */
/** @type LanguageFn */ /** @type LanguageFn */

View File

@ -3,7 +3,6 @@ Language: CMake
Description: CMake is an open-source cross-platform system for build automation. Description: CMake is an open-source cross-platform system for build automation.
Author: Igor Kalnitsky <igor@kalnitsky.org> Author: Igor Kalnitsky <igor@kalnitsky.org>
Website: https://cmake.org Website: https://cmake.org
Category: build-system
*/ */
/** @type LanguageFn */ /** @type LanguageFn */

View File

@ -39,9 +39,7 @@ const KEYWORDS = [
"import", "import",
"from", "from",
"export", "export",
"extends", "extends"
// It's reached stage 3, which is "recommended for implementation":
"using"
]; ];
const LITERALS = [ const LITERALS = [
"true", "true",
@ -153,7 +151,6 @@ Category: scripting
Website: https://coffeescript.org Website: https://coffeescript.org
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function coffeescript(hljs) { function coffeescript(hljs) {
const COFFEE_BUILT_INS = [ const COFFEE_BUILT_INS = [

View File

@ -52,44 +52,9 @@ function cpp(hljs) {
const NUMBERS = { const NUMBERS = {
className: 'number', className: 'number',
variants: [ variants: [
// Floating-point literal. { begin: '\\b(0b[01\']+)' },
{ begin: { begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)' },
"[+-]?(?:" // Leading sign. { begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
// Decimal.
+ "(?:"
+"[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?"
+ "|\\.[0-9](?:'?[0-9])*"
+ ")(?:[Ee][+-]?[0-9](?:'?[0-9])*)?"
+ "|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*"
// Hexadecimal.
+ "|0[Xx](?:"
+"[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?"
+ "|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*"
+ ")[Pp][+-]?[0-9](?:'?[0-9])*"
+ ")(?:" // Literal suffixes.
+ "[Ff](?:16|32|64|128)?"
+ "|(BF|bf)16"
+ "|[Ll]"
+ "|" // Literal suffix is optional.
+ ")"
},
// Integer literal.
{ begin:
"[+-]?\\b(?:" // Leading sign.
+ "0[Bb][01](?:'?[01])*" // Binary.
+ "|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*" // Hexadecimal.
+ "|0(?:'?[0-7])*" // Octal or just a lone zero.
+ "|[1-9](?:'?[0-9])*" // Decimal.
+ ")(?:" // Literal suffixes.
+ "[Uu](?:LL?|ll?)"
+ "|[Uu][Zz]?"
+ "|(?:LL?|ll?)[Uu]?"
+ "|[Zz][Uu]"
+ "|" // Literal suffix is optional.
+ ")"
// Note: there are user-defined literal suffixes too, but perhaps having the custom suffix not part of the
// literal highlight actually makes it stand out more.
}
], ],
relevance: 0 relevance: 0
}; };
@ -247,8 +212,6 @@ function cpp(hljs) {
'counting_semaphore', 'counting_semaphore',
'deque', 'deque',
'false_type', 'false_type',
'flat_map',
'flat_set',
'future', 'future',
'imaginary', 'imaginary',
'initializer_list', 'initializer_list',
@ -574,7 +537,7 @@ function cpp(hljs) {
[ [
PREPROCESSOR, PREPROCESSOR,
{ // containers: ie, `vector <int> rooms (9);` { // containers: ie, `vector <int> rooms (9);`
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)', begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function)\\s*<(?!<)',
end: '>', end: '>',
keywords: CPP_KEYWORDS, keywords: CPP_KEYWORDS,
contains: [ contains: [

View File

@ -2,7 +2,6 @@
Language: Crystal Language: Crystal
Author: TSUYUSATO Kitsune <make.just.on@gmail.com> Author: TSUYUSATO Kitsune <make.just.on@gmail.com>
Website: https://crystal-lang.org Website: https://crystal-lang.org
Category: system
*/ */
/** @type LanguageFn */ /** @type LanguageFn */

View File

@ -117,14 +117,11 @@ function csharp(hljs) {
'alias', 'alias',
'and', 'and',
'ascending', 'ascending',
'args',
'async', 'async',
'await', 'await',
'by', 'by',
'descending', 'descending',
'dynamic',
'equals', 'equals',
'file',
'from', 'from',
'get', 'get',
'global', 'global',
@ -140,10 +137,7 @@ function csharp(hljs) {
'or', 'or',
'orderby', 'orderby',
'partial', 'partial',
'record',
'remove', 'remove',
'required',
'scoped',
'select', 'select',
'set', 'set',
'unmanaged', 'unmanaged',
@ -170,11 +164,6 @@ function csharp(hljs) {
], ],
relevance: 0 relevance: 0
}; };
const RAW_STRING = {
className: 'string',
begin: /"""("*)(?!")(.|\n)*?"""\1/,
relevance: 1
};
const VERBATIM_STRING = { const VERBATIM_STRING = {
className: 'string', className: 'string',
begin: '@"', begin: '@"',
@ -240,7 +229,6 @@ function csharp(hljs) {
hljs.inherit(hljs.C_BLOCK_COMMENT_MODE, { illegal: /\n/ }) hljs.inherit(hljs.C_BLOCK_COMMENT_MODE, { illegal: /\n/ })
]; ];
const STRING = { variants: [ const STRING = { variants: [
RAW_STRING,
INTERPOLATED_VERBATIM_STRING, INTERPOLATED_VERBATIM_STRING,
INTERPOLATED_STRING, INTERPOLATED_STRING,
VERBATIM_STRING, VERBATIM_STRING,

View File

@ -3,7 +3,6 @@ Language: CSP
Description: Content Security Policy definition highlighting Description: Content Security Policy definition highlighting
Author: Taras <oxdef@oxdef.info> Author: Taras <oxdef@oxdef.info>
Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
Category: web
vim: ts=2 sw=2 st=2 vim: ts=2 sw=2 st=2
*/ */

View File

@ -38,12 +38,12 @@ const MODES = (hljs) => {
}, },
CSS_VARIABLE: { CSS_VARIABLE: {
className: "attr", className: "attr",
begin: /--[A-Za-z_][A-Za-z0-9_-]*/ begin: /--[A-Za-z][A-Za-z0-9_-]*/
} }
}; };
}; };
const HTML_TAGS = [ const TAGS = [
'a', 'a',
'abbr', 'abbr',
'address', 'address',
@ -95,16 +95,11 @@ const HTML_TAGS = [
'nav', 'nav',
'object', 'object',
'ol', 'ol',
'optgroup',
'option',
'p', 'p',
'picture',
'q', 'q',
'quote', 'quote',
'samp', 'samp',
'section', 'section',
'select',
'source',
'span', 'span',
'strong', 'strong',
'summary', 'summary',
@ -123,58 +118,6 @@ const HTML_TAGS = [
'video' 'video'
]; ];
const SVG_TAGS = [
'defs',
'g',
'marker',
'mask',
'pattern',
'svg',
'switch',
'symbol',
'feBlend',
'feColorMatrix',
'feComponentTransfer',
'feComposite',
'feConvolveMatrix',
'feDiffuseLighting',
'feDisplacementMap',
'feFlood',
'feGaussianBlur',
'feImage',
'feMerge',
'feMorphology',
'feOffset',
'feSpecularLighting',
'feTile',
'feTurbulence',
'linearGradient',
'radialGradient',
'stop',
'circle',
'ellipse',
'image',
'line',
'path',
'polygon',
'polyline',
'rect',
'text',
'use',
'textPath',
'tspan',
'foreignObject',
'clipPath'
];
const TAGS = [
...HTML_TAGS,
...SVG_TAGS,
];
// Sorting, then reversing makes sure longer attributes/elements like
// `font-weight` are matched fully instead of getting false positives on say `font`
const MEDIA_FEATURES = [ const MEDIA_FEATURES = [
'any-hover', 'any-hover',
'any-pointer', 'any-pointer',
@ -210,7 +153,7 @@ const MEDIA_FEATURES = [
'max-width', 'max-width',
'min-height', 'min-height',
'max-height' 'max-height'
].sort().reverse(); ];
// https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
const PSEUDO_CLASSES = [ const PSEUDO_CLASSES = [
@ -273,7 +216,7 @@ const PSEUDO_CLASSES = [
'valid', 'valid',
'visited', 'visited',
'where' // where() 'where' // where()
].sort().reverse(); ];
// https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements
const PSEUDO_ELEMENTS = [ const PSEUDO_ELEMENTS = [
@ -291,18 +234,14 @@ const PSEUDO_ELEMENTS = [
'selection', 'selection',
'slotted', 'slotted',
'spelling-error' 'spelling-error'
].sort().reverse(); ];
const ATTRIBUTES = [ const ATTRIBUTES = [
'accent-color',
'align-content', 'align-content',
'align-items', 'align-items',
'align-self', 'align-self',
'alignment-baseline',
'all', 'all',
'anchor-name',
'animation', 'animation',
'animation-composition',
'animation-delay', 'animation-delay',
'animation-direction', 'animation-direction',
'animation-duration', 'animation-duration',
@ -310,14 +249,7 @@ const ATTRIBUTES = [
'animation-iteration-count', 'animation-iteration-count',
'animation-name', 'animation-name',
'animation-play-state', 'animation-play-state',
'animation-range',
'animation-range-end',
'animation-range-start',
'animation-timeline',
'animation-timing-function', 'animation-timing-function',
'appearance',
'aspect-ratio',
'backdrop-filter',
'backface-visibility', 'backface-visibility',
'background', 'background',
'background-attachment', 'background-attachment',
@ -327,11 +259,8 @@ const ATTRIBUTES = [
'background-image', 'background-image',
'background-origin', 'background-origin',
'background-position', 'background-position',
'background-position-x',
'background-position-y',
'background-repeat', 'background-repeat',
'background-size', 'background-size',
'baseline-shift',
'block-size', 'block-size',
'border', 'border',
'border-block', 'border-block',
@ -354,8 +283,6 @@ const ATTRIBUTES = [
'border-bottom-width', 'border-bottom-width',
'border-collapse', 'border-collapse',
'border-color', 'border-color',
'border-end-end-radius',
'border-end-start-radius',
'border-image', 'border-image',
'border-image-outset', 'border-image-outset',
'border-image-repeat', 'border-image-repeat',
@ -384,8 +311,6 @@ const ATTRIBUTES = [
'border-right-style', 'border-right-style',
'border-right-width', 'border-right-width',
'border-spacing', 'border-spacing',
'border-start-end-radius',
'border-start-start-radius',
'border-style', 'border-style',
'border-top', 'border-top',
'border-top-color', 'border-top-color',
@ -395,15 +320,7 @@ const ATTRIBUTES = [
'border-top-width', 'border-top-width',
'border-width', 'border-width',
'bottom', 'bottom',
'box-align',
'box-decoration-break', 'box-decoration-break',
'box-direction',
'box-flex',
'box-flex-group',
'box-lines',
'box-ordinal-group',
'box-orient',
'box-pack',
'box-shadow', 'box-shadow',
'box-sizing', 'box-sizing',
'break-after', 'break-after',
@ -416,11 +333,6 @@ const ATTRIBUTES = [
'clip-path', 'clip-path',
'clip-rule', 'clip-rule',
'color', 'color',
'color-interpolation',
'color-interpolation-filters',
'color-profile',
'color-rendering',
'color-scheme',
'column-count', 'column-count',
'column-fill', 'column-fill',
'column-gap', 'column-gap',
@ -432,34 +344,17 @@ const ATTRIBUTES = [
'column-width', 'column-width',
'columns', 'columns',
'contain', 'contain',
'contain-intrinsic-block-size',
'contain-intrinsic-height',
'contain-intrinsic-inline-size',
'contain-intrinsic-size',
'contain-intrinsic-width',
'container',
'container-name',
'container-type',
'content', 'content',
'content-visibility', 'content-visibility',
'counter-increment', 'counter-increment',
'counter-reset', 'counter-reset',
'counter-set',
'cue', 'cue',
'cue-after', 'cue-after',
'cue-before', 'cue-before',
'cursor', 'cursor',
'cx',
'cy',
'direction', 'direction',
'display', 'display',
'dominant-baseline',
'empty-cells', 'empty-cells',
'enable-background',
'field-sizing',
'fill',
'fill-opacity',
'fill-rule',
'filter', 'filter',
'flex', 'flex',
'flex-basis', 'flex-basis',
@ -469,8 +364,6 @@ const ATTRIBUTES = [
'flex-shrink', 'flex-shrink',
'flex-wrap', 'flex-wrap',
'float', 'float',
'flood-color',
'flood-opacity',
'flow', 'flow',
'font', 'font',
'font-display', 'font-display',
@ -478,32 +371,21 @@ const ATTRIBUTES = [
'font-feature-settings', 'font-feature-settings',
'font-kerning', 'font-kerning',
'font-language-override', 'font-language-override',
'font-optical-sizing',
'font-palette',
'font-size', 'font-size',
'font-size-adjust', 'font-size-adjust',
'font-smooth',
'font-smoothing', 'font-smoothing',
'font-stretch', 'font-stretch',
'font-style', 'font-style',
'font-synthesis', 'font-synthesis',
'font-synthesis-position',
'font-synthesis-small-caps',
'font-synthesis-style',
'font-synthesis-weight',
'font-variant', 'font-variant',
'font-variant-alternates',
'font-variant-caps', 'font-variant-caps',
'font-variant-east-asian', 'font-variant-east-asian',
'font-variant-emoji',
'font-variant-ligatures', 'font-variant-ligatures',
'font-variant-numeric', 'font-variant-numeric',
'font-variant-position', 'font-variant-position',
'font-variation-settings', 'font-variation-settings',
'font-weight', 'font-weight',
'forced-color-adjust',
'gap', 'gap',
'glyph-orientation-horizontal',
'glyph-orientation-vertical', 'glyph-orientation-vertical',
'grid', 'grid',
'grid-area', 'grid-area',
@ -523,36 +405,19 @@ const ATTRIBUTES = [
'grid-template-rows', 'grid-template-rows',
'hanging-punctuation', 'hanging-punctuation',
'height', 'height',
'hyphenate-character',
'hyphenate-limit-chars',
'hyphens', 'hyphens',
'icon', 'icon',
'image-orientation', 'image-orientation',
'image-rendering', 'image-rendering',
'image-resolution', 'image-resolution',
'ime-mode', 'ime-mode',
'initial-letter',
'initial-letter-align',
'inline-size', 'inline-size',
'inset',
'inset-area',
'inset-block',
'inset-block-end',
'inset-block-start',
'inset-inline',
'inset-inline-end',
'inset-inline-start',
'isolation', 'isolation',
'justify-content', 'justify-content',
'justify-items',
'justify-self',
'kerning',
'left', 'left',
'letter-spacing', 'letter-spacing',
'lighting-color',
'line-break', 'line-break',
'line-height', 'line-height',
'line-height-step',
'list-style', 'list-style',
'list-style-image', 'list-style-image',
'list-style-position', 'list-style-position',
@ -568,11 +433,6 @@ const ATTRIBUTES = [
'margin-left', 'margin-left',
'margin-right', 'margin-right',
'margin-top', 'margin-top',
'margin-trim',
'marker',
'marker-end',
'marker-mid',
'marker-start',
'marks', 'marks',
'mask', 'mask',
'mask-border', 'mask-border',
@ -591,10 +451,6 @@ const ATTRIBUTES = [
'mask-repeat', 'mask-repeat',
'mask-size', 'mask-size',
'mask-type', 'mask-type',
'masonry-auto-flow',
'math-depth',
'math-shift',
'math-style',
'max-block-size', 'max-block-size',
'max-height', 'max-height',
'max-inline-size', 'max-inline-size',
@ -613,12 +469,6 @@ const ATTRIBUTES = [
'normal', 'normal',
'object-fit', 'object-fit',
'object-position', 'object-position',
'offset',
'offset-anchor',
'offset-distance',
'offset-path',
'offset-position',
'offset-rotate',
'opacity', 'opacity',
'order', 'order',
'orphans', 'orphans',
@ -628,19 +478,9 @@ const ATTRIBUTES = [
'outline-style', 'outline-style',
'outline-width', 'outline-width',
'overflow', 'overflow',
'overflow-anchor',
'overflow-block',
'overflow-clip-margin',
'overflow-inline',
'overflow-wrap', 'overflow-wrap',
'overflow-x', 'overflow-x',
'overflow-y', 'overflow-y',
'overlay',
'overscroll-behavior',
'overscroll-behavior-block',
'overscroll-behavior-inline',
'overscroll-behavior-x',
'overscroll-behavior-y',
'padding', 'padding',
'padding-block', 'padding-block',
'padding-block-end', 'padding-block-end',
@ -652,37 +492,23 @@ const ATTRIBUTES = [
'padding-left', 'padding-left',
'padding-right', 'padding-right',
'padding-top', 'padding-top',
'page',
'page-break-after', 'page-break-after',
'page-break-before', 'page-break-before',
'page-break-inside', 'page-break-inside',
'paint-order',
'pause', 'pause',
'pause-after', 'pause-after',
'pause-before', 'pause-before',
'perspective', 'perspective',
'perspective-origin', 'perspective-origin',
'place-content',
'place-items',
'place-self',
'pointer-events', 'pointer-events',
'position', 'position',
'position-anchor',
'position-visibility',
'print-color-adjust',
'quotes', 'quotes',
'r',
'resize', 'resize',
'rest', 'rest',
'rest-after', 'rest-after',
'rest-before', 'rest-before',
'right', 'right',
'rotate',
'row-gap', 'row-gap',
'ruby-align',
'ruby-position',
'scale',
'scroll-behavior',
'scroll-margin', 'scroll-margin',
'scroll-margin-block', 'scroll-margin-block',
'scroll-margin-block-end', 'scroll-margin-block-end',
@ -708,43 +534,25 @@ const ATTRIBUTES = [
'scroll-snap-align', 'scroll-snap-align',
'scroll-snap-stop', 'scroll-snap-stop',
'scroll-snap-type', 'scroll-snap-type',
'scroll-timeline',
'scroll-timeline-axis',
'scroll-timeline-name',
'scrollbar-color', 'scrollbar-color',
'scrollbar-gutter', 'scrollbar-gutter',
'scrollbar-width', 'scrollbar-width',
'shape-image-threshold', 'shape-image-threshold',
'shape-margin', 'shape-margin',
'shape-outside', 'shape-outside',
'shape-rendering',
'speak', 'speak',
'speak-as', 'speak-as',
'src', // @font-face 'src', // @font-face
'stop-color',
'stop-opacity',
'stroke',
'stroke-dasharray',
'stroke-dashoffset',
'stroke-linecap',
'stroke-linejoin',
'stroke-miterlimit',
'stroke-opacity',
'stroke-width',
'tab-size', 'tab-size',
'table-layout', 'table-layout',
'text-align', 'text-align',
'text-align-all', 'text-align-all',
'text-align-last', 'text-align-last',
'text-anchor',
'text-combine-upright', 'text-combine-upright',
'text-decoration', 'text-decoration',
'text-decoration-color', 'text-decoration-color',
'text-decoration-line', 'text-decoration-line',
'text-decoration-skip',
'text-decoration-skip-ink',
'text-decoration-style', 'text-decoration-style',
'text-decoration-thickness',
'text-emphasis', 'text-emphasis',
'text-emphasis-color', 'text-emphasis-color',
'text-emphasis-position', 'text-emphasis-position',
@ -755,37 +563,20 @@ const ATTRIBUTES = [
'text-overflow', 'text-overflow',
'text-rendering', 'text-rendering',
'text-shadow', 'text-shadow',
'text-size-adjust',
'text-transform', 'text-transform',
'text-underline-offset',
'text-underline-position', 'text-underline-position',
'text-wrap',
'text-wrap-mode',
'text-wrap-style',
'timeline-scope',
'top', 'top',
'touch-action',
'transform', 'transform',
'transform-box', 'transform-box',
'transform-origin', 'transform-origin',
'transform-style', 'transform-style',
'transition', 'transition',
'transition-behavior',
'transition-delay', 'transition-delay',
'transition-duration', 'transition-duration',
'transition-property', 'transition-property',
'transition-timing-function', 'transition-timing-function',
'translate',
'unicode-bidi', 'unicode-bidi',
'user-modify',
'user-select',
'vector-effect',
'vertical-align', 'vertical-align',
'view-timeline',
'view-timeline-axis',
'view-timeline-inset',
'view-timeline-name',
'view-transition-name',
'visibility', 'visibility',
'voice-balance', 'voice-balance',
'voice-duration', 'voice-duration',
@ -796,7 +587,6 @@ const ATTRIBUTES = [
'voice-stress', 'voice-stress',
'voice-volume', 'voice-volume',
'white-space', 'white-space',
'white-space-collapse',
'widows', 'widows',
'width', 'width',
'will-change', 'will-change',
@ -804,11 +594,10 @@ const ATTRIBUTES = [
'word-spacing', 'word-spacing',
'word-wrap', 'word-wrap',
'writing-mode', 'writing-mode',
'x', 'z-index'
'y', // reverse makes sure longer attributes `font-weight` are matched fully
'z-index', // instead of getting false positives on say `font`
'zoom' ].reverse();
].sort().reverse();
/* /*
Language: CSS Language: CSS
@ -816,7 +605,6 @@ Category: common, css, web
Website: https://developer.mozilla.org/en-US/docs/Web/CSS Website: https://developer.mozilla.org/en-US/docs/Web/CSS
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function css(hljs) { function css(hljs) {
const regex = hljs.regex; const regex = hljs.regex;

View File

@ -4,7 +4,6 @@ Author: Aleksandar Ruzicic <aleksandar@ruzicic.info>
Description: D is a language with C-like syntax and static typing. It pragmatically combines efficiency, control, and modeling power, with safety and programmer productivity. Description: D is a language with C-like syntax and static typing. It pragmatically combines efficiency, control, and modeling power, with safety and programmer productivity.
Version: 1.0a Version: 1.0a
Website: https://dlang.org Website: https://dlang.org
Category: system
Date: 2012-04-08 Date: 2012-04-08
*/ */

View File

@ -25,15 +25,6 @@ function dart(hljs) {
keywords: 'true false null this is new super' keywords: 'true false null this is new super'
}; };
const NUMBER = {
className: 'number',
relevance: 0,
variants: [
{ match: /\b[0-9][0-9_]*(\.[0-9][0-9_]*)?([eE][+-]?[0-9][0-9_]*)?\b/ },
{ match: /\b0[xX][0-9A-Fa-f][0-9A-Fa-f_]*\b/ }
]
};
const STRING = { const STRING = {
className: 'string', className: 'string',
variants: [ variants: [
@ -96,7 +87,7 @@ function dart(hljs) {
] ]
}; };
BRACED_SUBST.contains = [ BRACED_SUBST.contains = [
NUMBER, hljs.C_NUMBER_MODE,
STRING STRING
]; ];
@ -257,7 +248,7 @@ function dart(hljs) {
hljs.UNDERSCORE_TITLE_MODE hljs.UNDERSCORE_TITLE_MODE
] ]
}, },
NUMBER, hljs.C_NUMBER_MODE,
{ {
className: 'meta', className: 'meta',
begin: '@[A-Za-z]+' begin: '@[A-Za-z]+'

View File

@ -1,7 +1,6 @@
/* /*
Language: Delphi Language: Delphi
Website: https://www.embarcadero.com/products/delphi Website: https://www.embarcadero.com/products/delphi
Category: system
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
@ -164,36 +163,20 @@ function delphi(hljs) {
relevance: 0, relevance: 0,
// Source: https://www.freepascal.org/docs-html/ref/refse6.html // Source: https://www.freepascal.org/docs-html/ref/refse6.html
variants: [ variants: [
{
// Regular numbers, e.g., 123, 123.456.
match: /\b\d[\d_]*(\.\d[\d_]*)?/ },
{ {
// Hexadecimal notation, e.g., $7F. // Hexadecimal notation, e.g., $7F.
match: /\$[\dA-Fa-f_]+/ }, begin: '\\$[0-9A-Fa-f]+' },
{
// Hexadecimal literal with no digits
match: /\$/,
relevance: 0 },
{ {
// Octal notation, e.g., &42. // Octal notation, e.g., &42.
match: /&[0-7][0-7_]*/ }, begin: '&[0-7]+' },
{ {
// Binary notation, e.g., %1010. // Binary notation, e.g., %1010.
match: /%[01_]+/ }, begin: '%[01]+' }
{
// Binary literal with no digits
match: /%/,
relevance: 0 }
] ]
}; };
const CHAR_STRING = { const CHAR_STRING = {
className: 'string', className: 'string',
variants: [ begin: /(#\d+)+/
{ match: /#\d[\d_]*/ },
{ match: /#\$[\dA-Fa-f][\dA-Fa-f_]*/ },
{ match: /#&[0-7][0-7_]*/ },
{ match: /#%[01][01_]*/ }
]
}; };
const CLASS = { const CLASS = {
begin: hljs.IDENT_RE + '\\s*=\\s*class\\s*\\(', begin: hljs.IDENT_RE + '\\s*=\\s*class\\s*\\(',
@ -235,6 +218,7 @@ function delphi(hljs) {
contains: [ contains: [
STRING, STRING,
CHAR_STRING, CHAR_STRING,
hljs.NUMBER_MODE,
NUMBER, NUMBER,
CLASS, CLASS,
FUNCTION, FUNCTION,

View File

@ -3,7 +3,6 @@ Language: Batch file (DOS)
Author: Alexander Makarov <sam@rmcreative.ru> Author: Alexander Makarov <sam@rmcreative.ru>
Contributors: Anton Kochkov <anton.kochkov@gmail.com> Contributors: Anton Kochkov <anton.kochkov@gmail.com>
Website: https://en.wikipedia.org/wiki/Batch_file Website: https://en.wikipedia.org/wiki/Batch_file
Category: scripting
*/ */
/** @type LanguageFn */ /** @type LanguageFn */

View File

@ -2,7 +2,6 @@
Language: Extended Backus-Naur Form Language: Extended Backus-Naur Form
Author: Alex McKibben <alex@nullscope.net> Author: Alex McKibben <alex@nullscope.net>
Website: https://en.wikipedia.org/wiki/Extended_BackusNaur_form Website: https://en.wikipedia.org/wiki/Extended_BackusNaur_form
Category: syntax
*/ */
/** @type LanguageFn */ /** @type LanguageFn */

View File

@ -13,7 +13,7 @@ function erlang(hljs) {
const ERLANG_RESERVED = { const ERLANG_RESERVED = {
keyword: keyword:
'after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if ' 'after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if '
+ 'let not of orelse|10 query receive rem try when xor maybe else', + 'let not of orelse|10 query receive rem try when xor',
literal: literal:
'false true' 'false true'
}; };
@ -76,35 +76,9 @@ function erlang(hljs) {
} }
] ]
}; };
const CHAR_LITERAL = {
scope: 'string',
match: /\$(\\([^0-9]|[0-9]{1,3}|)|.)/,
};
const TRIPLE_QUOTE = {
scope: 'string',
match: /"""("*)(?!")[\s\S]*?"""\1/,
};
const SIGIL = {
scope: 'string',
contains: [ hljs.BACKSLASH_ESCAPE ],
variants: [
{match: /~\w?"""("*)(?!")[\s\S]*?"""\1/},
{begin: /~\w?\(/, end: /\)/},
{begin: /~\w?\[/, end: /\]/},
{begin: /~\w?{/, end: /}/},
{begin: /~\w?</, end: />/},
{begin: /~\w?\//, end: /\//},
{begin: /~\w?\|/, end: /\|/},
{begin: /~\w?'/, end: /'/},
{begin: /~\w?"/, end: /"/},
{begin: /~\w?`/, end: /`/},
{begin: /~\w?#/, end: /#/},
],
};
const BLOCK_STATEMENTS = { const BLOCK_STATEMENTS = {
beginKeywords: 'fun receive if try case maybe', beginKeywords: 'fun receive if try case',
end: 'end', end: 'end',
keywords: ERLANG_RESERVED keywords: ERLANG_RESERVED
}; };
@ -114,15 +88,12 @@ function erlang(hljs) {
hljs.inherit(hljs.APOS_STRING_MODE, { className: '' }), hljs.inherit(hljs.APOS_STRING_MODE, { className: '' }),
BLOCK_STATEMENTS, BLOCK_STATEMENTS,
FUNCTION_CALL, FUNCTION_CALL,
SIGIL,
TRIPLE_QUOTE,
hljs.QUOTE_STRING_MODE, hljs.QUOTE_STRING_MODE,
NUMBER, NUMBER,
TUPLE, TUPLE,
VAR1, VAR1,
VAR2, VAR2,
RECORD_ACCESS, RECORD_ACCESS
CHAR_LITERAL
]; ];
const BASIC_MODES = [ const BASIC_MODES = [
@ -130,15 +101,12 @@ function erlang(hljs) {
NAMED_FUN, NAMED_FUN,
BLOCK_STATEMENTS, BLOCK_STATEMENTS,
FUNCTION_CALL, FUNCTION_CALL,
SIGIL,
TRIPLE_QUOTE,
hljs.QUOTE_STRING_MODE, hljs.QUOTE_STRING_MODE,
NUMBER, NUMBER,
TUPLE, TUPLE,
VAR1, VAR1,
VAR2, VAR2,
RECORD_ACCESS, RECORD_ACCESS
CHAR_LITERAL
]; ];
FUNCTION_CALL.contains[1].contains = BASIC_MODES; FUNCTION_CALL.contains[1].contains = BASIC_MODES;
TUPLE.contains = BASIC_MODES; TUPLE.contains = BASIC_MODES;
@ -154,7 +122,6 @@ function erlang(hljs) {
"-author", "-author",
"-copyright", "-copyright",
"-doc", "-doc",
"-moduledoc",
"-vsn", "-vsn",
"-import", "-import",
"-include", "-include",
@ -166,9 +133,7 @@ function erlang(hljs) {
"-file", "-file",
"-behaviour", "-behaviour",
"-behavior", "-behavior",
"-spec", "-spec"
"-on_load",
"-nifs",
]; ];
const PARAMS = { const PARAMS = {
@ -177,7 +142,6 @@ function erlang(hljs) {
end: '\\)', end: '\\)',
contains: BASIC_MODES contains: BASIC_MODES
}; };
return { return {
name: 'Erlang', name: 'Erlang',
aliases: [ 'erl' ], aliases: [ 'erl' ],
@ -211,22 +175,14 @@ function erlang(hljs) {
$pattern: '-' + hljs.IDENT_RE, $pattern: '-' + hljs.IDENT_RE,
keyword: DIRECTIVES.map(x => `${x}|1.5`).join(" ") keyword: DIRECTIVES.map(x => `${x}|1.5`).join(" ")
}, },
contains: [ contains: [ PARAMS ]
PARAMS,
SIGIL,
TRIPLE_QUOTE,
hljs.QUOTE_STRING_MODE
]
}, },
NUMBER, NUMBER,
SIGIL,
TRIPLE_QUOTE,
hljs.QUOTE_STRING_MODE, hljs.QUOTE_STRING_MODE,
RECORD_ACCESS, RECORD_ACCESS,
VAR1, VAR1,
VAR2, VAR2,
TUPLE, TUPLE,
CHAR_LITERAL,
{ begin: /\.$/ } // relevance booster { begin: /\.$/ } // relevance booster
] ]
}; };

View File

@ -3,12 +3,11 @@ Language: Excel formulae
Author: Victor Zhou <OiCMudkips@users.noreply.github.com> Author: Victor Zhou <OiCMudkips@users.noreply.github.com>
Description: Excel formulae Description: Excel formulae
Website: https://products.office.com/en-us/excel/ Website: https://products.office.com/en-us/excel/
Category: enterprise
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function excel(hljs) { function excel(hljs) {
// built-in functions imported from https://web.archive.org/web/20241205190205/https://support.microsoft.com/en-us/office/excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188 // built-in functions imported from https://web.archive.org/web/20160513042710/https://support.office.com/en-us/article/Excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188
const BUILT_INS = [ const BUILT_INS = [
"ABS", "ABS",
"ACCRINT", "ACCRINT",
@ -24,7 +23,6 @@ function excel(hljs) {
"AND", "AND",
"ARABIC", "ARABIC",
"AREAS", "AREAS",
"ARRAYTOTEXT",
"ASC", "ASC",
"ASIN", "ASIN",
"ASINH", "ASINH",
@ -58,8 +56,6 @@ function excel(hljs) {
"BITOR", "BITOR",
"BITRSHIFT", "BITRSHIFT",
"BITXOR", "BITXOR",
"BYCOL",
"BYROW",
"CALL", "CALL",
"CEILING", "CEILING",
"CEILING.MATH", "CEILING.MATH",
@ -75,8 +71,6 @@ function excel(hljs) {
"CHISQ.INV.RT", "CHISQ.INV.RT",
"CHISQ.TEST", "CHISQ.TEST",
"CHOOSE", "CHOOSE",
"CHOOSECOLS",
"CHOOSEROWS",
"CLEAN", "CLEAN",
"CODE", "CODE",
"COLUMN", "COLUMN",
@ -148,7 +142,6 @@ function excel(hljs) {
"DOLLARDE", "DOLLARDE",
"DOLLARFR", "DOLLARFR",
"DPRODUCT", "DPRODUCT",
"DROP",
"DSTDEV", "DSTDEV",
"DSTDEVP", "DSTDEVP",
"DSUM", "DSUM",
@ -168,16 +161,14 @@ function excel(hljs) {
"EVEN", "EVEN",
"EXACT", "EXACT",
"EXP", "EXP",
"EXPAND",
"EXPON.DIST", "EXPON.DIST",
"EXPONDIST", "EXPONDIST",
"FACT", "FACT",
"FACTDOUBLE", "FACTDOUBLE",
"FALSE", "FALSE|0",
"F.DIST", "F.DIST",
"FDIST", "FDIST",
"F.DIST.RT", "F.DIST.RT",
"FILTER",
"FILTERXML", "FILTERXML",
"FIND", "FIND",
"FINDB", "FINDB",
@ -221,7 +212,6 @@ function excel(hljs) {
"HEX2OCT", "HEX2OCT",
"HLOOKUP", "HLOOKUP",
"HOUR", "HOUR",
"HSTACK",
"HYPERLINK", "HYPERLINK",
"HYPGEOM.DIST", "HYPGEOM.DIST",
"HYPGEOMDIST", "HYPGEOMDIST",
@ -230,7 +220,6 @@ function excel(hljs) {
"IFNA", "IFNA",
"IFS", "IFS",
"IMABS", "IMABS",
"IMAGE",
"IMAGINARY", "IMAGINARY",
"IMARGUMENT", "IMARGUMENT",
"IMCONJUGATE", "IMCONJUGATE",
@ -273,7 +262,6 @@ function excel(hljs) {
"ISNONTEXT", "ISNONTEXT",
"ISNUMBER", "ISNUMBER",
"ISODD", "ISODD",
"ISOMITTED",
"ISREF", "ISREF",
"ISTEXT", "ISTEXT",
"ISO.CEILING", "ISO.CEILING",
@ -281,14 +269,12 @@ function excel(hljs) {
"ISPMT", "ISPMT",
"JIS", "JIS",
"KURT", "KURT",
"LAMBDA",
"LARGE", "LARGE",
"LCM", "LCM",
"LEFT", "LEFT",
"LEFTB", "LEFTB",
"LEN", "LEN",
"LENB", "LENB",
"LET",
"LINEST", "LINEST",
"LN", "LN",
"LOG", "LOG",
@ -300,8 +286,6 @@ function excel(hljs) {
"LOGNORM.INV", "LOGNORM.INV",
"LOOKUP", "LOOKUP",
"LOWER", "LOWER",
"MAKEARRAY",
"MAP",
"MATCH", "MATCH",
"MAX", "MAX",
"MAXA", "MAXA",
@ -310,7 +294,7 @@ function excel(hljs) {
"MDURATION", "MDURATION",
"MEDIAN", "MEDIAN",
"MID", "MID",
"MIDB", "MIDBs",
"MIN", "MIN",
"MINIFS", "MINIFS",
"MINA", "MINA",
@ -387,14 +371,12 @@ function excel(hljs) {
"QUOTIENT", "QUOTIENT",
"RADIANS", "RADIANS",
"RAND", "RAND",
"RANDARRAY",
"RANDBETWEEN", "RANDBETWEEN",
"RANK.AVG", "RANK.AVG",
"RANK.EQ", "RANK.EQ",
"RANK", "RANK",
"RATE", "RATE",
"RECEIVED", "RECEIVED",
"REDUCE",
"REGISTER.ID", "REGISTER.ID",
"REPLACE", "REPLACE",
"REPLACEB", "REPLACEB",
@ -410,13 +392,11 @@ function excel(hljs) {
"RRI", "RRI",
"RSQ", "RSQ",
"RTD", "RTD",
"SCAN",
"SEARCH", "SEARCH",
"SEARCHB", "SEARCHB",
"SEC", "SEC",
"SECH", "SECH",
"SECOND", "SECOND",
"SEQUENCE",
"SERIESSUM", "SERIESSUM",
"SHEET", "SHEET",
"SHEETS", "SHEETS",
@ -428,13 +408,10 @@ function excel(hljs) {
"SLN", "SLN",
"SLOPE", "SLOPE",
"SMALL", "SMALL",
"SORT", "SQL.REQUEST",
"SORTBY",
"SQRT", "SQRT",
"SQRTPI", "SQRTPI",
"SQL.REQUEST",
"STANDARDIZE", "STANDARDIZE",
"STOCKHISTORY",
"STDEV", "STDEV",
"STDEV.P", "STDEV.P",
"STDEV.S", "STDEV.S",
@ -457,7 +434,6 @@ function excel(hljs) {
"T", "T",
"TAN", "TAN",
"TANH", "TANH",
"TAKE",
"TBILLEQ", "TBILLEQ",
"TBILLPRICE", "TBILLPRICE",
"TBILLYIELD", "TBILLYIELD",
@ -466,33 +442,26 @@ function excel(hljs) {
"T.DIST.RT", "T.DIST.RT",
"TDIST", "TDIST",
"TEXT", "TEXT",
"TEXTAFTER",
"TEXTBEFORE",
"TEXTJOIN", "TEXTJOIN",
"TEXTSPLIT",
"TIME", "TIME",
"TIMEVALUE", "TIMEVALUE",
"T.INV", "T.INV",
"T.INV.2T", "T.INV.2T",
"TINV", "TINV",
"TOCOL",
"TOROW",
"TODAY", "TODAY",
"TRANSPOSE", "TRANSPOSE",
"TREND", "TREND",
"TRIM", "TRIM",
"TRIMMEAN", "TRIMMEAN",
"TRUE", "TRUE|0",
"TRUNC", "TRUNC",
"T.TEST", "T.TEST",
"TTEST", "TTEST",
"TYPE", "TYPE",
"UNICHAR", "UNICHAR",
"UNICODE", "UNICODE",
"UNIQUE",
"UPPER", "UPPER",
"VALUE", "VALUE",
"VALUETOTEXT",
"VAR", "VAR",
"VAR.P", "VAR.P",
"VAR.S", "VAR.S",
@ -501,7 +470,6 @@ function excel(hljs) {
"VARPA", "VARPA",
"VDB", "VDB",
"VLOOKUP", "VLOOKUP",
"VSTACK",
"WEBSERVICE", "WEBSERVICE",
"WEEKDAY", "WEEKDAY",
"WEEKNUM", "WEEKNUM",
@ -509,11 +477,7 @@ function excel(hljs) {
"WEIBULL.DIST", "WEIBULL.DIST",
"WORKDAY", "WORKDAY",
"WORKDAY.INTL", "WORKDAY.INTL",
"WRAPCOLS",
"WRAPROWS",
"XIRR", "XIRR",
"XLOOKUP",
"XMATCH",
"XNPV", "XNPV",
"XOR", "XOR",
"YEAR", "YEAR",

View File

@ -550,7 +550,6 @@ function fortran(hljs) {
'f95' 'f95'
], ],
keywords: { keywords: {
$pattern: /\b[a-z][a-z0-9_]+\b|\.[a-z][a-z0-9_]+\./,
keyword: KEYWORDS, keyword: KEYWORDS,
literal: LITERALS, literal: LITERALS,
built_in: BUILT_INS built_in: BUILT_INS

View File

@ -75,7 +75,6 @@ Website: https://docs.microsoft.com/en-us/dotnet/fsharp/
Category: functional Category: functional
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function fsharp(hljs) { function fsharp(hljs) {
const KEYWORDS = [ const KEYWORDS = [

View File

@ -194,7 +194,7 @@ function gauss(hljs) {
excludeEnd: true, excludeEnd: true,
contains: [].concat(PARSE_PARAMS) contains: [].concat(PARSE_PARAMS)
}, },
{} inherits || {}
); );
mode.contains.push(FUNCTION_DEF); mode.contains.push(FUNCTION_DEF);
mode.contains.push(hljs.C_NUMBER_MODE); mode.contains.push(hljs.C_NUMBER_MODE);

View File

@ -3,174 +3,61 @@
Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com> Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com>
Description: G-code syntax highlighter for Fanuc and other common CNC machine tool controls. Description: G-code syntax highlighter for Fanuc and other common CNC machine tool controls.
Website: https://www.sis.se/api/document/preview/911952/ Website: https://www.sis.se/api/document/preview/911952/
Category: hardware
*/ */
function gcode(hljs) { function gcode(hljs) {
const regex = hljs.regex; const GCODE_IDENT_RE = '[A-Z_][A-Z0-9_.]*';
const GCODE_CLOSE_RE = '%';
const GCODE_KEYWORDS = { const GCODE_KEYWORDS = {
$pattern: /[A-Z]+|%/, $pattern: GCODE_IDENT_RE,
keyword: [ keyword: 'IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT '
// conditions + 'EQ LT GT NE GE LE OR XOR'
'THEN',
'ELSE',
'ENDIF',
'IF',
// controls
'GOTO',
'DO',
'WHILE',
'WH',
'END',
'CALL',
// scoping
'SUB',
'ENDSUB',
// comparisons
'EQ',
'NE',
'LT',
'GT',
'LE',
'GE',
'AND',
'OR',
'XOR',
// start/end of program
'%'
],
built_in: [
'ATAN',
'ABS',
'ACOS',
'ASIN',
'COS',
'EXP',
'FIX',
'FUP',
'ROUND',
'LN',
'SIN',
'SQRT',
'TAN',
'EXISTS'
]
}; };
const GCODE_START = {
className: 'meta',
// TODO: post v12 lets use look-behind, until then \b and a callback filter will be used begin: '([O])([0-9]+)'
// const LETTER_BOUNDARY_RE = /(?<![A-Z])/; };
const LETTER_BOUNDARY_RE = /\b/; const NUMBER = hljs.inherit(hljs.C_NUMBER_MODE, { begin: '([-+]?((\\.\\d+)|(\\d+)(\\.\\d*)?))|' + hljs.C_NUMBER_RE });
function LETTER_BOUNDARY_CALLBACK(matchdata, response) {
if (matchdata.index === 0) {
return;
}
const charBeforeMatch = matchdata.input[matchdata.index - 1];
if (charBeforeMatch >= '0' && charBeforeMatch <= '9') {
return;
}
if (charBeforeMatch === '_') {
return;
}
response.ignoreMatch();
}
const NUMBER_RE = /[+-]?((\.\d+)|(\d+)(\.\d*)?)/;
const GENERAL_MISC_FUNCTION_RE = /[GM]\s*\d+(\.\d+)?/;
const TOOLS_RE = /T\s*\d+/;
const SUBROUTINE_RE = /O\s*\d+/;
const SUBROUTINE_NAMED_RE = /O<.+>/;
const AXES_RE = /[ABCUVWXYZ]\s*/;
const PARAMETERS_RE = /[FHIJKPQRS]\s*/;
const GCODE_CODE = [ const GCODE_CODE = [
// comments hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT(/\(/, /\)/), hljs.COMMENT(/\(/, /\)/),
hljs.COMMENT(/;/, /$/), NUMBER,
hljs.APOS_STRING_MODE, hljs.inherit(hljs.APOS_STRING_MODE, { illegal: null }),
hljs.QUOTE_STRING_MODE, hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }),
hljs.C_NUMBER_MODE,
// gcodes
{ {
scope: 'title.function', className: 'name',
begin: '([G])([0-9]+\\.?[0-9]?)'
},
{
className: 'name',
begin: '([M])([0-9]+\\.?[0-9]?)'
},
{
className: 'attr',
begin: '(VC|VS|#)',
end: '(\\d+)'
},
{
className: 'attr',
begin: '(VZOFX|VZOFY|VZOFZ)'
},
{
className: 'built_in',
begin: '(ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN)(\\[)',
contains: [ NUMBER ],
end: '\\]'
},
{
className: 'symbol',
variants: [ variants: [
// G General functions: G0, G5.1, G5.2, …
// M Misc functions: M0, M55.6, M199, …
{ match: regex.concat(LETTER_BOUNDARY_RE, GENERAL_MISC_FUNCTION_RE) },
{ {
begin: GENERAL_MISC_FUNCTION_RE, begin: 'N',
'on:begin': LETTER_BOUNDARY_CALLBACK end: '\\d+',
}, illegal: '\\W'
// T Tools
{ match: regex.concat(LETTER_BOUNDARY_RE, TOOLS_RE), },
{
begin: TOOLS_RE,
'on:begin': LETTER_BOUNDARY_CALLBACK
} }
] ]
}, }
{
scope: 'symbol',
variants: [
// O Subroutine ID: O100, O110, …
{ match: regex.concat(LETTER_BOUNDARY_RE, SUBROUTINE_RE) },
{
begin: SUBROUTINE_RE,
'on:begin': LETTER_BOUNDARY_CALLBACK
},
// O Subroutine name: O<some>, …
{ match: regex.concat(LETTER_BOUNDARY_RE, SUBROUTINE_NAMED_RE) },
{
begin: SUBROUTINE_NAMED_RE,
'on:begin': LETTER_BOUNDARY_CALLBACK
},
// Checksum at end of line: *71, *199, …
{ match: /\*\s*\d+\s*$/ }
]
},
{
scope: 'operator', // N Line number: N1, N2, N1020, …
match: /^N\s*\d+/
},
{
scope: 'variable',
match: /-?#\s*\d+/
},
{
scope: 'property', // Physical axes,
variants: [
{ match: regex.concat(LETTER_BOUNDARY_RE, AXES_RE, NUMBER_RE) },
{
begin: regex.concat(AXES_RE, NUMBER_RE),
'on:begin': LETTER_BOUNDARY_CALLBACK
},
]
},
{
scope: 'params', // Different types of parameters
variants: [
{ match: regex.concat(LETTER_BOUNDARY_RE, PARAMETERS_RE, NUMBER_RE) },
{
begin: regex.concat(PARAMETERS_RE, NUMBER_RE),
'on:begin': LETTER_BOUNDARY_CALLBACK
},
]
},
]; ];
return { return {
@ -179,10 +66,14 @@ function gcode(hljs) {
// Some implementations (CNC controls) of G-code are interoperable with uppercase and lowercase letters seamlessly. // Some implementations (CNC controls) of G-code are interoperable with uppercase and lowercase letters seamlessly.
// However, most prefer all uppercase and uppercase is customary. // However, most prefer all uppercase and uppercase is customary.
case_insensitive: true, case_insensitive: true,
// TODO: post v12 with the use of look-behind this can be enabled
disableAutodetect: true,
keywords: GCODE_KEYWORDS, keywords: GCODE_KEYWORDS,
contains: GCODE_CODE contains: [
{
className: 'meta',
begin: GCODE_CLOSE_RE
},
GCODE_START
].concat(GCODE_CODE)
}; };
} }

File diff suppressed because it is too large Load Diff

View File

@ -109,25 +109,10 @@ function go(hljs) {
className: 'number', className: 'number',
variants: [ variants: [
{ {
match: /-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/, // hex without a present digit before . (making a digit afterwards required) begin: hljs.C_NUMBER_RE + '[i]',
relevance: 0 relevance: 1
}, },
{ hljs.C_NUMBER_MODE
match: /-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/, // hex with a present digit before . (making a digit afterwards optional)
relevance: 0
},
{
match: /-?\b0[oO](_?[0-7])*i?/, // leading 0o octal
relevance: 0
},
{
match: /-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/, // decimal without a present digit before . (making a digit afterwards required)
relevance: 0
},
{
match: /-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/, // decimal with a present digit before . (making a digit afterwards optional)
relevance: 0
}
] ]
}, },
{ begin: /:=/ // relevance booster { begin: /:=/ // relevance booster

View File

@ -3,7 +3,6 @@ Language: Golo
Author: Philippe Charriere <ph.charriere@gmail.com> Author: Philippe Charriere <ph.charriere@gmail.com>
Description: a lightweight dynamic language for the JVM Description: a lightweight dynamic language for the JVM
Website: http://golo-lang.org/ Website: http://golo-lang.org/
Category: system
*/ */
function golo(hljs) { function golo(hljs) {

View File

@ -3,7 +3,6 @@ Language: Gradle
Description: Gradle is an open-source build automation tool focused on flexibility and performance. Description: Gradle is an open-source build automation tool focused on flexibility and performance.
Website: https://gradle.org Website: https://gradle.org
Author: Damian Mee <mee.damian@gmail.com> Author: Damian Mee <mee.damian@gmail.com>
Category: build-system
*/ */
function gradle(hljs) { function gradle(hljs) {

View File

@ -3,7 +3,6 @@
Author: Guillaume Laforge <glaforge@gmail.com> Author: Guillaume Laforge <glaforge@gmail.com>
Description: Groovy programming language implementation inspired from Vsevolod's Java mode Description: Groovy programming language implementation inspired from Vsevolod's Java mode
Website: https://groovy-lang.org Website: https://groovy-lang.org
Category: system
*/ */
function variants(variants, obj = {}) { function variants(variants, obj = {}) {
@ -67,7 +66,7 @@ function groovy(hljs) {
const CLASS_DEFINITION = { const CLASS_DEFINITION = {
match: [ match: [
/(class|interface|trait|enum|record|extends|implements)/, /(class|interface|trait|enum|extends|implements)/,
/\s+/, /\s+/,
hljs.UNDERSCORE_IDENT_RE hljs.UNDERSCORE_IDENT_RE
], ],
@ -127,8 +126,7 @@ function groovy(hljs) {
"import", "import",
"package", "package",
"return", "return",
"instanceof", "instanceof"
"var"
]; ];
return { return {

View File

@ -7,32 +7,8 @@ Category: functional
*/ */
function haskell(hljs) { function haskell(hljs) {
/* See:
- https://www.haskell.org/onlinereport/lexemes.html
- https://downloads.haskell.org/ghc/9.0.1/docs/html/users_guide/exts/binary_literals.html
- https://downloads.haskell.org/ghc/9.0.1/docs/html/users_guide/exts/numeric_underscores.html
- https://downloads.haskell.org/ghc/9.0.1/docs/html/users_guide/exts/hex_float_literals.html
*/
const decimalDigits = '([0-9]_*)+';
const hexDigits = '([0-9a-fA-F]_*)+';
const binaryDigits = '([01]_*)+';
const octalDigits = '([0-7]_*)+';
const ascSymbol = '[!#$%&*+.\\/<=>?@\\\\^~-]';
const uniSymbol = '(\\p{S}|\\p{P})'; // Symbol or Punctuation
const special = '[(),;\\[\\]`|{}]';
const symbol = `(${ascSymbol}|(?!(${special}|[_:"']))${uniSymbol})`;
const COMMENT = { variants: [ const COMMENT = { variants: [
// Double dash forms a valid comment only if it's not part of legal lexeme. hljs.COMMENT('--', '$'),
// See: Haskell 98 report: https://www.haskell.org/onlinereport/lexemes.html
//
// The commented code does the job, but we can't use negative lookbehind,
// due to poor support by Safari browser.
// > hljs.COMMENT(`(?<!${symbol})--+(?!${symbol})`, '$'),
// So instead, we'll add a no-markup rule before the COMMENT rule in the rules list
// to match the problematic infix operators that contain double dash.
hljs.COMMENT('--+', '$'),
hljs.COMMENT( hljs.COMMENT(
/\{-/, /\{-/,
/-\}/, /-\}/,
@ -80,6 +56,19 @@ function haskell(hljs) {
contains: LIST.contains contains: LIST.contains
}; };
/* See:
- https://www.haskell.org/onlinereport/lexemes.html
- https://downloads.haskell.org/ghc/9.0.1/docs/html/users_guide/exts/binary_literals.html
- https://downloads.haskell.org/ghc/9.0.1/docs/html/users_guide/exts/numeric_underscores.html
- https://downloads.haskell.org/ghc/9.0.1/docs/html/users_guide/exts/hex_float_literals.html
*/
const decimalDigits = '([0-9]_*)+';
const hexDigits = '([0-9a-fA-F]_*)+';
const binaryDigits = '([01]_*)+';
const octalDigits = '([0-7]_*)+';
const NUMBER = { const NUMBER = {
className: 'number', className: 'number',
relevance: 0, relevance: 0,
@ -103,7 +92,6 @@ function haskell(hljs) {
+ 'qualified type data newtype deriving class instance as default ' + 'qualified type data newtype deriving class instance as default '
+ 'infix infixl infixr foreign export ccall stdcall cplusplus ' + 'infix infixl infixr foreign export ccall stdcall cplusplus '
+ 'jvm dotnet safe unsafe family forall mdo proc rec', + 'jvm dotnet safe unsafe family forall mdo proc rec',
unicodeRegex: true,
contains: [ contains: [
// Top-level constructions. // Top-level constructions.
{ {
@ -205,8 +193,6 @@ function haskell(hljs) {
NUMBER, NUMBER,
CONSTRUCTOR, CONSTRUCTOR,
hljs.inherit(hljs.TITLE_MODE, { begin: '^[_a-z][\\w\']*' }), hljs.inherit(hljs.TITLE_MODE, { begin: '^[_a-z][\\w\']*' }),
// No markup, prevents infix operators from being recognized as comments.
{ begin: `(?!-)${symbol}--+|--+(?!-)${symbol}`},
COMMENT, COMMENT,
{ // No markup, relevance booster { // No markup, relevance booster
begin: '->|<-' } begin: '->|<-' }

View File

@ -4,14 +4,9 @@ Description: Haxe is an open source toolkit based on a modern, high level, stric
Author: Christopher Kaster <ikasoki@gmail.com> (Based on the actionscript.js language file by Alexander Myadzel) Author: Christopher Kaster <ikasoki@gmail.com> (Based on the actionscript.js language file by Alexander Myadzel)
Contributors: Kenton Hamaluik <kentonh@gmail.com> Contributors: Kenton Hamaluik <kentonh@gmail.com>
Website: https://haxe.org Website: https://haxe.org
Category: system
*/ */
function haxe(hljs) { function haxe(hljs) {
const IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*';
// C_NUMBER_RE with underscores and literal suffixes
const HAXE_NUMBER_RE = /(-?)(\b0[xX][a-fA-F0-9_]+|(\b\d+(\.[\d_]*)?|\.[\d_]+)(([eE][-+]?\d+)|i32|u32|i64|f64)?)/;
const HAXE_BASIC_TYPES = 'Int Float String Bool Dynamic Void Array '; const HAXE_BASIC_TYPES = 'Int Float String Bool Dynamic Void Array ';
@ -19,8 +14,8 @@ function haxe(hljs) {
name: 'Haxe', name: 'Haxe',
aliases: [ 'hx' ], aliases: [ 'hx' ],
keywords: { keywords: {
keyword: 'abstract break case cast catch continue default do dynamic else enum extern ' keyword: 'break case cast catch continue default do dynamic else enum extern '
+ 'final for function here if import in inline is macro never new override package private get set ' + 'for function here if import in inline never new override package private get set '
+ 'public return static super switch this throw trace try typedef untyped using var while ' + 'public return static super switch this throw trace try typedef untyped using var while '
+ HAXE_BASIC_TYPES, + HAXE_BASIC_TYPES,
built_in: built_in:
@ -37,12 +32,12 @@ function haxe(hljs) {
hljs.BACKSLASH_ESCAPE, hljs.BACKSLASH_ESCAPE,
{ {
className: 'subst', // interpolation className: 'subst', // interpolation
begin: /\$\{/, begin: '\\$\\{',
end: /\}/ end: '\\}'
}, },
{ {
className: 'subst', // interpolation className: 'subst', // interpolation
begin: /\$/, begin: '\\$',
end: /\W\}/ end: /\W\}/
} }
] ]
@ -50,20 +45,11 @@ function haxe(hljs) {
hljs.QUOTE_STRING_MODE, hljs.QUOTE_STRING_MODE,
hljs.C_LINE_COMMENT_MODE, hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE,
{ hljs.C_NUMBER_MODE,
className: 'number',
begin: HAXE_NUMBER_RE,
relevance: 0
},
{
className: 'variable',
begin: "\\$" + IDENT_RE,
},
{ {
className: 'meta', // compiler meta className: 'meta', // compiler meta
begin: /@:?/, begin: '@:',
end: /\(|$/, end: '$'
excludeEnd: true,
}, },
{ {
className: 'meta', // compiler conditionals className: 'meta', // compiler conditionals
@ -73,55 +59,55 @@ function haxe(hljs) {
}, },
{ {
className: 'type', // function types className: 'type', // function types
begin: /:[ \t]*/, begin: ':[ \t]*',
end: /[^A-Za-z0-9_ \t\->]/, end: '[^A-Za-z0-9_ \t\\->]',
excludeBegin: true, excludeBegin: true,
excludeEnd: true, excludeEnd: true,
relevance: 0 relevance: 0
}, },
{ {
className: 'type', // types className: 'type', // types
begin: /:[ \t]*/, begin: ':[ \t]*',
end: /\W/, end: '\\W',
excludeBegin: true, excludeBegin: true,
excludeEnd: true excludeEnd: true
}, },
{ {
className: 'type', // instantiation className: 'type', // instantiation
beginKeywords: 'new', begin: 'new *',
end: /\W/, end: '\\W',
excludeBegin: true, excludeBegin: true,
excludeEnd: true excludeEnd: true
}, },
{ {
className: 'title.class', // enums className: 'class', // enums
beginKeywords: 'enum', beginKeywords: 'enum',
end: /\{/, end: '\\{',
contains: [ hljs.TITLE_MODE ] contains: [ hljs.TITLE_MODE ]
}, },
{ {
className: 'title.class', // abstracts className: 'class', // abstracts
begin: '\\babstract\\b(?=\\s*' + hljs.IDENT_RE + '\\s*\\()', beginKeywords: 'abstract',
end: /[\{$]/, end: '[\\{$]',
contains: [ contains: [
{ {
className: 'type', className: 'type',
begin: /\(/, begin: '\\(',
end: /\)/, end: '\\)',
excludeBegin: true, excludeBegin: true,
excludeEnd: true excludeEnd: true
}, },
{ {
className: 'type', className: 'type',
begin: /from +/, begin: 'from +',
end: /\W/, end: '\\W',
excludeBegin: true, excludeBegin: true,
excludeEnd: true excludeEnd: true
}, },
{ {
className: 'type', className: 'type',
begin: /to +/, begin: 'to +',
end: /\W/, end: '\\W',
excludeBegin: true, excludeBegin: true,
excludeEnd: true excludeEnd: true
}, },
@ -130,15 +116,15 @@ function haxe(hljs) {
keywords: { keyword: 'abstract from to' } keywords: { keyword: 'abstract from to' }
}, },
{ {
className: 'title.class', // classes className: 'class', // classes
begin: /\b(class|interface) +/, begin: '\\b(class|interface) +',
end: /[\{$]/, end: '[\\{$]',
excludeEnd: true, excludeEnd: true,
keywords: 'class interface', keywords: 'class interface',
contains: [ contains: [
{ {
className: 'keyword', className: 'keyword',
begin: /\b(extends|implements) +/, begin: '\\b(extends|implements) +',
keywords: 'extends implements', keywords: 'extends implements',
contains: [ contains: [
{ {
@ -152,11 +138,11 @@ function haxe(hljs) {
] ]
}, },
{ {
className: 'title.function', className: 'function',
beginKeywords: 'function', beginKeywords: 'function',
end: /\(/, end: '\\(',
excludeEnd: true, excludeEnd: true,
illegal: /\S/, illegal: '\\S',
contains: [ hljs.TITLE_MODE ] contains: [ hljs.TITLE_MODE ]
} }
], ],

View File

@ -3,7 +3,6 @@ Language: Inform 7
Author: Bruno Dias <bruno.r.dias@gmail.com> Author: Bruno Dias <bruno.r.dias@gmail.com>
Description: Language definition for Inform 7, a DSL for writing parser interactive fiction. Description: Language definition for Inform 7, a DSL for writing parser interactive fiction.
Website: http://inform7.com Website: http://inform7.com
Category: gaming
*/ */
function inform7(hljs) { function inform7(hljs) {

View File

@ -40,7 +40,6 @@ Category: common, enterprise
Website: https://www.java.com/ Website: https://www.java.com/
*/ */
/** /**
* Allows recursive regex expressions to a given depth * Allows recursive regex expressions to a given depth
* *
@ -108,9 +107,7 @@ function java(hljs) {
'do', 'do',
'sealed', 'sealed',
'yield', 'yield',
'permits', 'permits'
'goto',
'when'
]; ];
const BUILT_INS = [ const BUILT_INS = [

View File

@ -40,9 +40,7 @@ const KEYWORDS = [
"import", "import",
"from", "from",
"export", "export",
"extends", "extends"
// It's reached stage 3, which is "recommended for implementation":
"using"
]; ];
const LITERALS = [ const LITERALS = [
"true", "true",
@ -165,7 +163,6 @@ Category: common, scripting, web
Website: https://developer.mozilla.org/en-US/docs/Web/JavaScript Website: https://developer.mozilla.org/en-US/docs/Web/JavaScript
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function javascript(hljs) { function javascript(hljs) {
const regex = hljs.regex; const regex = hljs.regex;
@ -292,7 +289,7 @@ function javascript(hljs) {
contains: [] // defined later contains: [] // defined later
}; };
const HTML_TEMPLATE = { const HTML_TEMPLATE = {
begin: '\.?html`', begin: 'html`',
end: '', end: '',
starts: { starts: {
end: '`', end: '`',
@ -305,7 +302,7 @@ function javascript(hljs) {
} }
}; };
const CSS_TEMPLATE = { const CSS_TEMPLATE = {
begin: '\.?css`', begin: 'css`',
end: '', end: '',
starts: { starts: {
end: '`', end: '`',
@ -318,7 +315,7 @@ function javascript(hljs) {
} }
}; };
const GRAPHQL_TEMPLATE = { const GRAPHQL_TEMPLATE = {
begin: '\.?gql`', begin: 'gql`',
end: '', end: '',
starts: { starts: {
end: '`', end: '`',
@ -415,7 +412,7 @@ function javascript(hljs) {
const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([ const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([
// eat recursive parens in sub expressions // eat recursive parens in sub expressions
{ {
begin: /(\s*)\(/, begin: /\(/,
end: /\)/, end: /\)/,
keywords: KEYWORDS$1, keywords: KEYWORDS$1,
contains: ["self"].concat(SUBST_AND_COMMENTS) contains: ["self"].concat(SUBST_AND_COMMENTS)
@ -423,8 +420,7 @@ function javascript(hljs) {
]); ]);
const PARAMS = { const PARAMS = {
className: 'params', className: 'params',
// convert this to negative lookbehind in v12 begin: /\(/,
begin: /(\s*)\(/, // to match the parms with
end: /\)/, end: /\)/,
excludeBegin: true, excludeBegin: true,
excludeEnd: true, excludeEnd: true,
@ -547,8 +543,8 @@ function javascript(hljs) {
...BUILT_IN_GLOBALS, ...BUILT_IN_GLOBALS,
"super", "super",
"import" "import"
].map(x => `${x}\\s*\\(`)), ]),
IDENT_RE$1, regex.lookahead(/\s*\(/)), IDENT_RE$1, regex.lookahead(/\(/)),
className: "title.function", className: "title.function",
relevance: 0 relevance: 0
}; };
@ -635,8 +631,8 @@ function javascript(hljs) {
NUMBER, NUMBER,
CLASS_REFERENCE, CLASS_REFERENCE,
{ {
scope: 'attr', className: 'attr',
match: IDENT_RE$1 + regex.lookahead(':'), begin: IDENT_RE$1 + regex.lookahead(':'),
relevance: 0 relevance: 0
}, },
FUNCTION_VARIABLE, FUNCTION_VARIABLE,
@ -669,7 +665,7 @@ function javascript(hljs) {
skip: true skip: true
}, },
{ {
begin: /(\s*)\(/, begin: /\(/,
end: /\)/, end: /\)/,
excludeBegin: true, excludeBegin: true,
excludeEnd: true, excludeEnd: true,

View File

@ -34,7 +34,6 @@ function json(hljs) {
return { return {
name: 'JSON', name: 'JSON',
aliases: ['jsonc'],
keywords:{ keywords:{
literal: LITERALS, literal: LITERALS,
}, },

View File

@ -4,7 +4,6 @@ Description: Julia REPL sessions
Author: Morten Piibeleht <morten.piibeleht@gmail.com> Author: Morten Piibeleht <morten.piibeleht@gmail.com>
Website: https://julialang.org Website: https://julialang.org
Requires: julia.js Requires: julia.js
Category: scientific
The Julia REPL code blocks look something like the following: The Julia REPL code blocks look something like the following:

View File

@ -4,7 +4,6 @@ Description: Julia is a high-level, high-performance, dynamic programming langua
Author: Kenta Sato <bicycle1885@gmail.com> Author: Kenta Sato <bicycle1885@gmail.com>
Contributors: Alex Arslan <ararslan@comcast.net>, Fredrik Ekre <ekrefredrik@gmail.com> Contributors: Alex Arslan <ararslan@comcast.net>, Fredrik Ekre <ekrefredrik@gmail.com>
Website: https://julialang.org Website: https://julialang.org
Category: scientific
*/ */
function julia(hljs) { function julia(hljs) {

View File

@ -41,7 +41,6 @@ var NUMERIC = {
Category: common Category: common
*/ */
function kotlin(hljs) { function kotlin(hljs) {
const KEYWORDS = { const KEYWORDS = {
keyword: keyword:

View File

@ -3,7 +3,6 @@ Language: Lasso
Author: Eric Knibbe <eric@lassosoft.com> Author: Eric Knibbe <eric@lassosoft.com>
Description: Lasso is a language and server platform for database-driven web applications. This definition handles Lasso 9 syntax and LassoScript for Lasso 8.6 and earlier. Description: Lasso is a language and server platform for database-driven web applications. This definition handles Lasso 9 syntax and LassoScript for Lasso 8.6 and earlier.
Website: http://www.lassosoft.com/What-Is-Lasso Website: http://www.lassosoft.com/What-Is-Lasso
Category: database, web
*/ */
function lasso(hljs) { function lasso(hljs) {

View File

@ -1,95 +1,47 @@
/* /*
Language: Leaf Language: Leaf
Description: A Swift-based templating language created for the Vapor project. Author: Hale Chan <halechan@qq.com>
Website: https://docs.vapor.codes/leaf/overview Description: Based on the Leaf reference from https://vapor.github.io/documentation/guide/leaf.html.
Category: template
*/ */
function leaf(hljs) { function leaf(hljs) {
const IDENT = /([A-Za-z_][A-Za-z_0-9]*)?/;
const LITERALS = [
'true',
'false',
'in'
];
const PARAMS = {
scope: 'params',
begin: /\(/,
end: /\)(?=\:?)/,
endsParent: true,
relevance: 7,
contains: [
{
scope: 'string',
begin: '"',
end: '"'
},
{
scope: 'keyword',
match: LITERALS.join("|"),
},
{
scope: 'variable',
match: /[A-Za-z_][A-Za-z_0-9]*/
},
{
scope: 'operator',
match: /\+|\-|\*|\/|\%|\=\=|\=|\!|\>|\<|\&\&|\|\|/
}
]
};
const INSIDE_DISPATCH = {
match: [
IDENT,
/(?=\()/,
],
scope: {
1: "keyword"
},
contains: [ PARAMS ]
};
PARAMS.contains.unshift(INSIDE_DISPATCH);
return { return {
name: 'Leaf', name: 'Leaf',
contains: [ contains: [
// #ident():
{ {
match: [ className: 'function',
/#+/, begin: '#+' + '[A-Za-z_0-9]*' + '\\(',
IDENT, end: / \{/,
/(?=\()/, returnBegin: true,
], excludeEnd: true,
scope: {
1: "punctuation",
2: "keyword"
},
// will start up after the ending `)` match from line ~44
// just to grab the trailing `:` if we can match it
starts: {
contains: [
{
match: /\:/,
scope: "punctuation"
}
]
},
contains: [ contains: [
PARAMS {
], className: 'keyword',
}, begin: '#+'
// #ident or #ident: },
{ {
match: [ className: 'title',
/#+/, begin: '[A-Za-z_][A-Za-z_0-9]*'
IDENT, },
/:?/, {
], className: 'params',
scope: { begin: '\\(',
1: "punctuation", end: '\\)',
2: "keyword", endsParent: true,
3: "punctuation" contains: [
} {
}, className: 'string',
begin: '"',
end: '"'
},
{
className: 'variable',
begin: '[A-Za-z_][A-Za-z_0-9]*'
}
]
}
]
}
] ]
}; };
} }

View File

@ -38,12 +38,12 @@ const MODES = (hljs) => {
}, },
CSS_VARIABLE: { CSS_VARIABLE: {
className: "attr", className: "attr",
begin: /--[A-Za-z_][A-Za-z0-9_-]*/ begin: /--[A-Za-z][A-Za-z0-9_-]*/
} }
}; };
}; };
const HTML_TAGS = [ const TAGS = [
'a', 'a',
'abbr', 'abbr',
'address', 'address',
@ -95,16 +95,11 @@ const HTML_TAGS = [
'nav', 'nav',
'object', 'object',
'ol', 'ol',
'optgroup',
'option',
'p', 'p',
'picture',
'q', 'q',
'quote', 'quote',
'samp', 'samp',
'section', 'section',
'select',
'source',
'span', 'span',
'strong', 'strong',
'summary', 'summary',
@ -123,58 +118,6 @@ const HTML_TAGS = [
'video' 'video'
]; ];
const SVG_TAGS = [
'defs',
'g',
'marker',
'mask',
'pattern',
'svg',
'switch',
'symbol',
'feBlend',
'feColorMatrix',
'feComponentTransfer',
'feComposite',
'feConvolveMatrix',
'feDiffuseLighting',
'feDisplacementMap',
'feFlood',
'feGaussianBlur',
'feImage',
'feMerge',
'feMorphology',
'feOffset',
'feSpecularLighting',
'feTile',
'feTurbulence',
'linearGradient',
'radialGradient',
'stop',
'circle',
'ellipse',
'image',
'line',
'path',
'polygon',
'polyline',
'rect',
'text',
'use',
'textPath',
'tspan',
'foreignObject',
'clipPath'
];
const TAGS = [
...HTML_TAGS,
...SVG_TAGS,
];
// Sorting, then reversing makes sure longer attributes/elements like
// `font-weight` are matched fully instead of getting false positives on say `font`
const MEDIA_FEATURES = [ const MEDIA_FEATURES = [
'any-hover', 'any-hover',
'any-pointer', 'any-pointer',
@ -210,7 +153,7 @@ const MEDIA_FEATURES = [
'max-width', 'max-width',
'min-height', 'min-height',
'max-height' 'max-height'
].sort().reverse(); ];
// https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
const PSEUDO_CLASSES = [ const PSEUDO_CLASSES = [
@ -273,7 +216,7 @@ const PSEUDO_CLASSES = [
'valid', 'valid',
'visited', 'visited',
'where' // where() 'where' // where()
].sort().reverse(); ];
// https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements
const PSEUDO_ELEMENTS = [ const PSEUDO_ELEMENTS = [
@ -291,18 +234,14 @@ const PSEUDO_ELEMENTS = [
'selection', 'selection',
'slotted', 'slotted',
'spelling-error' 'spelling-error'
].sort().reverse(); ];
const ATTRIBUTES = [ const ATTRIBUTES = [
'accent-color',
'align-content', 'align-content',
'align-items', 'align-items',
'align-self', 'align-self',
'alignment-baseline',
'all', 'all',
'anchor-name',
'animation', 'animation',
'animation-composition',
'animation-delay', 'animation-delay',
'animation-direction', 'animation-direction',
'animation-duration', 'animation-duration',
@ -310,14 +249,7 @@ const ATTRIBUTES = [
'animation-iteration-count', 'animation-iteration-count',
'animation-name', 'animation-name',
'animation-play-state', 'animation-play-state',
'animation-range',
'animation-range-end',
'animation-range-start',
'animation-timeline',
'animation-timing-function', 'animation-timing-function',
'appearance',
'aspect-ratio',
'backdrop-filter',
'backface-visibility', 'backface-visibility',
'background', 'background',
'background-attachment', 'background-attachment',
@ -327,11 +259,8 @@ const ATTRIBUTES = [
'background-image', 'background-image',
'background-origin', 'background-origin',
'background-position', 'background-position',
'background-position-x',
'background-position-y',
'background-repeat', 'background-repeat',
'background-size', 'background-size',
'baseline-shift',
'block-size', 'block-size',
'border', 'border',
'border-block', 'border-block',
@ -354,8 +283,6 @@ const ATTRIBUTES = [
'border-bottom-width', 'border-bottom-width',
'border-collapse', 'border-collapse',
'border-color', 'border-color',
'border-end-end-radius',
'border-end-start-radius',
'border-image', 'border-image',
'border-image-outset', 'border-image-outset',
'border-image-repeat', 'border-image-repeat',
@ -384,8 +311,6 @@ const ATTRIBUTES = [
'border-right-style', 'border-right-style',
'border-right-width', 'border-right-width',
'border-spacing', 'border-spacing',
'border-start-end-radius',
'border-start-start-radius',
'border-style', 'border-style',
'border-top', 'border-top',
'border-top-color', 'border-top-color',
@ -395,15 +320,7 @@ const ATTRIBUTES = [
'border-top-width', 'border-top-width',
'border-width', 'border-width',
'bottom', 'bottom',
'box-align',
'box-decoration-break', 'box-decoration-break',
'box-direction',
'box-flex',
'box-flex-group',
'box-lines',
'box-ordinal-group',
'box-orient',
'box-pack',
'box-shadow', 'box-shadow',
'box-sizing', 'box-sizing',
'break-after', 'break-after',
@ -416,11 +333,6 @@ const ATTRIBUTES = [
'clip-path', 'clip-path',
'clip-rule', 'clip-rule',
'color', 'color',
'color-interpolation',
'color-interpolation-filters',
'color-profile',
'color-rendering',
'color-scheme',
'column-count', 'column-count',
'column-fill', 'column-fill',
'column-gap', 'column-gap',
@ -432,34 +344,17 @@ const ATTRIBUTES = [
'column-width', 'column-width',
'columns', 'columns',
'contain', 'contain',
'contain-intrinsic-block-size',
'contain-intrinsic-height',
'contain-intrinsic-inline-size',
'contain-intrinsic-size',
'contain-intrinsic-width',
'container',
'container-name',
'container-type',
'content', 'content',
'content-visibility', 'content-visibility',
'counter-increment', 'counter-increment',
'counter-reset', 'counter-reset',
'counter-set',
'cue', 'cue',
'cue-after', 'cue-after',
'cue-before', 'cue-before',
'cursor', 'cursor',
'cx',
'cy',
'direction', 'direction',
'display', 'display',
'dominant-baseline',
'empty-cells', 'empty-cells',
'enable-background',
'field-sizing',
'fill',
'fill-opacity',
'fill-rule',
'filter', 'filter',
'flex', 'flex',
'flex-basis', 'flex-basis',
@ -469,8 +364,6 @@ const ATTRIBUTES = [
'flex-shrink', 'flex-shrink',
'flex-wrap', 'flex-wrap',
'float', 'float',
'flood-color',
'flood-opacity',
'flow', 'flow',
'font', 'font',
'font-display', 'font-display',
@ -478,32 +371,21 @@ const ATTRIBUTES = [
'font-feature-settings', 'font-feature-settings',
'font-kerning', 'font-kerning',
'font-language-override', 'font-language-override',
'font-optical-sizing',
'font-palette',
'font-size', 'font-size',
'font-size-adjust', 'font-size-adjust',
'font-smooth',
'font-smoothing', 'font-smoothing',
'font-stretch', 'font-stretch',
'font-style', 'font-style',
'font-synthesis', 'font-synthesis',
'font-synthesis-position',
'font-synthesis-small-caps',
'font-synthesis-style',
'font-synthesis-weight',
'font-variant', 'font-variant',
'font-variant-alternates',
'font-variant-caps', 'font-variant-caps',
'font-variant-east-asian', 'font-variant-east-asian',
'font-variant-emoji',
'font-variant-ligatures', 'font-variant-ligatures',
'font-variant-numeric', 'font-variant-numeric',
'font-variant-position', 'font-variant-position',
'font-variation-settings', 'font-variation-settings',
'font-weight', 'font-weight',
'forced-color-adjust',
'gap', 'gap',
'glyph-orientation-horizontal',
'glyph-orientation-vertical', 'glyph-orientation-vertical',
'grid', 'grid',
'grid-area', 'grid-area',
@ -523,36 +405,19 @@ const ATTRIBUTES = [
'grid-template-rows', 'grid-template-rows',
'hanging-punctuation', 'hanging-punctuation',
'height', 'height',
'hyphenate-character',
'hyphenate-limit-chars',
'hyphens', 'hyphens',
'icon', 'icon',
'image-orientation', 'image-orientation',
'image-rendering', 'image-rendering',
'image-resolution', 'image-resolution',
'ime-mode', 'ime-mode',
'initial-letter',
'initial-letter-align',
'inline-size', 'inline-size',
'inset',
'inset-area',
'inset-block',
'inset-block-end',
'inset-block-start',
'inset-inline',
'inset-inline-end',
'inset-inline-start',
'isolation', 'isolation',
'justify-content', 'justify-content',
'justify-items',
'justify-self',
'kerning',
'left', 'left',
'letter-spacing', 'letter-spacing',
'lighting-color',
'line-break', 'line-break',
'line-height', 'line-height',
'line-height-step',
'list-style', 'list-style',
'list-style-image', 'list-style-image',
'list-style-position', 'list-style-position',
@ -568,11 +433,6 @@ const ATTRIBUTES = [
'margin-left', 'margin-left',
'margin-right', 'margin-right',
'margin-top', 'margin-top',
'margin-trim',
'marker',
'marker-end',
'marker-mid',
'marker-start',
'marks', 'marks',
'mask', 'mask',
'mask-border', 'mask-border',
@ -591,10 +451,6 @@ const ATTRIBUTES = [
'mask-repeat', 'mask-repeat',
'mask-size', 'mask-size',
'mask-type', 'mask-type',
'masonry-auto-flow',
'math-depth',
'math-shift',
'math-style',
'max-block-size', 'max-block-size',
'max-height', 'max-height',
'max-inline-size', 'max-inline-size',
@ -613,12 +469,6 @@ const ATTRIBUTES = [
'normal', 'normal',
'object-fit', 'object-fit',
'object-position', 'object-position',
'offset',
'offset-anchor',
'offset-distance',
'offset-path',
'offset-position',
'offset-rotate',
'opacity', 'opacity',
'order', 'order',
'orphans', 'orphans',
@ -628,19 +478,9 @@ const ATTRIBUTES = [
'outline-style', 'outline-style',
'outline-width', 'outline-width',
'overflow', 'overflow',
'overflow-anchor',
'overflow-block',
'overflow-clip-margin',
'overflow-inline',
'overflow-wrap', 'overflow-wrap',
'overflow-x', 'overflow-x',
'overflow-y', 'overflow-y',
'overlay',
'overscroll-behavior',
'overscroll-behavior-block',
'overscroll-behavior-inline',
'overscroll-behavior-x',
'overscroll-behavior-y',
'padding', 'padding',
'padding-block', 'padding-block',
'padding-block-end', 'padding-block-end',
@ -652,37 +492,23 @@ const ATTRIBUTES = [
'padding-left', 'padding-left',
'padding-right', 'padding-right',
'padding-top', 'padding-top',
'page',
'page-break-after', 'page-break-after',
'page-break-before', 'page-break-before',
'page-break-inside', 'page-break-inside',
'paint-order',
'pause', 'pause',
'pause-after', 'pause-after',
'pause-before', 'pause-before',
'perspective', 'perspective',
'perspective-origin', 'perspective-origin',
'place-content',
'place-items',
'place-self',
'pointer-events', 'pointer-events',
'position', 'position',
'position-anchor',
'position-visibility',
'print-color-adjust',
'quotes', 'quotes',
'r',
'resize', 'resize',
'rest', 'rest',
'rest-after', 'rest-after',
'rest-before', 'rest-before',
'right', 'right',
'rotate',
'row-gap', 'row-gap',
'ruby-align',
'ruby-position',
'scale',
'scroll-behavior',
'scroll-margin', 'scroll-margin',
'scroll-margin-block', 'scroll-margin-block',
'scroll-margin-block-end', 'scroll-margin-block-end',
@ -708,43 +534,25 @@ const ATTRIBUTES = [
'scroll-snap-align', 'scroll-snap-align',
'scroll-snap-stop', 'scroll-snap-stop',
'scroll-snap-type', 'scroll-snap-type',
'scroll-timeline',
'scroll-timeline-axis',
'scroll-timeline-name',
'scrollbar-color', 'scrollbar-color',
'scrollbar-gutter', 'scrollbar-gutter',
'scrollbar-width', 'scrollbar-width',
'shape-image-threshold', 'shape-image-threshold',
'shape-margin', 'shape-margin',
'shape-outside', 'shape-outside',
'shape-rendering',
'speak', 'speak',
'speak-as', 'speak-as',
'src', // @font-face 'src', // @font-face
'stop-color',
'stop-opacity',
'stroke',
'stroke-dasharray',
'stroke-dashoffset',
'stroke-linecap',
'stroke-linejoin',
'stroke-miterlimit',
'stroke-opacity',
'stroke-width',
'tab-size', 'tab-size',
'table-layout', 'table-layout',
'text-align', 'text-align',
'text-align-all', 'text-align-all',
'text-align-last', 'text-align-last',
'text-anchor',
'text-combine-upright', 'text-combine-upright',
'text-decoration', 'text-decoration',
'text-decoration-color', 'text-decoration-color',
'text-decoration-line', 'text-decoration-line',
'text-decoration-skip',
'text-decoration-skip-ink',
'text-decoration-style', 'text-decoration-style',
'text-decoration-thickness',
'text-emphasis', 'text-emphasis',
'text-emphasis-color', 'text-emphasis-color',
'text-emphasis-position', 'text-emphasis-position',
@ -755,37 +563,20 @@ const ATTRIBUTES = [
'text-overflow', 'text-overflow',
'text-rendering', 'text-rendering',
'text-shadow', 'text-shadow',
'text-size-adjust',
'text-transform', 'text-transform',
'text-underline-offset',
'text-underline-position', 'text-underline-position',
'text-wrap',
'text-wrap-mode',
'text-wrap-style',
'timeline-scope',
'top', 'top',
'touch-action',
'transform', 'transform',
'transform-box', 'transform-box',
'transform-origin', 'transform-origin',
'transform-style', 'transform-style',
'transition', 'transition',
'transition-behavior',
'transition-delay', 'transition-delay',
'transition-duration', 'transition-duration',
'transition-property', 'transition-property',
'transition-timing-function', 'transition-timing-function',
'translate',
'unicode-bidi', 'unicode-bidi',
'user-modify',
'user-select',
'vector-effect',
'vertical-align', 'vertical-align',
'view-timeline',
'view-timeline-axis',
'view-timeline-inset',
'view-timeline-name',
'view-transition-name',
'visibility', 'visibility',
'voice-balance', 'voice-balance',
'voice-duration', 'voice-duration',
@ -796,7 +587,6 @@ const ATTRIBUTES = [
'voice-stress', 'voice-stress',
'voice-volume', 'voice-volume',
'white-space', 'white-space',
'white-space-collapse',
'widows', 'widows',
'width', 'width',
'will-change', 'will-change',
@ -804,14 +594,13 @@ const ATTRIBUTES = [
'word-spacing', 'word-spacing',
'word-wrap', 'word-wrap',
'writing-mode', 'writing-mode',
'x', 'z-index'
'y', // reverse makes sure longer attributes `font-weight` are matched fully
'z-index', // instead of getting false positives on say `font`
'zoom' ].reverse();
].sort().reverse();
// some grammars use them all as a single group // some grammars use them all as a single group
const PSEUDO_SELECTORS = PSEUDO_CLASSES.concat(PSEUDO_ELEMENTS).sort().reverse(); const PSEUDO_SELECTORS = PSEUDO_CLASSES.concat(PSEUDO_ELEMENTS);
/* /*
Language: Less Language: Less
@ -821,7 +610,6 @@ Website: http://lesscss.org
Category: common, css, web Category: common, css, web
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function less(hljs) { function less(hljs) {
const modes = MODES(hljs); const modes = MODES(hljs);

View File

@ -39,9 +39,7 @@ const KEYWORDS = [
"import", "import",
"from", "from",
"export", "export",
"extends", "extends"
// It's reached stage 3, which is "recommended for implementation":
"using"
]; ];
const LITERALS = [ const LITERALS = [
"true", "true",
@ -154,7 +152,6 @@ Website: https://livescript.net
Category: scripting Category: scripting
*/ */
function livescript(hljs) { function livescript(hljs) {
const LIVESCRIPT_BUILT_INS = [ const LIVESCRIPT_BUILT_INS = [
'npm', 'npm',

View File

@ -63,47 +63,44 @@ function llvm(hljs) {
return { return {
name: 'LLVM IR', name: 'LLVM IR',
// TODO: split into different categories of keywords // TODO: split into different categories of keywords
keywords: { keywords:
keyword: 'begin end true false declare define global ' 'begin end true false declare define global '
+ 'constant private linker_private internal ' + 'constant private linker_private internal '
+ 'available_externally linkonce linkonce_odr weak ' + 'available_externally linkonce linkonce_odr weak '
+ 'weak_odr appending dllimport dllexport common ' + 'weak_odr appending dllimport dllexport common '
+ 'default hidden protected extern_weak external ' + 'default hidden protected extern_weak external '
+ 'thread_local zeroinitializer undef null to tail ' + 'thread_local zeroinitializer undef null to tail '
+ 'target triple datalayout volatile nuw nsw nnan ' + 'target triple datalayout volatile nuw nsw nnan '
+ 'ninf nsz arcp fast exact inbounds align ' + 'ninf nsz arcp fast exact inbounds align '
+ 'addrspace section alias module asm sideeffect ' + 'addrspace section alias module asm sideeffect '
+ 'gc dbg linker_private_weak attributes blockaddress ' + 'gc dbg linker_private_weak attributes blockaddress '
+ 'initialexec localdynamic localexec prefix unnamed_addr ' + 'initialexec localdynamic localexec prefix unnamed_addr '
+ 'ccc fastcc coldcc x86_stdcallcc x86_fastcallcc ' + 'ccc fastcc coldcc x86_stdcallcc x86_fastcallcc '
+ 'arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ' + 'arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device '
+ 'ptx_kernel intel_ocl_bicc msp430_intrcc spir_func ' + 'ptx_kernel intel_ocl_bicc msp430_intrcc spir_func '
+ 'spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc ' + 'spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc '
+ 'cc c signext zeroext inreg sret nounwind ' + 'cc c signext zeroext inreg sret nounwind '
+ 'noreturn noalias nocapture byval nest readnone ' + 'noreturn noalias nocapture byval nest readnone '
+ 'readonly inlinehint noinline alwaysinline optsize ssp ' + 'readonly inlinehint noinline alwaysinline optsize ssp '
+ 'sspreq noredzone noimplicitfloat naked builtin cold ' + 'sspreq noredzone noimplicitfloat naked builtin cold '
+ 'nobuiltin noduplicate nonlazybind optnone returns_twice ' + 'nobuiltin noduplicate nonlazybind optnone returns_twice '
+ 'sanitize_address sanitize_memory sanitize_thread sspstrong ' + 'sanitize_address sanitize_memory sanitize_thread sspstrong '
+ 'uwtable returned type opaque eq ne slt sgt ' + 'uwtable returned type opaque eq ne slt sgt '
+ 'sle sge ult ugt ule uge oeq one olt ogt ' + 'sle sge ult ugt ule uge oeq one olt ogt '
+ 'ole oge ord uno ueq une x acq_rel acquire ' + 'ole oge ord uno ueq une x acq_rel acquire '
+ 'alignstack atomic catch cleanup filter inteldialect ' + 'alignstack atomic catch cleanup filter inteldialect '
+ 'max min monotonic nand personality release seq_cst ' + 'max min monotonic nand personality release seq_cst '
+ 'singlethread umax umin unordered xchg add fadd ' + 'singlethread umax umin unordered xchg add fadd '
+ 'sub fsub mul fmul udiv sdiv fdiv urem srem ' + 'sub fsub mul fmul udiv sdiv fdiv urem srem '
+ 'frem shl lshr ashr and or xor icmp fcmp ' + 'frem shl lshr ashr and or xor icmp fcmp '
+ 'phi call trunc zext sext fptrunc fpext uitofp ' + 'phi call trunc zext sext fptrunc fpext uitofp '
+ 'sitofp fptoui fptosi inttoptr ptrtoint bitcast ' + 'sitofp fptoui fptosi inttoptr ptrtoint bitcast '
+ 'addrspacecast select va_arg ret br switch invoke ' + 'addrspacecast select va_arg ret br switch invoke '
+ 'unwind unreachable indirectbr landingpad resume ' + 'unwind unreachable indirectbr landingpad resume '
+ 'malloc alloca free load store getelementptr ' + 'malloc alloca free load store getelementptr '
+ 'extractelement insertelement shufflevector getresult ' + 'extractelement insertelement shufflevector getresult '
+ 'extractvalue insertvalue atomicrmw cmpxchg fence ' + 'extractvalue insertvalue atomicrmw cmpxchg fence '
+ 'argmemonly', + 'argmemonly double',
type: 'void half bfloat float double fp128 x86_fp80 ppc_fp128 '
+ 'x86_amx x86_mmx ptr label token metadata opaque'
},
contains: [ contains: [
TYPE, TYPE,
// this matches "empty comments"... // this matches "empty comments"...

View File

@ -2,7 +2,7 @@
Language: Lua Language: Lua
Description: Lua is a powerful, efficient, lightweight, embeddable scripting language. Description: Lua is a powerful, efficient, lightweight, embeddable scripting language.
Author: Andrew Fedorov <dmmdrs@mail.ru> Author: Andrew Fedorov <dmmdrs@mail.ru>
Category: common, gaming, scripting Category: common, scripting
Website: https://www.lua.org Website: https://www.lua.org
*/ */
@ -27,7 +27,6 @@ function lua(hljs) {
]; ];
return { return {
name: 'Lua', name: 'Lua',
aliases: ['pluto'],
keywords: { keywords: {
$pattern: hljs.UNDERSCORE_IDENT_RE, $pattern: hljs.UNDERSCORE_IDENT_RE,
literal: "true false nil", literal: "true false nil",

View File

@ -3,7 +3,7 @@ Language: Makefile
Author: Ivan Sagalaev <maniac@softwaremaniacs.org> Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
Contributors: Joël Porquet <joel@porquet.org> Contributors: Joël Porquet <joel@porquet.org>
Website: https://www.gnu.org/software/make/manual/html_node/Introduction.html Website: https://www.gnu.org/software/make/manual/html_node/Introduction.html
Category: common, build-system Category: common
*/ */
function makefile(hljs) { function makefile(hljs) {
@ -38,10 +38,7 @@ function makefile(hljs) {
+ 'word wordlist firstword lastword dir notdir suffix basename ' + 'word wordlist firstword lastword dir notdir suffix basename '
+ 'addsuffix addprefix join wildcard realpath abspath error warning ' + 'addsuffix addprefix join wildcard realpath abspath error warning '
+ 'shell origin flavor foreach if or and call eval file value' }, + 'shell origin flavor foreach if or and call eval file value' },
contains: [ contains: [ VARIABLE ]
VARIABLE,
QUOTE_STRING // Added QUOTE_STRING as they can be a part of functions
]
}; };
/* Variable assignment */ /* Variable assignment */
const ASSIGNMENT = { begin: '^' + hljs.UNDERSCORE_IDENT_RE + '\\s*(?=[:+?]?=)' }; const ASSIGNMENT = { begin: '^' + hljs.UNDERSCORE_IDENT_RE + '\\s*(?=[:+?]?=)' };

View File

@ -216,12 +216,6 @@ function markdown(hljs) {
end: '$' end: '$'
}; };
const ENTITY = {
//https://spec.commonmark.org/0.31.2/#entity-references
scope: 'literal',
match: /&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/
};
return { return {
name: 'Markdown', name: 'Markdown',
aliases: [ aliases: [
@ -239,8 +233,7 @@ function markdown(hljs) {
CODE, CODE,
HORIZONTAL_RULE, HORIZONTAL_RULE,
LINK, LINK,
LINK_REFERENCE, LINK_REFERENCE
ENTITY
] ]
}; };
} }

View File

@ -7242,7 +7242,6 @@ Website: https://www.wolfram.com/mathematica/
Category: scientific Category: scientific
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function mathematica(hljs) { function mathematica(hljs) {
const regex = hljs.regex; const regex = hljs.regex;

View File

@ -3,7 +3,6 @@ Language: Mercury
Author: mucaho <mkucko@gmail.com> Author: mucaho <mkucko@gmail.com>
Description: Mercury is a logic/functional programming language which combines the clarity and expressiveness of declarative programming with advanced static analysis and error detection features. Description: Mercury is a logic/functional programming language which combines the clarity and expressiveness of declarative programming with advanced static analysis and error detection features.
Website: https://www.mercurylang.org Website: https://www.mercurylang.org
Category: functional
*/ */
function mercury(hljs) { function mercury(hljs) {

View File

@ -3,7 +3,6 @@ Language: Monkey
Description: Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research. Description: Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.
Author: Arthur Bikmullin <devolonter@gmail.com> Author: Arthur Bikmullin <devolonter@gmail.com>
Website: https://blitzresearch.itch.io/monkey2 Website: https://blitzresearch.itch.io/monkey2
Category: gaming
*/ */
function monkey(hljs) { function monkey(hljs) {

View File

@ -4,7 +4,6 @@
Contributors: Rene Saarsoo <nene@triin.net> Contributors: Rene Saarsoo <nene@triin.net>
Description: Couchbase query language Description: Couchbase query language
Website: https://www.couchbase.com/products/n1ql Website: https://www.couchbase.com/products/n1ql
Category: database
*/ */
function n1ql(hljs) { function n1ql(hljs) {

View File

@ -64,11 +64,9 @@ function nim(hljs) {
"break", "break",
"case", "case",
"cast", "cast",
"concept",
"const", "const",
"continue", "continue",
"converter", "converter",
"defer",
"discard", "discard",
"distinct", "distinct",
"div", "div",

View File

@ -3,369 +3,91 @@ Language: Nix
Author: Domen Kožar <domen@dev.si> Author: Domen Kožar <domen@dev.si>
Description: Nix functional language Description: Nix functional language
Website: http://nixos.org/nix Website: http://nixos.org/nix
Category: system
*/ */
/** @type LanguageFn */
function nix(hljs) { function nix(hljs) {
const regex = hljs.regex;
const KEYWORDS = { const KEYWORDS = {
keyword: [ keyword: [
"assert", "rec",
"else", "with",
"if", "let",
"in", "in",
"inherit", "inherit",
"let", "assert",
"or", "if",
"rec", "else",
"then", "then"
"with",
], ],
literal: [ literal: [
"true", "true",
"false", "false",
"null", "or",
"and",
"null"
], ],
built_in: [ built_in: [
// toplevel builtins "import",
"abort", "abort",
"baseNameOf", "baseNameOf",
"builtins",
"derivation",
"derivationStrict",
"dirOf", "dirOf",
"fetchGit",
"fetchMercurial",
"fetchTarball",
"fetchTree",
"fromTOML",
"import",
"isNull", "isNull",
"builtins",
"map", "map",
"placeholder",
"removeAttrs", "removeAttrs",
"scopedImport",
"throw", "throw",
"toString", "toString",
], "derivation"
]
}; };
const ANTIQUOTE = {
const BUILTINS = { className: 'subst',
scope: 'built_in', begin: /\$\{/,
match: regex.either(...[ end: /\}/,
"abort", keywords: KEYWORDS
"add",
"addDrvOutputDependencies",
"addErrorContext",
"all",
"any",
"appendContext",
"attrNames",
"attrValues",
"baseNameOf",
"bitAnd",
"bitOr",
"bitXor",
"break",
"builtins",
"catAttrs",
"ceil",
"compareVersions",
"concatLists",
"concatMap",
"concatStringsSep",
"convertHash",
"currentSystem",
"currentTime",
"deepSeq",
"derivation",
"derivationStrict",
"dirOf",
"div",
"elem",
"elemAt",
"false",
"fetchGit",
"fetchMercurial",
"fetchTarball",
"fetchTree",
"fetchurl",
"filter",
"filterSource",
"findFile",
"flakeRefToString",
"floor",
"foldl'",
"fromJSON",
"fromTOML",
"functionArgs",
"genList",
"genericClosure",
"getAttr",
"getContext",
"getEnv",
"getFlake",
"groupBy",
"hasAttr",
"hasContext",
"hashFile",
"hashString",
"head",
"import",
"intersectAttrs",
"isAttrs",
"isBool",
"isFloat",
"isFunction",
"isInt",
"isList",
"isNull",
"isPath",
"isString",
"langVersion",
"length",
"lessThan",
"listToAttrs",
"map",
"mapAttrs",
"match",
"mul",
"nixPath",
"nixVersion",
"null",
"parseDrvName",
"parseFlakeRef",
"partition",
"path",
"pathExists",
"placeholder",
"readDir",
"readFile",
"readFileType",
"removeAttrs",
"replaceStrings",
"scopedImport",
"seq",
"sort",
"split",
"splitVersion",
"storeDir",
"storePath",
"stringLength",
"sub",
"substring",
"tail",
"throw",
"toFile",
"toJSON",
"toPath",
"toString",
"toXML",
"trace",
"traceVerbose",
"true",
"tryEval",
"typeOf",
"unsafeDiscardOutputDependency",
"unsafeDiscardStringContext",
"unsafeGetAttrPos",
"warn",
"zipAttrsWith",
].map(b => `builtins\\.${b}`)),
relevance: 10,
}; };
const ESCAPED_DOLLAR = {
const IDENTIFIER_REGEX = '[A-Za-z_][A-Za-z0-9_\'-]*'; className: 'char.escape',
begin: /''\$/,
const LOOKUP_PATH = {
scope: 'symbol',
match: new RegExp(`<${IDENTIFIER_REGEX}(/${IDENTIFIER_REGEX})*>`),
}; };
const PATH_PIECE = "[A-Za-z0-9_\\+\\.-]+";
const PATH = {
scope: 'symbol',
match: new RegExp(`(\\.\\.|\\.|~)?/(${PATH_PIECE})?(/${PATH_PIECE})*(?=[\\s;])`),
};
const OPERATOR_WITHOUT_MINUS_REGEX = regex.either(...[
'==',
'=',
'\\+\\+',
'\\+',
'<=',
'<\\|',
'<',
'>=',
'>',
'->',
'//',
'/',
'!=',
'!',
'\\|\\|',
'\\|>',
'\\?',
'\\*',
'&&',
]);
const OPERATOR = {
scope: 'operator',
match: regex.concat(OPERATOR_WITHOUT_MINUS_REGEX, /(?!-)/),
relevance: 0,
};
// '-' is being handled by itself to ensure we are able to tell the difference
// between a dash in an identifier and a minus operator
const NUMBER = {
scope: 'number',
match: new RegExp(`${hljs.NUMBER_RE}(?!-)`),
relevance: 0,
};
const MINUS_OPERATOR = {
variants: [
{
scope: 'operator',
beforeMatch: /\s/,
// The (?!>) is used to ensure this doesn't collide with the '->' operator
begin: /-(?!>)/,
},
{
begin: [
new RegExp(`${hljs.NUMBER_RE}`),
/-/,
/(?!>)/,
],
beginScope: {
1: 'number',
2: 'operator'
},
},
{
begin: [
OPERATOR_WITHOUT_MINUS_REGEX,
/-/,
/(?!>)/,
],
beginScope: {
1: 'operator',
2: 'operator'
},
},
],
relevance: 0,
};
const ATTRS = { const ATTRS = {
beforeMatch: /(^|\{|;)\s*/, begin: /[a-zA-Z0-9-_]+(\s*=)/,
begin: new RegExp(`${IDENTIFIER_REGEX}(\\.${IDENTIFIER_REGEX})*\\s*=(?!=)`),
returnBegin: true, returnBegin: true,
relevance: 0, relevance: 0,
contains: [ contains: [
{ {
scope: 'attr', className: 'attr',
match: new RegExp(`${IDENTIFIER_REGEX}(\\.${IDENTIFIER_REGEX})*(?=\\s*=)`), begin: /\S+/,
relevance: 0.2, relevance: 0.2
} }
], ]
};
const NORMAL_ESCAPED_DOLLAR = {
scope: 'char.escape',
match: /\\\$/,
};
const INDENTED_ESCAPED_DOLLAR = {
scope: 'char.escape',
match: /''\$/,
};
const ANTIQUOTE = {
scope: 'subst',
begin: /\$\{/,
end: /\}/,
keywords: KEYWORDS,
};
const ESCAPED_DOUBLEQUOTE = {
scope: 'char.escape',
match: /'''/,
};
const ESCAPED_LITERAL = {
scope: 'char.escape',
match: /\\(?!\$)./,
}; };
const STRING = { const STRING = {
scope: 'string', className: 'string',
contains: [ ESCAPED_DOLLAR, ANTIQUOTE ],
variants: [ variants: [
{ {
begin: "''", begin: "''",
end: "''", end: "''"
contains: [
INDENTED_ESCAPED_DOLLAR,
ANTIQUOTE,
ESCAPED_DOUBLEQUOTE,
ESCAPED_LITERAL,
],
}, },
{ {
begin: '"', begin: '"',
end: '"', end: '"'
contains: [ }
NORMAL_ESCAPED_DOLLAR, ]
ANTIQUOTE,
ESCAPED_LITERAL,
],
},
],
}; };
const FUNCTION_PARAMS = {
scope: 'params',
match: new RegExp(`${IDENTIFIER_REGEX}\\s*:(?=\\s)`),
};
const EXPRESSIONS = [ const EXPRESSIONS = [
NUMBER, hljs.NUMBER_MODE,
hljs.HASH_COMMENT_MODE, hljs.HASH_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT(
/\/\*\*(?!\/)/,
/\*\//,
{
subLanguage: 'markdown',
relevance: 0
}
),
BUILTINS,
STRING, STRING,
LOOKUP_PATH, ATTRS
PATH,
FUNCTION_PARAMS,
ATTRS,
MINUS_OPERATOR,
OPERATOR,
]; ];
ANTIQUOTE.contains = EXPRESSIONS; ANTIQUOTE.contains = EXPRESSIONS;
const REPL = [
{
scope: 'meta.prompt',
match: /^nix-repl>(?=\s)/,
relevance: 10,
},
{
scope: 'meta',
beforeMatch: /\s+/,
begin: /:([a-z]+|\?)/,
},
];
return { return {
name: 'Nix', name: 'Nix',
aliases: [ "nixos" ], aliases: [ "nixos" ],
keywords: KEYWORDS, keywords: KEYWORDS,
contains: EXPRESSIONS.concat(REPL), contains: EXPRESSIONS
}; };
} }

View File

@ -3,10 +3,8 @@ Language: NSIS
Description: Nullsoft Scriptable Install System Description: Nullsoft Scriptable Install System
Author: Jan T. Sott <jan.sott@gmail.com> Author: Jan T. Sott <jan.sott@gmail.com>
Website: https://nsis.sourceforge.io/Main_Page Website: https://nsis.sourceforge.io/Main_Page
Category: scripting
*/ */
function nsis(hljs) { function nsis(hljs) {
const regex = hljs.regex; const regex = hljs.regex;
const LANGUAGE_CONSTANTS = [ const LANGUAGE_CONSTANTS = [
@ -114,7 +112,6 @@ function nsis(hljs) {
"addincludedir", "addincludedir",
"addplugindir", "addplugindir",
"appendfile", "appendfile",
"assert",
"cd", "cd",
"define", "define",
"delfile", "delfile",

View File

@ -3,7 +3,6 @@ Language: Oxygene
Author: Carlo Kok <ck@remobjects.com> Author: Carlo Kok <ck@remobjects.com>
Description: Oxygene is built on the foundation of Object Pascal, revamped and extended to be a modern language for the twenty-first century. Description: Oxygene is built on the foundation of Object Pascal, revamped and extended to be a modern language for the twenty-first century.
Website: https://www.elementscompiler.com/elements/default.aspx Website: https://www.elementscompiler.com/elements/default.aspx
Category: build-system
*/ */
function oxygene(hljs) { function oxygene(hljs) {

View File

@ -26,7 +26,6 @@ function perl(hljs) {
'chown', 'chown',
'chr', 'chr',
'chroot', 'chroot',
'class',
'close', 'close',
'closedir', 'closedir',
'connect', 'connect',
@ -56,7 +55,6 @@ function perl(hljs) {
'exit', 'exit',
'exp', 'exp',
'fcntl', 'fcntl',
'field',
'fileno', 'fileno',
'flock', 'flock',
'for', 'for',
@ -116,7 +114,6 @@ function perl(hljs) {
'lt', 'lt',
'ma', 'ma',
'map', 'map',
'method',
'mkdir', 'mkdir',
'msgctl', 'msgctl',
'msgget', 'msgget',
@ -261,45 +258,19 @@ function perl(hljs) {
end: /\}/ end: /\}/
// contains defined later // contains defined later
}; };
const ATTR = { const VAR = { variants: [
scope: 'attr', { begin: /\$\d/ },
match: /\s+:\s*\w+(\s*\(.*?\))?/, { begin: regex.concat(
}; /[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,
const VAR = { // negative look-ahead tries to avoid matching patterns that are not
scope: 'variable', // Perl at all like $ident$, @ident@, etc.
variants: [ `(?![A-Za-z])(?![@$%])`
{ begin: /\$\d/ }, ) },
{ begin: regex.concat( {
/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, begin: /[$%@][^\s\w{]/,
// negative look-ahead tries to avoid matching patterns that are not relevance: 0
// Perl at all like $ident$, @ident@, etc. }
`(?![A-Za-z])(?![@$%])` ] };
)
},
{
// Only $= is a special Perl variable and one can't declare @= or %=.
begin: /[$%@](?!")[^\s\w{=]|\$=/,
relevance: 0
}
],
contains: [ ATTR ],
};
const NUMBER = {
className: 'number',
variants: [
// decimal numbers:
// include the case where a number starts with a dot (eg. .9), and
// the leading 0? avoids mixing the first and second match on 0.x cases
{ match: /0?\.[0-9][0-9_]+\b/ },
// include the special versioned number (eg. v5.38)
{ match: /\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/ },
// non-decimal numbers:
{ match: /\b0[0-7][0-7_]*\b/ },
{ match: /\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/ },
{ match: /\b0b[0-1][0-1_]*\b/ },
],
relevance: 0
};
const STRING_CONTAINS = [ const STRING_CONTAINS = [
hljs.BACKSLASH_ESCAPE, hljs.BACKSLASH_ESCAPE,
SUBST, SUBST,
@ -414,7 +385,11 @@ function perl(hljs) {
} }
] ]
}, },
NUMBER, {
className: 'number',
begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b',
relevance: 0
},
{ // regexp container { // regexp container
begin: '(\\/\\/|' + hljs.RE_STARTERS_RE + '|\\b(split|return|print|reverse|grep)\\b)\\s*', begin: '(\\/\\/|' + hljs.RE_STARTERS_RE + '|\\b(split|return|print|reverse|grep)\\b)\\s*',
keywords: 'split return print reverse grep', keywords: 'split return print reverse grep',
@ -456,19 +431,11 @@ function perl(hljs) {
}, },
{ {
className: 'function', className: 'function',
beginKeywords: 'sub method', beginKeywords: 'sub',
end: '(\\s*\\(.*?\\))?[;{]', end: '(\\s*\\(.*?\\))?[;{]',
excludeEnd: true, excludeEnd: true,
relevance: 5, relevance: 5,
contains: [ hljs.TITLE_MODE, ATTR ] contains: [ hljs.TITLE_MODE ]
},
{
className: 'class',
beginKeywords: 'class',
end: '[;{]',
excludeEnd: true,
relevance: 5,
contains: [ hljs.TITLE_MODE, ATTR, NUMBER ]
}, },
{ {
begin: '-\\w\\b', begin: '-\\w\\b',

View File

@ -14,7 +14,6 @@ Description:
- Function names deliberately are not highlighted. There is no way to tell function - Function names deliberately are not highlighted. There is no way to tell function
call from other constructs, hence we can't highlight _all_ function names. And call from other constructs, hence we can't highlight _all_ function names. And
some names highlighted while others not looks ugly. some names highlighted while others not looks ugly.
Category: database
*/ */
function pgsql(hljs) { function pgsql(hljs) {

View File

@ -22,15 +22,12 @@ function php(hljs) {
const PASCAL_CASE_CLASS_NAME_RE = regex.concat( const PASCAL_CASE_CLASS_NAME_RE = regex.concat(
/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/, /(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,
NOT_PERL_ETC); NOT_PERL_ETC);
const UPCASE_NAME_RE = regex.concat(
/[A-Z]+/,
NOT_PERL_ETC);
const VARIABLE = { const VARIABLE = {
scope: 'variable', scope: 'variable',
match: '\\$+' + IDENT_RE, match: '\\$+' + IDENT_RE,
}; };
const PREPROCESSOR = { const PREPROCESSOR = {
scope: "meta", scope: 'meta',
variants: [ variants: [
{ begin: /<\?php/, relevance: 10 }, // boost for obvious PHP { begin: /<\?php/, relevance: 10 }, // boost for obvious PHP
{ begin: /<\?=/ }, { begin: /<\?=/ },
@ -444,12 +441,7 @@ function php(hljs) {
]; ];
const ATTRIBUTES = { const ATTRIBUTES = {
begin: regex.concat(/#\[\s*\\?/, begin: regex.concat(/#\[\s*/, PASCAL_CASE_CLASS_NAME_RE),
regex.either(
PASCAL_CASE_CLASS_NAME_RE,
UPCASE_NAME_RE
)
),
beginScope: "meta", beginScope: "meta",
end: /]/, end: /]/,
endScope: "meta", endScope: "meta",
@ -479,10 +471,7 @@ function php(hljs) {
...ATTRIBUTE_CONTAINS, ...ATTRIBUTE_CONTAINS,
{ {
scope: 'meta', scope: 'meta',
variants: [ match: PASCAL_CASE_CLASS_NAME_RE
{ match: PASCAL_CASE_CLASS_NAME_RE },
{ match: UPCASE_NAME_RE }
]
} }
] ]
}; };
@ -562,7 +551,6 @@ function php(hljs) {
keywords: KEYWORDS, keywords: KEYWORDS,
contains: [ contains: [
'self', 'self',
ATTRIBUTES,
VARIABLE, VARIABLE,
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON, LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
hljs.C_BLOCK_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE,

View File

@ -4,7 +4,6 @@ Author: Joe Eli McIlvain <joe.eli.mac@gmail.com>
Description: Pony is an open-source, object-oriented, actor-model, Description: Pony is an open-source, object-oriented, actor-model,
capabilities-secure, high performance programming language. capabilities-secure, high performance programming language.
Website: https://www.ponylang.io Website: https://www.ponylang.io
Category: system
*/ */
function pony(hljs) { function pony(hljs) {

View File

@ -4,7 +4,6 @@ Description: PowerShell is a task-based command-line shell and scripting languag
Author: David Mohundro <david@mohundro.com> Author: David Mohundro <david@mohundro.com>
Contributors: Nicholas Blumhardt <nblumhardt@nblumhardt.com>, Victor Zhou <OiCMudkips@users.noreply.github.com>, Nicolas Le Gall <contact@nlegall.fr> Contributors: Nicholas Blumhardt <nblumhardt@nblumhardt.com>, Victor Zhou <OiCMudkips@users.noreply.github.com>, Nicolas Le Gall <contact@nlegall.fr>
Website: https://docs.microsoft.com/en-us/powershell/ Website: https://docs.microsoft.com/en-us/powershell/
Category: scripting
*/ */
function powershell(hljs) { function powershell(hljs) {

View File

@ -3,7 +3,6 @@ Language: Prolog
Description: Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics. Description: Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.
Author: Raivo Laanemets <raivo@infdot.com> Author: Raivo Laanemets <raivo@infdot.com>
Website: https://en.wikipedia.org/wiki/Prolog Website: https://en.wikipedia.org/wiki/Prolog
Category: functional
*/ */
function prolog(hljs) { function prolog(hljs) {

View File

@ -4,7 +4,6 @@ Author: Tristano Ajmone <tajmone@gmail.com>
Description: Syntax highlighting for PureBASIC (v.5.00-5.60). No inline ASM highlighting. (v.1.2, May 2017) Description: Syntax highlighting for PureBASIC (v.5.00-5.60). No inline ASM highlighting. (v.1.2, May 2017)
Credits: I've taken inspiration from the PureBasic language file for GeSHi, created by Gustavo Julio Fiorenza (GuShH). Credits: I've taken inspiration from the PureBasic language file for GeSHi, created by Gustavo Julio Fiorenza (GuShH).
Website: https://www.purebasic.com Website: https://www.purebasic.com
Category: system
*/ */
// Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000; // Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000;

View File

@ -373,8 +373,7 @@ function python(hljs) {
NUMBER, NUMBER,
{ {
// very common convention // very common convention
scope: 'variable.language', begin: /\bself\b/
match: /\bself\b/
}, },
{ {
// eat "if" prior to string so that it won't accidentally be // eat "if" prior to string so that it won't accidentally be
@ -382,7 +381,6 @@ function python(hljs) {
beginKeywords: "if", beginKeywords: "if",
relevance: 0 relevance: 0
}, },
{ match: /\bor\b/, scope: "keyword" },
STRING, STRING,
COMMENT_TYPE, COMMENT_TYPE,
hljs.HASH_COMMENT_MODE, hljs.HASH_COMMENT_MODE,

View File

@ -4,7 +4,6 @@ Description: Q is a vector-based functional paradigm programming language built
(K/Q/Kdb+ from Kx Systems) (K/Q/Kdb+ from Kx Systems)
Author: Sergey Vidyuk <svidyuk@gmail.com> Author: Sergey Vidyuk <svidyuk@gmail.com>
Website: https://kx.com/connect-with-us/developers/ Website: https://kx.com/connect-with-us/developers/
Category: enterprise, functional, database
*/ */
function q(hljs) { function q(hljs) {

View File

@ -6,135 +6,301 @@ Author: Gidi Meir Morris <oss@gidi.io>
Category: functional Category: functional
*/ */
function reasonml(hljs) { function reasonml(hljs) {
const BUILT_IN_TYPES = [ function orReValues(ops) {
"array", return ops
"bool", .map(function(op) {
"bytes", return op
"char", .split('')
"exn|5", .map(function(char) {
"float", return '\\' + char;
"int", })
"int32", .join('');
"int64", })
"list", .join('|');
"lazy_t|5", }
"nativeint|5",
"ref", const RE_IDENT = '~?[a-z$_][0-9a-zA-Z$_]*';
"string", const RE_MODULE_IDENT = '`?[A-Z$_][0-9a-zA-Z$_]*';
"unit",
const RE_PARAM_TYPEPARAM = '\'?[a-z$_][0-9a-z$_]*';
const RE_PARAM_TYPE = '\\s*:\\s*[a-z$_][0-9a-z$_]*(\\(\\s*(' + RE_PARAM_TYPEPARAM + '\\s*(,' + RE_PARAM_TYPEPARAM + '\\s*)*)?\\))?';
const RE_PARAM = RE_IDENT + '(' + RE_PARAM_TYPE + '){0,2}';
const RE_OPERATOR = "(" + orReValues([
'||',
'++',
'**',
'+.',
'*',
'/',
'*.',
'/.',
'...'
]) + "|\\|>|&&|==|===)";
const RE_OPERATOR_SPACED = "\\s+" + RE_OPERATOR + "\\s+";
const KEYWORDS = {
keyword:
'and as asr assert begin class constraint do done downto else end exception external '
+ 'for fun function functor if in include inherit initializer '
+ 'land lazy let lor lsl lsr lxor match method mod module mutable new nonrec '
+ 'object of open or private rec sig struct then to try type val virtual when while with',
built_in:
'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ',
literal:
'true false'
};
const RE_NUMBER = '\\b(0[xX][a-fA-F0-9_]+[Lln]?|'
+ '0[oO][0-7_]+[Lln]?|'
+ '0[bB][01_]+[Lln]?|'
+ '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)';
const NUMBER_MODE = {
className: 'number',
relevance: 0,
variants: [
{ begin: RE_NUMBER },
{ begin: '\\(-' + RE_NUMBER + '\\)' }
]
};
const OPERATOR_MODE = {
className: 'operator',
relevance: 0,
begin: RE_OPERATOR
};
const LIST_CONTENTS_MODES = [
{
className: 'identifier',
relevance: 0,
begin: RE_IDENT
},
OPERATOR_MODE,
NUMBER_MODE
]; ];
const MODULE_ACCESS_CONTENTS = [
hljs.QUOTE_STRING_MODE,
OPERATOR_MODE,
{
className: 'module',
begin: "\\b" + RE_MODULE_IDENT,
returnBegin: true,
relevance: 0,
end: "\.",
contains: [
{
className: 'identifier',
begin: RE_MODULE_IDENT,
relevance: 0
}
]
}
];
const PARAMS_CONTENTS = [
{
className: 'module',
begin: "\\b" + RE_MODULE_IDENT,
returnBegin: true,
end: "\.",
relevance: 0,
contains: [
{
className: 'identifier',
begin: RE_MODULE_IDENT,
relevance: 0
}
]
}
];
const PARAMS_MODE = {
begin: RE_IDENT,
end: '(,|\\n|\\))',
relevance: 0,
contains: [
OPERATOR_MODE,
{
className: 'typing',
begin: ':',
end: '(,|\\n)',
returnBegin: true,
relevance: 0,
contains: PARAMS_CONTENTS
}
]
};
const FUNCTION_BLOCK_MODE = {
className: 'function',
relevance: 0,
keywords: KEYWORDS,
variants: [
{
begin: '\\s(\\(\\.?.*?\\)|' + RE_IDENT + ')\\s*=>',
end: '\\s*=>',
returnBegin: true,
relevance: 0,
contains: [
{
className: 'params',
variants: [
{ begin: RE_IDENT },
{ begin: RE_PARAM },
{ begin: /\(\s*\)/ }
]
}
]
},
{
begin: '\\s\\(\\.?[^;\\|]*\\)\\s*=>',
end: '\\s=>',
returnBegin: true,
relevance: 0,
contains: [
{
className: 'params',
relevance: 0,
variants: [ PARAMS_MODE ]
}
]
},
{ begin: '\\(\\.\\s' + RE_IDENT + '\\)\\s*=>' }
]
};
MODULE_ACCESS_CONTENTS.push(FUNCTION_BLOCK_MODE);
const CONSTRUCTOR_MODE = {
className: 'constructor',
begin: RE_MODULE_IDENT + '\\(',
end: '\\)',
illegal: '\\n',
keywords: KEYWORDS,
contains: [
hljs.QUOTE_STRING_MODE,
OPERATOR_MODE,
{
className: 'params',
begin: '\\b' + RE_IDENT
}
]
};
const PATTERN_MATCH_BLOCK_MODE = {
className: 'pattern-match',
begin: '\\|',
returnBegin: true,
keywords: KEYWORDS,
end: '=>',
relevance: 0,
contains: [
CONSTRUCTOR_MODE,
OPERATOR_MODE,
{
relevance: 0,
className: 'constructor',
begin: RE_MODULE_IDENT
}
]
};
const MODULE_ACCESS_MODE = {
className: 'module-access',
keywords: KEYWORDS,
returnBegin: true,
variants: [
{ begin: "\\b(" + RE_MODULE_IDENT + "\\.)+" + RE_IDENT },
{
begin: "\\b(" + RE_MODULE_IDENT + "\\.)+\\(",
end: "\\)",
returnBegin: true,
contains: [
FUNCTION_BLOCK_MODE,
{
begin: '\\(',
end: '\\)',
relevance: 0,
skip: true
}
].concat(MODULE_ACCESS_CONTENTS)
},
{
begin: "\\b(" + RE_MODULE_IDENT + "\\.)+\\{",
end: /\}/
}
],
contains: MODULE_ACCESS_CONTENTS
};
PARAMS_CONTENTS.push(MODULE_ACCESS_MODE);
return { return {
name: 'ReasonML', name: 'ReasonML',
aliases: [ 're' ], aliases: [ 're' ],
keywords: { keywords: KEYWORDS,
$pattern: /[a-z_]\w*!?/, illegal: '(:-|:=|\\$\\{|\\+=)',
keyword: [
"and",
"as",
"asr",
"assert",
"begin",
"class",
"constraint",
"do",
"done",
"downto",
"else",
"end",
"esfun",
"exception",
"external",
"for",
"fun",
"function",
"functor",
"if",
"in",
"include",
"inherit",
"initializer",
"land",
"lazy",
"let",
"lor",
"lsl",
"lsr",
"lxor",
"mod",
"module",
"mutable",
"new",
"nonrec",
"object",
"of",
"open",
"or",
"pri",
"pub",
"rec",
"sig",
"struct",
"switch",
"then",
"to",
"try",
"type",
"val",
"virtual",
"when",
"while",
"with",
],
built_in: BUILT_IN_TYPES,
literal: ["true", "false"],
},
illegal: /(:-|:=|\$\{|\+=)/,
contains: [ contains: [
hljs.COMMENT('/\\*', '\\*/', { illegal: '^(#,\\/\\/)' }),
{ {
scope: 'literal', className: 'character',
match: /\[(\|\|)?\]|\(\)/, begin: '\'(\\\\[^\']+|[^\'])\'',
illegal: '\\n',
relevance: 0 relevance: 0
}, },
hljs.QUOTE_STRING_MODE,
{
className: 'literal',
begin: '\\(\\)',
relevance: 0
},
{
className: 'literal',
begin: '\\[\\|',
end: '\\|\\]',
relevance: 0,
contains: LIST_CONTENTS_MODES
},
{
className: 'literal',
begin: '\\[',
end: '\\]',
relevance: 0,
contains: LIST_CONTENTS_MODES
},
CONSTRUCTOR_MODE,
{
className: 'operator',
begin: RE_OPERATOR_SPACED,
illegal: '-->',
relevance: 0
},
NUMBER_MODE,
hljs.C_LINE_COMMENT_MODE, hljs.C_LINE_COMMENT_MODE,
hljs.COMMENT(/\/\*/, /\*\//, { illegal: /^(#,\/\/)/ }), PATTERN_MATCH_BLOCK_MODE,
{ /* type variable */ FUNCTION_BLOCK_MODE,
scope: 'symbol',
match: /\'[A-Za-z_](?!\')[\w\']*/
/* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */
},
{ /* polymorphic variant */
scope: 'type',
match: /`[A-Z][\w\']*/
},
{ /* module or constructor */
scope: 'type',
match: /\b[A-Z][\w\']*/,
relevance: 0
},
{ /* don't color identifiers, but safely catch all identifiers with ' */
match: /[a-z_]\w*\'[\w\']*/,
relevance: 0
},
{ {
scope: 'operator', className: 'module-def',
match: /\s+(\|\||\+[\+\.]?|\*[\*\/\.]?|\/[\.]?|\.\.\.|\|>|&&|===?)\s+/, begin: "\\bmodule\\s+" + RE_IDENT + "\\s+" + RE_MODULE_IDENT + "\\s+=\\s+\\{",
relevance: 0 end: /\}/,
}, returnBegin: true,
hljs.inherit(hljs.APOS_STRING_MODE, { keywords: KEYWORDS,
scope: 'string', relevance: 0,
relevance: 0 contains: [
}), {
hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }), className: 'module',
{ relevance: 0,
scope: 'number', begin: RE_MODULE_IDENT
variants: [ },
{ match: /\b0[xX][a-fA-F0-9_]+[Lln]?/ }, {
{ match: /\b0[oO][0-7_]+[Lln]?/ }, begin: /\{/,
{ match: /\b0[bB][01_]+[Lln]?/ }, end: /\}/,
{ match: /\b[0-9][0-9_]*([Lln]|(\.[0-9_]*)?([eE][-+]?[0-9_]+)?)/ }, relevance: 0,
], skip: true
relevance: 0 }
].concat(MODULE_ACCESS_CONTENTS)
}, },
MODULE_ACCESS_MODE
] ]
}; };
} }

View File

@ -3,7 +3,6 @@ Language: MikroTik RouterOS script
Author: Ivan Dementev <ivan_div@mail.ru> Author: Ivan Dementev <ivan_div@mail.ru>
Description: Scripting host provides a way to automate some router maintenance tasks by means of executing user-defined scripts bounded to some event occurrence Description: Scripting host provides a way to automate some router maintenance tasks by means of executing user-defined scripts bounded to some event occurrence
Website: https://wiki.mikrotik.com/wiki/Manual:Scripting Website: https://wiki.mikrotik.com/wiki/Manual:Scripting
Category: scripting
*/ */
// Colors from RouterOS terminal: // Colors from RouterOS terminal:

View File

@ -4,7 +4,7 @@ Description: Ruby is a dynamic, open source programming language with a focus on
Website: https://www.ruby-lang.org/ Website: https://www.ruby-lang.org/
Author: Anton Kovalyov <anton@kovalyov.net> Author: Anton Kovalyov <anton@kovalyov.net>
Contributors: Peter Leonov <gojpeg@yandex.ru>, Vasily Polovnyov <vast@whiteants.net>, Loren Segal <lsegal@soen.ca>, Pascal Hurni <phi@ruby-reactive.org>, Cedric Sohrauer <sohrauer@googlemail.com> Contributors: Peter Leonov <gojpeg@yandex.ru>, Vasily Polovnyov <vast@whiteants.net>, Loren Segal <lsegal@soen.ca>, Pascal Hurni <phi@ruby-reactive.org>, Cedric Sohrauer <sohrauer@googlemail.com>
Category: common, scripting Category: common
*/ */
function ruby(hljs) { function ruby(hljs) {
@ -350,7 +350,7 @@ function ruby(hljs) {
}, },
{ {
className: 'params', className: 'params',
begin: /\|(?!=)/, begin: /\|/,
end: /\|/, end: /\|/,
excludeBegin: true, excludeBegin: true,
excludeEnd: true, excludeEnd: true,

View File

@ -7,22 +7,15 @@ Category: common, system
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function rust(hljs) { function rust(hljs) {
const regex = hljs.regex; const regex = hljs.regex;
// ============================================
// Added to support the r# keyword, which is a raw identifier in Rust.
const RAW_IDENTIFIER = /(r#)?/;
const UNDERSCORE_IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.UNDERSCORE_IDENT_RE);
const IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.IDENT_RE);
// ============================================
const FUNCTION_INVOKE = { const FUNCTION_INVOKE = {
className: "title.function.invoke", className: "title.function.invoke",
relevance: 0, relevance: 0,
begin: regex.concat( begin: regex.concat(
/\b/, /\b/,
/(?!let|for|while|if|else|match\b)/, /(?!let\b)/,
IDENT_RE, hljs.IDENT_RE,
regex.lookahead(/\s*\(/)) regex.lookahead(/\s*\(/))
}; };
const NUMBER_SUFFIX = '([ui](8|16|32|64|128|size)|f(32|64))\?'; const NUMBER_SUFFIX = '([ui](8|16|32|64|128|size)|f(32|64))\?';
@ -71,7 +64,6 @@ function rust(hljs) {
"try", "try",
"type", "type",
"typeof", "typeof",
"union",
"unsafe", "unsafe",
"unsized", "unsized",
"use", "use",
@ -131,7 +123,6 @@ function rust(hljs) {
"debug_assert!", "debug_assert!",
"debug_assert_eq!", "debug_assert_eq!",
"env!", "env!",
"eprintln!",
"panic!", "panic!",
"file!", "file!",
"format!", "format!",
@ -199,26 +190,16 @@ function rust(hljs) {
illegal: null illegal: null
}), }),
{ {
className: 'symbol', className: 'string',
// negative lookahead to avoid matching `'`
begin: /'[a-zA-Z_][a-zA-Z0-9_]*(?!')/
},
{
scope: 'string',
variants: [ variants: [
{ begin: /b?r(#*)"(.|\n)*?"\1(?!#)/ }, { begin: /b?r(#*)"(.|\n)*?"\1(?!#)/ },
{ { begin: /b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/ }
begin: /b?'/,
end: /'/,
contains: [
{
scope: "char.escape",
match: /\\('|\w|x\w{2}|u\w{4}|U\w{8})/
}
]
}
] ]
}, },
{
className: 'symbol',
begin: /'[a-zA-Z_][a-zA-Z0-9_]*/
},
{ {
className: 'number', className: 'number',
variants: [ variants: [
@ -234,7 +215,7 @@ function rust(hljs) {
begin: [ begin: [
/fn/, /fn/,
/\s+/, /\s+/,
UNDERSCORE_IDENT_RE hljs.UNDERSCORE_IDENT_RE
], ],
className: { className: {
1: "keyword", 1: "keyword",
@ -249,10 +230,7 @@ function rust(hljs) {
{ {
className: 'string', className: 'string',
begin: /"/, begin: /"/,
end: /"/, end: /"/
contains: [
hljs.BACKSLASH_ESCAPE
]
} }
] ]
}, },
@ -261,7 +239,7 @@ function rust(hljs) {
/let/, /let/,
/\s+/, /\s+/,
/(?:mut\s+)?/, /(?:mut\s+)?/,
UNDERSCORE_IDENT_RE hljs.UNDERSCORE_IDENT_RE
], ],
className: { className: {
1: "keyword", 1: "keyword",
@ -274,7 +252,7 @@ function rust(hljs) {
begin: [ begin: [
/for/, /for/,
/\s+/, /\s+/,
UNDERSCORE_IDENT_RE, hljs.UNDERSCORE_IDENT_RE,
/\s+/, /\s+/,
/in/ /in/
], ],
@ -288,7 +266,7 @@ function rust(hljs) {
begin: [ begin: [
/type/, /type/,
/\s+/, /\s+/,
UNDERSCORE_IDENT_RE hljs.UNDERSCORE_IDENT_RE
], ],
className: { className: {
1: "keyword", 1: "keyword",
@ -299,7 +277,7 @@ function rust(hljs) {
begin: [ begin: [
/(?:trait|enum|struct|union|impl|for)/, /(?:trait|enum|struct|union|impl|for)/,
/\s+/, /\s+/,
UNDERSCORE_IDENT_RE hljs.UNDERSCORE_IDENT_RE
], ],
className: { className: {
1: "keyword", 1: "keyword",

View File

@ -2,7 +2,6 @@
Language: SAS Language: SAS
Author: Mauricio Caceres <mauricio.caceres.bravo@gmail.com> Author: Mauricio Caceres <mauricio.caceres.bravo@gmail.com>
Description: Syntax Highlighting for SAS Description: Syntax Highlighting for SAS
Category: scientific
*/ */
/** @type LanguageFn */ /** @type LanguageFn */

View File

@ -88,11 +88,7 @@ function scala(hljs) {
excludeBegin: true, excludeBegin: true,
excludeEnd: true, excludeEnd: true,
relevance: 0, relevance: 0,
contains: [ contains: [ TYPE ]
TYPE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
]
}, },
{ {
className: 'params', className: 'params',
@ -101,11 +97,7 @@ function scala(hljs) {
excludeBegin: true, excludeBegin: true,
excludeEnd: true, excludeEnd: true,
relevance: 0, relevance: 0,
contains: [ contains: [ TYPE ]
TYPE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
]
}, },
NAME NAME
] ]
@ -159,34 +151,6 @@ function scala(hljs) {
beginScope: { 2: "keyword", } beginScope: { 2: "keyword", }
}; };
// glob all non-whitespace characters as a "string"
// sourced from https://github.com/scala/docs.scala-lang/pull/2845
const DIRECTIVE_VALUE = {
className: 'string',
begin: /\S+/,
};
// directives
// sourced from https://github.com/scala/docs.scala-lang/pull/2845
const USING_DIRECTIVE = {
begin: [
'//>',
/\s+/,
/using/,
/\s+/,
/\S+/
],
beginScope: {
1: "comment",
3: "keyword",
5: "type"
},
end: /$/,
contains: [
DIRECTIVE_VALUE,
]
};
return { return {
name: 'Scala', name: 'Scala',
keywords: { keywords: {
@ -194,7 +158,6 @@ function scala(hljs) {
keyword: 'type yield lazy override def with val var sealed abstract private trait object if then forSome for while do throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit export enum given transparent' keyword: 'type yield lazy override def with val var sealed abstract private trait object if then forSome for while do throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit export enum given transparent'
}, },
contains: [ contains: [
USING_DIRECTIVE,
hljs.C_LINE_COMMENT_MODE, hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE,
STRING, STRING,

View File

@ -38,12 +38,12 @@ const MODES = (hljs) => {
}, },
CSS_VARIABLE: { CSS_VARIABLE: {
className: "attr", className: "attr",
begin: /--[A-Za-z_][A-Za-z0-9_-]*/ begin: /--[A-Za-z][A-Za-z0-9_-]*/
} }
}; };
}; };
const HTML_TAGS = [ const TAGS = [
'a', 'a',
'abbr', 'abbr',
'address', 'address',
@ -95,16 +95,11 @@ const HTML_TAGS = [
'nav', 'nav',
'object', 'object',
'ol', 'ol',
'optgroup',
'option',
'p', 'p',
'picture',
'q', 'q',
'quote', 'quote',
'samp', 'samp',
'section', 'section',
'select',
'source',
'span', 'span',
'strong', 'strong',
'summary', 'summary',
@ -123,58 +118,6 @@ const HTML_TAGS = [
'video' 'video'
]; ];
const SVG_TAGS = [
'defs',
'g',
'marker',
'mask',
'pattern',
'svg',
'switch',
'symbol',
'feBlend',
'feColorMatrix',
'feComponentTransfer',
'feComposite',
'feConvolveMatrix',
'feDiffuseLighting',
'feDisplacementMap',
'feFlood',
'feGaussianBlur',
'feImage',
'feMerge',
'feMorphology',
'feOffset',
'feSpecularLighting',
'feTile',
'feTurbulence',
'linearGradient',
'radialGradient',
'stop',
'circle',
'ellipse',
'image',
'line',
'path',
'polygon',
'polyline',
'rect',
'text',
'use',
'textPath',
'tspan',
'foreignObject',
'clipPath'
];
const TAGS = [
...HTML_TAGS,
...SVG_TAGS,
];
// Sorting, then reversing makes sure longer attributes/elements like
// `font-weight` are matched fully instead of getting false positives on say `font`
const MEDIA_FEATURES = [ const MEDIA_FEATURES = [
'any-hover', 'any-hover',
'any-pointer', 'any-pointer',
@ -210,7 +153,7 @@ const MEDIA_FEATURES = [
'max-width', 'max-width',
'min-height', 'min-height',
'max-height' 'max-height'
].sort().reverse(); ];
// https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
const PSEUDO_CLASSES = [ const PSEUDO_CLASSES = [
@ -273,7 +216,7 @@ const PSEUDO_CLASSES = [
'valid', 'valid',
'visited', 'visited',
'where' // where() 'where' // where()
].sort().reverse(); ];
// https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements
const PSEUDO_ELEMENTS = [ const PSEUDO_ELEMENTS = [
@ -291,18 +234,14 @@ const PSEUDO_ELEMENTS = [
'selection', 'selection',
'slotted', 'slotted',
'spelling-error' 'spelling-error'
].sort().reverse(); ];
const ATTRIBUTES = [ const ATTRIBUTES = [
'accent-color',
'align-content', 'align-content',
'align-items', 'align-items',
'align-self', 'align-self',
'alignment-baseline',
'all', 'all',
'anchor-name',
'animation', 'animation',
'animation-composition',
'animation-delay', 'animation-delay',
'animation-direction', 'animation-direction',
'animation-duration', 'animation-duration',
@ -310,14 +249,7 @@ const ATTRIBUTES = [
'animation-iteration-count', 'animation-iteration-count',
'animation-name', 'animation-name',
'animation-play-state', 'animation-play-state',
'animation-range',
'animation-range-end',
'animation-range-start',
'animation-timeline',
'animation-timing-function', 'animation-timing-function',
'appearance',
'aspect-ratio',
'backdrop-filter',
'backface-visibility', 'backface-visibility',
'background', 'background',
'background-attachment', 'background-attachment',
@ -327,11 +259,8 @@ const ATTRIBUTES = [
'background-image', 'background-image',
'background-origin', 'background-origin',
'background-position', 'background-position',
'background-position-x',
'background-position-y',
'background-repeat', 'background-repeat',
'background-size', 'background-size',
'baseline-shift',
'block-size', 'block-size',
'border', 'border',
'border-block', 'border-block',
@ -354,8 +283,6 @@ const ATTRIBUTES = [
'border-bottom-width', 'border-bottom-width',
'border-collapse', 'border-collapse',
'border-color', 'border-color',
'border-end-end-radius',
'border-end-start-radius',
'border-image', 'border-image',
'border-image-outset', 'border-image-outset',
'border-image-repeat', 'border-image-repeat',
@ -384,8 +311,6 @@ const ATTRIBUTES = [
'border-right-style', 'border-right-style',
'border-right-width', 'border-right-width',
'border-spacing', 'border-spacing',
'border-start-end-radius',
'border-start-start-radius',
'border-style', 'border-style',
'border-top', 'border-top',
'border-top-color', 'border-top-color',
@ -395,15 +320,7 @@ const ATTRIBUTES = [
'border-top-width', 'border-top-width',
'border-width', 'border-width',
'bottom', 'bottom',
'box-align',
'box-decoration-break', 'box-decoration-break',
'box-direction',
'box-flex',
'box-flex-group',
'box-lines',
'box-ordinal-group',
'box-orient',
'box-pack',
'box-shadow', 'box-shadow',
'box-sizing', 'box-sizing',
'break-after', 'break-after',
@ -416,11 +333,6 @@ const ATTRIBUTES = [
'clip-path', 'clip-path',
'clip-rule', 'clip-rule',
'color', 'color',
'color-interpolation',
'color-interpolation-filters',
'color-profile',
'color-rendering',
'color-scheme',
'column-count', 'column-count',
'column-fill', 'column-fill',
'column-gap', 'column-gap',
@ -432,34 +344,17 @@ const ATTRIBUTES = [
'column-width', 'column-width',
'columns', 'columns',
'contain', 'contain',
'contain-intrinsic-block-size',
'contain-intrinsic-height',
'contain-intrinsic-inline-size',
'contain-intrinsic-size',
'contain-intrinsic-width',
'container',
'container-name',
'container-type',
'content', 'content',
'content-visibility', 'content-visibility',
'counter-increment', 'counter-increment',
'counter-reset', 'counter-reset',
'counter-set',
'cue', 'cue',
'cue-after', 'cue-after',
'cue-before', 'cue-before',
'cursor', 'cursor',
'cx',
'cy',
'direction', 'direction',
'display', 'display',
'dominant-baseline',
'empty-cells', 'empty-cells',
'enable-background',
'field-sizing',
'fill',
'fill-opacity',
'fill-rule',
'filter', 'filter',
'flex', 'flex',
'flex-basis', 'flex-basis',
@ -469,8 +364,6 @@ const ATTRIBUTES = [
'flex-shrink', 'flex-shrink',
'flex-wrap', 'flex-wrap',
'float', 'float',
'flood-color',
'flood-opacity',
'flow', 'flow',
'font', 'font',
'font-display', 'font-display',
@ -478,32 +371,21 @@ const ATTRIBUTES = [
'font-feature-settings', 'font-feature-settings',
'font-kerning', 'font-kerning',
'font-language-override', 'font-language-override',
'font-optical-sizing',
'font-palette',
'font-size', 'font-size',
'font-size-adjust', 'font-size-adjust',
'font-smooth',
'font-smoothing', 'font-smoothing',
'font-stretch', 'font-stretch',
'font-style', 'font-style',
'font-synthesis', 'font-synthesis',
'font-synthesis-position',
'font-synthesis-small-caps',
'font-synthesis-style',
'font-synthesis-weight',
'font-variant', 'font-variant',
'font-variant-alternates',
'font-variant-caps', 'font-variant-caps',
'font-variant-east-asian', 'font-variant-east-asian',
'font-variant-emoji',
'font-variant-ligatures', 'font-variant-ligatures',
'font-variant-numeric', 'font-variant-numeric',
'font-variant-position', 'font-variant-position',
'font-variation-settings', 'font-variation-settings',
'font-weight', 'font-weight',
'forced-color-adjust',
'gap', 'gap',
'glyph-orientation-horizontal',
'glyph-orientation-vertical', 'glyph-orientation-vertical',
'grid', 'grid',
'grid-area', 'grid-area',
@ -523,36 +405,19 @@ const ATTRIBUTES = [
'grid-template-rows', 'grid-template-rows',
'hanging-punctuation', 'hanging-punctuation',
'height', 'height',
'hyphenate-character',
'hyphenate-limit-chars',
'hyphens', 'hyphens',
'icon', 'icon',
'image-orientation', 'image-orientation',
'image-rendering', 'image-rendering',
'image-resolution', 'image-resolution',
'ime-mode', 'ime-mode',
'initial-letter',
'initial-letter-align',
'inline-size', 'inline-size',
'inset',
'inset-area',
'inset-block',
'inset-block-end',
'inset-block-start',
'inset-inline',
'inset-inline-end',
'inset-inline-start',
'isolation', 'isolation',
'justify-content', 'justify-content',
'justify-items',
'justify-self',
'kerning',
'left', 'left',
'letter-spacing', 'letter-spacing',
'lighting-color',
'line-break', 'line-break',
'line-height', 'line-height',
'line-height-step',
'list-style', 'list-style',
'list-style-image', 'list-style-image',
'list-style-position', 'list-style-position',
@ -568,11 +433,6 @@ const ATTRIBUTES = [
'margin-left', 'margin-left',
'margin-right', 'margin-right',
'margin-top', 'margin-top',
'margin-trim',
'marker',
'marker-end',
'marker-mid',
'marker-start',
'marks', 'marks',
'mask', 'mask',
'mask-border', 'mask-border',
@ -591,10 +451,6 @@ const ATTRIBUTES = [
'mask-repeat', 'mask-repeat',
'mask-size', 'mask-size',
'mask-type', 'mask-type',
'masonry-auto-flow',
'math-depth',
'math-shift',
'math-style',
'max-block-size', 'max-block-size',
'max-height', 'max-height',
'max-inline-size', 'max-inline-size',
@ -613,12 +469,6 @@ const ATTRIBUTES = [
'normal', 'normal',
'object-fit', 'object-fit',
'object-position', 'object-position',
'offset',
'offset-anchor',
'offset-distance',
'offset-path',
'offset-position',
'offset-rotate',
'opacity', 'opacity',
'order', 'order',
'orphans', 'orphans',
@ -628,19 +478,9 @@ const ATTRIBUTES = [
'outline-style', 'outline-style',
'outline-width', 'outline-width',
'overflow', 'overflow',
'overflow-anchor',
'overflow-block',
'overflow-clip-margin',
'overflow-inline',
'overflow-wrap', 'overflow-wrap',
'overflow-x', 'overflow-x',
'overflow-y', 'overflow-y',
'overlay',
'overscroll-behavior',
'overscroll-behavior-block',
'overscroll-behavior-inline',
'overscroll-behavior-x',
'overscroll-behavior-y',
'padding', 'padding',
'padding-block', 'padding-block',
'padding-block-end', 'padding-block-end',
@ -652,37 +492,23 @@ const ATTRIBUTES = [
'padding-left', 'padding-left',
'padding-right', 'padding-right',
'padding-top', 'padding-top',
'page',
'page-break-after', 'page-break-after',
'page-break-before', 'page-break-before',
'page-break-inside', 'page-break-inside',
'paint-order',
'pause', 'pause',
'pause-after', 'pause-after',
'pause-before', 'pause-before',
'perspective', 'perspective',
'perspective-origin', 'perspective-origin',
'place-content',
'place-items',
'place-self',
'pointer-events', 'pointer-events',
'position', 'position',
'position-anchor',
'position-visibility',
'print-color-adjust',
'quotes', 'quotes',
'r',
'resize', 'resize',
'rest', 'rest',
'rest-after', 'rest-after',
'rest-before', 'rest-before',
'right', 'right',
'rotate',
'row-gap', 'row-gap',
'ruby-align',
'ruby-position',
'scale',
'scroll-behavior',
'scroll-margin', 'scroll-margin',
'scroll-margin-block', 'scroll-margin-block',
'scroll-margin-block-end', 'scroll-margin-block-end',
@ -708,43 +534,25 @@ const ATTRIBUTES = [
'scroll-snap-align', 'scroll-snap-align',
'scroll-snap-stop', 'scroll-snap-stop',
'scroll-snap-type', 'scroll-snap-type',
'scroll-timeline',
'scroll-timeline-axis',
'scroll-timeline-name',
'scrollbar-color', 'scrollbar-color',
'scrollbar-gutter', 'scrollbar-gutter',
'scrollbar-width', 'scrollbar-width',
'shape-image-threshold', 'shape-image-threshold',
'shape-margin', 'shape-margin',
'shape-outside', 'shape-outside',
'shape-rendering',
'speak', 'speak',
'speak-as', 'speak-as',
'src', // @font-face 'src', // @font-face
'stop-color',
'stop-opacity',
'stroke',
'stroke-dasharray',
'stroke-dashoffset',
'stroke-linecap',
'stroke-linejoin',
'stroke-miterlimit',
'stroke-opacity',
'stroke-width',
'tab-size', 'tab-size',
'table-layout', 'table-layout',
'text-align', 'text-align',
'text-align-all', 'text-align-all',
'text-align-last', 'text-align-last',
'text-anchor',
'text-combine-upright', 'text-combine-upright',
'text-decoration', 'text-decoration',
'text-decoration-color', 'text-decoration-color',
'text-decoration-line', 'text-decoration-line',
'text-decoration-skip',
'text-decoration-skip-ink',
'text-decoration-style', 'text-decoration-style',
'text-decoration-thickness',
'text-emphasis', 'text-emphasis',
'text-emphasis-color', 'text-emphasis-color',
'text-emphasis-position', 'text-emphasis-position',
@ -755,37 +563,20 @@ const ATTRIBUTES = [
'text-overflow', 'text-overflow',
'text-rendering', 'text-rendering',
'text-shadow', 'text-shadow',
'text-size-adjust',
'text-transform', 'text-transform',
'text-underline-offset',
'text-underline-position', 'text-underline-position',
'text-wrap',
'text-wrap-mode',
'text-wrap-style',
'timeline-scope',
'top', 'top',
'touch-action',
'transform', 'transform',
'transform-box', 'transform-box',
'transform-origin', 'transform-origin',
'transform-style', 'transform-style',
'transition', 'transition',
'transition-behavior',
'transition-delay', 'transition-delay',
'transition-duration', 'transition-duration',
'transition-property', 'transition-property',
'transition-timing-function', 'transition-timing-function',
'translate',
'unicode-bidi', 'unicode-bidi',
'user-modify',
'user-select',
'vector-effect',
'vertical-align', 'vertical-align',
'view-timeline',
'view-timeline-axis',
'view-timeline-inset',
'view-timeline-name',
'view-transition-name',
'visibility', 'visibility',
'voice-balance', 'voice-balance',
'voice-duration', 'voice-duration',
@ -796,7 +587,6 @@ const ATTRIBUTES = [
'voice-stress', 'voice-stress',
'voice-volume', 'voice-volume',
'white-space', 'white-space',
'white-space-collapse',
'widows', 'widows',
'width', 'width',
'will-change', 'will-change',
@ -804,11 +594,10 @@ const ATTRIBUTES = [
'word-spacing', 'word-spacing',
'word-wrap', 'word-wrap',
'writing-mode', 'writing-mode',
'x', 'z-index'
'y', // reverse makes sure longer attributes `font-weight` are matched fully
'z-index', // instead of getting false positives on say `font`
'zoom' ].reverse();
].sort().reverse();
/* /*
Language: SCSS Language: SCSS
@ -818,7 +607,6 @@ Website: https://sass-lang.com
Category: common, css, web Category: common, css, web
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function scss(hljs) { function scss(hljs) {
const modes = MODES(hljs); const modes = MODES(hljs);

View File

@ -3,7 +3,6 @@ Language: Smali
Author: Dennis Titze <dennis.titze@gmail.com> Author: Dennis Titze <dennis.titze@gmail.com>
Description: Basic Smali highlighting Description: Basic Smali highlighting
Website: https://github.com/JesusFreke/smali Website: https://github.com/JesusFreke/smali
Category: assembler
*/ */
function smali(hljs) { function smali(hljs) {

View File

@ -3,7 +3,6 @@ Language: Smalltalk
Description: Smalltalk is an object-oriented, dynamically typed reflective programming language. Description: Smalltalk is an object-oriented, dynamically typed reflective programming language.
Author: Vladimir Gubarkov <xonixx@gmail.com> Author: Vladimir Gubarkov <xonixx@gmail.com>
Website: https://en.wikipedia.org/wiki/Smalltalk Website: https://en.wikipedia.org/wiki/Smalltalk
Category: system
*/ */
function smalltalk(hljs) { function smalltalk(hljs) {

View File

@ -24,19 +24,19 @@ function sql(hljs) {
const regex = hljs.regex; const regex = hljs.regex;
const COMMENT_MODE = hljs.COMMENT('--', '$'); const COMMENT_MODE = hljs.COMMENT('--', '$');
const STRING = { const STRING = {
scope: 'string', className: 'string',
variants: [ variants: [
{ {
begin: /'/, begin: /'/,
end: /'/, end: /'/,
contains: [ { match: /''/ } ] contains: [ { begin: /''/ } ]
} }
] ]
}; };
const QUOTED_IDENTIFIER = { const QUOTED_IDENTIFIER = {
begin: /"/, begin: /"/,
end: /"/, end: /"/,
contains: [ { match: /""/ } ] contains: [ { begin: /""/ } ]
}; };
const LITERALS = [ const LITERALS = [
@ -606,42 +606,22 @@ function sql(hljs) {
}); });
const VARIABLE = { const VARIABLE = {
scope: "variable", className: "variable",
match: /@[a-z0-9][a-z0-9_]*/, begin: /@[a-z0-9][a-z0-9_]*/,
}; };
const OPERATOR = { const OPERATOR = {
scope: "operator", className: "operator",
match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/, begin: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
relevance: 0, relevance: 0,
}; };
const FUNCTION_CALL = { const FUNCTION_CALL = {
match: regex.concat(/\b/, regex.either(...FUNCTIONS), /\s*\(/), begin: regex.concat(/\b/, regex.either(...FUNCTIONS), /\s*\(/),
relevance: 0, relevance: 0,
keywords: { built_in: FUNCTIONS } keywords: { built_in: FUNCTIONS }
}; };
// turns a multi-word keyword combo into a regex that doesn't
// care about extra whitespace etc.
// input: "START QUERY"
// output: /\bSTART\s+QUERY\b/
function kws_to_regex(list) {
return regex.concat(
/\b/,
regex.either(...list.map((kw) => {
return kw.replace(/\s+/, "\\s+")
})),
/\b/
)
}
const MULTI_WORD_KEYWORDS = {
scope: "keyword",
match: kws_to_regex(COMBOS),
relevance: 0,
};
// keywords with less than 3 letters are reduced in relevancy // keywords with less than 3 letters are reduced in relevancy
function reduceRelevancy(list, { function reduceRelevancy(list, {
exceptions, when exceptions, when
@ -674,10 +654,19 @@ function sql(hljs) {
}, },
contains: [ contains: [
{ {
scope: "type", begin: regex.either(...COMBOS),
match: kws_to_regex(MULTI_WORD_TYPES) relevance: 0,
keywords: {
$pattern: /[\w\.]+/,
keyword: KEYWORDS.concat(COMBOS),
literal: LITERALS,
type: TYPES
},
},
{
className: "type",
begin: regex.either(...MULTI_WORD_TYPES)
}, },
MULTI_WORD_KEYWORDS,
FUNCTION_CALL, FUNCTION_CALL,
VARIABLE, VARIABLE,
STRING, STRING,

View File

@ -32,20 +32,16 @@ function stan(hljs) {
const TYPES = [ const TYPES = [
'array', 'array',
'tuple',
'complex', 'complex',
'int', 'int',
'real', 'real',
'vector', 'vector',
'complex_vector',
'ordered', 'ordered',
'positive_ordered', 'positive_ordered',
'simplex', 'simplex',
'unit_vector', 'unit_vector',
'row_vector', 'row_vector',
'complex_row_vector',
'matrix', 'matrix',
'complex_matrix',
'cholesky_factor_corr|10', 'cholesky_factor_corr|10',
'cholesky_factor_cov|10', 'cholesky_factor_cov|10',
'corr_matrix|10', 'corr_matrix|10',
@ -62,6 +58,8 @@ function stan(hljs) {
// functions_quoted.txt // functions_quoted.txt
const FUNCTIONS = [ const FUNCTIONS = [
'Phi',
'Phi_approx',
'abs', 'abs',
'acos', 'acos',
'acosh', 'acosh',
@ -79,6 +77,7 @@ function stan(hljs) {
'bessel_first_kind', 'bessel_first_kind',
'bessel_second_kind', 'bessel_second_kind',
'binary_log_loss', 'binary_log_loss',
'binomial_coefficient_log',
'block', 'block',
'cbrt', 'cbrt',
'ceil', 'ceil',
@ -89,48 +88,37 @@ function stan(hljs) {
'cols', 'cols',
'columns_dot_product', 'columns_dot_product',
'columns_dot_self', 'columns_dot_self',
'complex_schur_decompose',
'complex_schur_decompose_t',
'complex_schur_decompose_u',
'conj', 'conj',
'cos', 'cos',
'cosh', 'cosh',
'cov_exp_quad', 'cov_exp_quad',
'crossprod', 'crossprod',
'csr_extract',
'csr_extract_u', 'csr_extract_u',
'csr_extract_v', 'csr_extract_v',
'csr_extract_w', 'csr_extract_w',
'csr_matrix_times_vector', 'csr_matrix_times_vector',
'csr_to_dense_matrix', 'csr_to_dense_matrix',
'cumulative_sum', 'cumulative_sum',
'dae',
'dae_tol',
'determinant', 'determinant',
'diag_matrix', 'diag_matrix',
'diagonal',
'diag_post_multiply', 'diag_post_multiply',
'diag_pre_multiply', 'diag_pre_multiply',
'diagonal',
'digamma', 'digamma',
'dims', 'dims',
'distance', 'distance',
'dot_product', 'dot_product',
'dot_self', 'dot_self',
'eigendecompose',
'eigendecompose_sym',
'eigenvalues',
'eigenvalues_sym', 'eigenvalues_sym',
'eigenvectors',
'eigenvectors_sym', 'eigenvectors_sym',
'erf', 'erf',
'erfc', 'erfc',
'exp', 'exp',
'exp2', 'exp2',
'expm1', 'expm1',
'fabs',
'falling_factorial', 'falling_factorial',
'fdim', 'fdim',
'fft',
'fft2',
'floor', 'floor',
'fma', 'fma',
'fmax', 'fmax',
@ -140,6 +128,7 @@ function stan(hljs) {
'gamma_q', 'gamma_q',
'generalized_inverse', 'generalized_inverse',
'get_imag', 'get_imag',
'get_lp',
'get_real', 'get_real',
'head', 'head',
'hmm_hidden_state_prob', 'hmm_hidden_state_prob',
@ -147,24 +136,20 @@ function stan(hljs) {
'hypot', 'hypot',
'identity_matrix', 'identity_matrix',
'inc_beta', 'inc_beta',
'int_step',
'integrate_1d', 'integrate_1d',
'integrate_ode', 'integrate_ode',
'integrate_ode_adams', 'integrate_ode_adams',
'integrate_ode_bdf', 'integrate_ode_bdf',
'integrate_ode_rk45', 'integrate_ode_rk45',
'int_step',
'inv', 'inv',
'inv_cloglog',
'inv_erfc',
'inverse',
'inverse_spd',
'inv_fft',
'inv_fft2',
'inv_inc_beta',
'inv_logit',
'inv_Phi', 'inv_Phi',
'inv_cloglog',
'inv_logit',
'inv_sqrt', 'inv_sqrt',
'inv_square', 'inv_square',
'inverse',
'inverse_spd',
'is_inf', 'is_inf',
'is_nan', 'is_nan',
'lambert_w0', 'lambert_w0',
@ -190,12 +175,12 @@ function stan(hljs) {
'log_falling_factorial', 'log_falling_factorial',
'log_inv_logit', 'log_inv_logit',
'log_inv_logit_diff', 'log_inv_logit_diff',
'logit',
'log_mix', 'log_mix',
'log_modified_bessel_first_kind', 'log_modified_bessel_first_kind',
'log_rising_factorial', 'log_rising_factorial',
'log_softmax', 'log_softmax',
'log_sum_exp', 'log_sum_exp',
'logit',
'machine_precision', 'machine_precision',
'map_rect', 'map_rect',
'matrix_exp', 'matrix_exp',
@ -210,11 +195,10 @@ function stan(hljs) {
'min', 'min',
'modified_bessel_first_kind', 'modified_bessel_first_kind',
'modified_bessel_second_kind', 'modified_bessel_second_kind',
'multiply_log',
'multiply_lower_tri_self_transpose', 'multiply_lower_tri_self_transpose',
'negative_infinity', 'negative_infinity',
'norm', 'norm',
'norm1',
'norm2',
'not_a_number', 'not_a_number',
'num_elements', 'num_elements',
'ode_adams', 'ode_adams',
@ -235,18 +219,14 @@ function stan(hljs) {
'ones_row_vector', 'ones_row_vector',
'ones_vector', 'ones_vector',
'owens_t', 'owens_t',
'Phi',
'Phi_approx',
'polar', 'polar',
'positive_infinity', 'positive_infinity',
'pow', 'pow',
'print', 'print',
'prod', 'prod',
'proj', 'proj',
'qr',
'qr_Q', 'qr_Q',
'qr_R', 'qr_R',
'qr_thin',
'qr_thin_Q', 'qr_thin_Q',
'qr_thin_R', 'qr_thin_R',
'quad_form', 'quad_form',
@ -286,7 +266,6 @@ function stan(hljs) {
'sub_col', 'sub_col',
'sub_row', 'sub_row',
'sum', 'sum',
'svd',
'svd_U', 'svd_U',
'svd_V', 'svd_V',
'symmetrize_from_lower_tri', 'symmetrize_from_lower_tri',
@ -299,7 +278,6 @@ function stan(hljs) {
'to_array_1d', 'to_array_1d',
'to_array_2d', 'to_array_2d',
'to_complex', 'to_complex',
'to_int',
'to_matrix', 'to_matrix',
'to_row_vector', 'to_row_vector',
'to_vector', 'to_vector',
@ -343,22 +321,18 @@ function stan(hljs) {
'inv_chi_square', 'inv_chi_square',
'inv_gamma', 'inv_gamma',
'inv_wishart', 'inv_wishart',
'inv_wishart_cholesky',
'lkj_corr', 'lkj_corr',
'lkj_corr_cholesky', 'lkj_corr_cholesky',
'logistic', 'logistic',
'loglogistic',
'lognormal', 'lognormal',
'multi_gp', 'multi_gp',
'multi_gp_cholesky', 'multi_gp_cholesky',
'multinomial',
'multinomial_logit',
'multi_normal', 'multi_normal',
'multi_normal_cholesky', 'multi_normal_cholesky',
'multi_normal_prec', 'multi_normal_prec',
'multi_student_cholesky_t',
'multi_student_t', 'multi_student_t',
'multi_student_t_cholesky', 'multinomial',
'multinomial_logit',
'neg_binomial', 'neg_binomial',
'neg_binomial_2', 'neg_binomial_2',
'neg_binomial_2_log', 'neg_binomial_2_log',
@ -378,14 +352,12 @@ function stan(hljs) {
'skew_double_exponential', 'skew_double_exponential',
'skew_normal', 'skew_normal',
'std_normal', 'std_normal',
'std_normal_log',
'student_t', 'student_t',
'uniform', 'uniform',
'von_mises', 'von_mises',
'weibull', 'weibull',
'wiener', 'wiener',
'wishart', 'wishart'
'wishart_cholesky'
]; ];
const BLOCK_COMMENT = hljs.COMMENT( const BLOCK_COMMENT = hljs.COMMENT(

View File

@ -3,7 +3,6 @@ Language: STEP Part 21
Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com> Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com>
Description: Syntax highlighter for STEP Part 21 files (ISO 10303-21). Description: Syntax highlighter for STEP Part 21 files (ISO 10303-21).
Website: https://en.wikipedia.org/wiki/ISO_10303-21 Website: https://en.wikipedia.org/wiki/ISO_10303-21
Category: syntax
*/ */
function step21(hljs) { function step21(hljs) {

View File

@ -38,12 +38,12 @@ const MODES = (hljs) => {
}, },
CSS_VARIABLE: { CSS_VARIABLE: {
className: "attr", className: "attr",
begin: /--[A-Za-z_][A-Za-z0-9_-]*/ begin: /--[A-Za-z][A-Za-z0-9_-]*/
} }
}; };
}; };
const HTML_TAGS = [ const TAGS = [
'a', 'a',
'abbr', 'abbr',
'address', 'address',
@ -95,16 +95,11 @@ const HTML_TAGS = [
'nav', 'nav',
'object', 'object',
'ol', 'ol',
'optgroup',
'option',
'p', 'p',
'picture',
'q', 'q',
'quote', 'quote',
'samp', 'samp',
'section', 'section',
'select',
'source',
'span', 'span',
'strong', 'strong',
'summary', 'summary',
@ -123,58 +118,6 @@ const HTML_TAGS = [
'video' 'video'
]; ];
const SVG_TAGS = [
'defs',
'g',
'marker',
'mask',
'pattern',
'svg',
'switch',
'symbol',
'feBlend',
'feColorMatrix',
'feComponentTransfer',
'feComposite',
'feConvolveMatrix',
'feDiffuseLighting',
'feDisplacementMap',
'feFlood',
'feGaussianBlur',
'feImage',
'feMerge',
'feMorphology',
'feOffset',
'feSpecularLighting',
'feTile',
'feTurbulence',
'linearGradient',
'radialGradient',
'stop',
'circle',
'ellipse',
'image',
'line',
'path',
'polygon',
'polyline',
'rect',
'text',
'use',
'textPath',
'tspan',
'foreignObject',
'clipPath'
];
const TAGS = [
...HTML_TAGS,
...SVG_TAGS,
];
// Sorting, then reversing makes sure longer attributes/elements like
// `font-weight` are matched fully instead of getting false positives on say `font`
const MEDIA_FEATURES = [ const MEDIA_FEATURES = [
'any-hover', 'any-hover',
'any-pointer', 'any-pointer',
@ -210,7 +153,7 @@ const MEDIA_FEATURES = [
'max-width', 'max-width',
'min-height', 'min-height',
'max-height' 'max-height'
].sort().reverse(); ];
// https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
const PSEUDO_CLASSES = [ const PSEUDO_CLASSES = [
@ -273,7 +216,7 @@ const PSEUDO_CLASSES = [
'valid', 'valid',
'visited', 'visited',
'where' // where() 'where' // where()
].sort().reverse(); ];
// https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements
const PSEUDO_ELEMENTS = [ const PSEUDO_ELEMENTS = [
@ -291,18 +234,14 @@ const PSEUDO_ELEMENTS = [
'selection', 'selection',
'slotted', 'slotted',
'spelling-error' 'spelling-error'
].sort().reverse(); ];
const ATTRIBUTES = [ const ATTRIBUTES = [
'accent-color',
'align-content', 'align-content',
'align-items', 'align-items',
'align-self', 'align-self',
'alignment-baseline',
'all', 'all',
'anchor-name',
'animation', 'animation',
'animation-composition',
'animation-delay', 'animation-delay',
'animation-direction', 'animation-direction',
'animation-duration', 'animation-duration',
@ -310,14 +249,7 @@ const ATTRIBUTES = [
'animation-iteration-count', 'animation-iteration-count',
'animation-name', 'animation-name',
'animation-play-state', 'animation-play-state',
'animation-range',
'animation-range-end',
'animation-range-start',
'animation-timeline',
'animation-timing-function', 'animation-timing-function',
'appearance',
'aspect-ratio',
'backdrop-filter',
'backface-visibility', 'backface-visibility',
'background', 'background',
'background-attachment', 'background-attachment',
@ -327,11 +259,8 @@ const ATTRIBUTES = [
'background-image', 'background-image',
'background-origin', 'background-origin',
'background-position', 'background-position',
'background-position-x',
'background-position-y',
'background-repeat', 'background-repeat',
'background-size', 'background-size',
'baseline-shift',
'block-size', 'block-size',
'border', 'border',
'border-block', 'border-block',
@ -354,8 +283,6 @@ const ATTRIBUTES = [
'border-bottom-width', 'border-bottom-width',
'border-collapse', 'border-collapse',
'border-color', 'border-color',
'border-end-end-radius',
'border-end-start-radius',
'border-image', 'border-image',
'border-image-outset', 'border-image-outset',
'border-image-repeat', 'border-image-repeat',
@ -384,8 +311,6 @@ const ATTRIBUTES = [
'border-right-style', 'border-right-style',
'border-right-width', 'border-right-width',
'border-spacing', 'border-spacing',
'border-start-end-radius',
'border-start-start-radius',
'border-style', 'border-style',
'border-top', 'border-top',
'border-top-color', 'border-top-color',
@ -395,15 +320,7 @@ const ATTRIBUTES = [
'border-top-width', 'border-top-width',
'border-width', 'border-width',
'bottom', 'bottom',
'box-align',
'box-decoration-break', 'box-decoration-break',
'box-direction',
'box-flex',
'box-flex-group',
'box-lines',
'box-ordinal-group',
'box-orient',
'box-pack',
'box-shadow', 'box-shadow',
'box-sizing', 'box-sizing',
'break-after', 'break-after',
@ -416,11 +333,6 @@ const ATTRIBUTES = [
'clip-path', 'clip-path',
'clip-rule', 'clip-rule',
'color', 'color',
'color-interpolation',
'color-interpolation-filters',
'color-profile',
'color-rendering',
'color-scheme',
'column-count', 'column-count',
'column-fill', 'column-fill',
'column-gap', 'column-gap',
@ -432,34 +344,17 @@ const ATTRIBUTES = [
'column-width', 'column-width',
'columns', 'columns',
'contain', 'contain',
'contain-intrinsic-block-size',
'contain-intrinsic-height',
'contain-intrinsic-inline-size',
'contain-intrinsic-size',
'contain-intrinsic-width',
'container',
'container-name',
'container-type',
'content', 'content',
'content-visibility', 'content-visibility',
'counter-increment', 'counter-increment',
'counter-reset', 'counter-reset',
'counter-set',
'cue', 'cue',
'cue-after', 'cue-after',
'cue-before', 'cue-before',
'cursor', 'cursor',
'cx',
'cy',
'direction', 'direction',
'display', 'display',
'dominant-baseline',
'empty-cells', 'empty-cells',
'enable-background',
'field-sizing',
'fill',
'fill-opacity',
'fill-rule',
'filter', 'filter',
'flex', 'flex',
'flex-basis', 'flex-basis',
@ -469,8 +364,6 @@ const ATTRIBUTES = [
'flex-shrink', 'flex-shrink',
'flex-wrap', 'flex-wrap',
'float', 'float',
'flood-color',
'flood-opacity',
'flow', 'flow',
'font', 'font',
'font-display', 'font-display',
@ -478,32 +371,21 @@ const ATTRIBUTES = [
'font-feature-settings', 'font-feature-settings',
'font-kerning', 'font-kerning',
'font-language-override', 'font-language-override',
'font-optical-sizing',
'font-palette',
'font-size', 'font-size',
'font-size-adjust', 'font-size-adjust',
'font-smooth',
'font-smoothing', 'font-smoothing',
'font-stretch', 'font-stretch',
'font-style', 'font-style',
'font-synthesis', 'font-synthesis',
'font-synthesis-position',
'font-synthesis-small-caps',
'font-synthesis-style',
'font-synthesis-weight',
'font-variant', 'font-variant',
'font-variant-alternates',
'font-variant-caps', 'font-variant-caps',
'font-variant-east-asian', 'font-variant-east-asian',
'font-variant-emoji',
'font-variant-ligatures', 'font-variant-ligatures',
'font-variant-numeric', 'font-variant-numeric',
'font-variant-position', 'font-variant-position',
'font-variation-settings', 'font-variation-settings',
'font-weight', 'font-weight',
'forced-color-adjust',
'gap', 'gap',
'glyph-orientation-horizontal',
'glyph-orientation-vertical', 'glyph-orientation-vertical',
'grid', 'grid',
'grid-area', 'grid-area',
@ -523,36 +405,19 @@ const ATTRIBUTES = [
'grid-template-rows', 'grid-template-rows',
'hanging-punctuation', 'hanging-punctuation',
'height', 'height',
'hyphenate-character',
'hyphenate-limit-chars',
'hyphens', 'hyphens',
'icon', 'icon',
'image-orientation', 'image-orientation',
'image-rendering', 'image-rendering',
'image-resolution', 'image-resolution',
'ime-mode', 'ime-mode',
'initial-letter',
'initial-letter-align',
'inline-size', 'inline-size',
'inset',
'inset-area',
'inset-block',
'inset-block-end',
'inset-block-start',
'inset-inline',
'inset-inline-end',
'inset-inline-start',
'isolation', 'isolation',
'justify-content', 'justify-content',
'justify-items',
'justify-self',
'kerning',
'left', 'left',
'letter-spacing', 'letter-spacing',
'lighting-color',
'line-break', 'line-break',
'line-height', 'line-height',
'line-height-step',
'list-style', 'list-style',
'list-style-image', 'list-style-image',
'list-style-position', 'list-style-position',
@ -568,11 +433,6 @@ const ATTRIBUTES = [
'margin-left', 'margin-left',
'margin-right', 'margin-right',
'margin-top', 'margin-top',
'margin-trim',
'marker',
'marker-end',
'marker-mid',
'marker-start',
'marks', 'marks',
'mask', 'mask',
'mask-border', 'mask-border',
@ -591,10 +451,6 @@ const ATTRIBUTES = [
'mask-repeat', 'mask-repeat',
'mask-size', 'mask-size',
'mask-type', 'mask-type',
'masonry-auto-flow',
'math-depth',
'math-shift',
'math-style',
'max-block-size', 'max-block-size',
'max-height', 'max-height',
'max-inline-size', 'max-inline-size',
@ -613,12 +469,6 @@ const ATTRIBUTES = [
'normal', 'normal',
'object-fit', 'object-fit',
'object-position', 'object-position',
'offset',
'offset-anchor',
'offset-distance',
'offset-path',
'offset-position',
'offset-rotate',
'opacity', 'opacity',
'order', 'order',
'orphans', 'orphans',
@ -628,19 +478,9 @@ const ATTRIBUTES = [
'outline-style', 'outline-style',
'outline-width', 'outline-width',
'overflow', 'overflow',
'overflow-anchor',
'overflow-block',
'overflow-clip-margin',
'overflow-inline',
'overflow-wrap', 'overflow-wrap',
'overflow-x', 'overflow-x',
'overflow-y', 'overflow-y',
'overlay',
'overscroll-behavior',
'overscroll-behavior-block',
'overscroll-behavior-inline',
'overscroll-behavior-x',
'overscroll-behavior-y',
'padding', 'padding',
'padding-block', 'padding-block',
'padding-block-end', 'padding-block-end',
@ -652,37 +492,23 @@ const ATTRIBUTES = [
'padding-left', 'padding-left',
'padding-right', 'padding-right',
'padding-top', 'padding-top',
'page',
'page-break-after', 'page-break-after',
'page-break-before', 'page-break-before',
'page-break-inside', 'page-break-inside',
'paint-order',
'pause', 'pause',
'pause-after', 'pause-after',
'pause-before', 'pause-before',
'perspective', 'perspective',
'perspective-origin', 'perspective-origin',
'place-content',
'place-items',
'place-self',
'pointer-events', 'pointer-events',
'position', 'position',
'position-anchor',
'position-visibility',
'print-color-adjust',
'quotes', 'quotes',
'r',
'resize', 'resize',
'rest', 'rest',
'rest-after', 'rest-after',
'rest-before', 'rest-before',
'right', 'right',
'rotate',
'row-gap', 'row-gap',
'ruby-align',
'ruby-position',
'scale',
'scroll-behavior',
'scroll-margin', 'scroll-margin',
'scroll-margin-block', 'scroll-margin-block',
'scroll-margin-block-end', 'scroll-margin-block-end',
@ -708,43 +534,25 @@ const ATTRIBUTES = [
'scroll-snap-align', 'scroll-snap-align',
'scroll-snap-stop', 'scroll-snap-stop',
'scroll-snap-type', 'scroll-snap-type',
'scroll-timeline',
'scroll-timeline-axis',
'scroll-timeline-name',
'scrollbar-color', 'scrollbar-color',
'scrollbar-gutter', 'scrollbar-gutter',
'scrollbar-width', 'scrollbar-width',
'shape-image-threshold', 'shape-image-threshold',
'shape-margin', 'shape-margin',
'shape-outside', 'shape-outside',
'shape-rendering',
'speak', 'speak',
'speak-as', 'speak-as',
'src', // @font-face 'src', // @font-face
'stop-color',
'stop-opacity',
'stroke',
'stroke-dasharray',
'stroke-dashoffset',
'stroke-linecap',
'stroke-linejoin',
'stroke-miterlimit',
'stroke-opacity',
'stroke-width',
'tab-size', 'tab-size',
'table-layout', 'table-layout',
'text-align', 'text-align',
'text-align-all', 'text-align-all',
'text-align-last', 'text-align-last',
'text-anchor',
'text-combine-upright', 'text-combine-upright',
'text-decoration', 'text-decoration',
'text-decoration-color', 'text-decoration-color',
'text-decoration-line', 'text-decoration-line',
'text-decoration-skip',
'text-decoration-skip-ink',
'text-decoration-style', 'text-decoration-style',
'text-decoration-thickness',
'text-emphasis', 'text-emphasis',
'text-emphasis-color', 'text-emphasis-color',
'text-emphasis-position', 'text-emphasis-position',
@ -755,37 +563,20 @@ const ATTRIBUTES = [
'text-overflow', 'text-overflow',
'text-rendering', 'text-rendering',
'text-shadow', 'text-shadow',
'text-size-adjust',
'text-transform', 'text-transform',
'text-underline-offset',
'text-underline-position', 'text-underline-position',
'text-wrap',
'text-wrap-mode',
'text-wrap-style',
'timeline-scope',
'top', 'top',
'touch-action',
'transform', 'transform',
'transform-box', 'transform-box',
'transform-origin', 'transform-origin',
'transform-style', 'transform-style',
'transition', 'transition',
'transition-behavior',
'transition-delay', 'transition-delay',
'transition-duration', 'transition-duration',
'transition-property', 'transition-property',
'transition-timing-function', 'transition-timing-function',
'translate',
'unicode-bidi', 'unicode-bidi',
'user-modify',
'user-select',
'vector-effect',
'vertical-align', 'vertical-align',
'view-timeline',
'view-timeline-axis',
'view-timeline-inset',
'view-timeline-name',
'view-transition-name',
'visibility', 'visibility',
'voice-balance', 'voice-balance',
'voice-duration', 'voice-duration',
@ -796,7 +587,6 @@ const ATTRIBUTES = [
'voice-stress', 'voice-stress',
'voice-volume', 'voice-volume',
'white-space', 'white-space',
'white-space-collapse',
'widows', 'widows',
'width', 'width',
'will-change', 'will-change',
@ -804,11 +594,10 @@ const ATTRIBUTES = [
'word-spacing', 'word-spacing',
'word-wrap', 'word-wrap',
'writing-mode', 'writing-mode',
'x', 'z-index'
'y', // reverse makes sure longer attributes `font-weight` are matched fully
'z-index', // instead of getting false positives on say `font`
'zoom' ].reverse();
].sort().reverse();
/* /*
Language: Stylus Language: Stylus
@ -818,7 +607,6 @@ Website: https://github.com/stylus/stylus
Category: css, web Category: css, web
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function stylus(hljs) { function stylus(hljs) {
const modes = MODES(hljs); const modes = MODES(hljs);

View File

@ -2,7 +2,6 @@
Language: SubUnit Language: SubUnit
Author: Sergey Bronnikov <sergeyb@bronevichok.ru> Author: Sergey Bronnikov <sergeyb@bronevichok.ru>
Website: https://pypi.org/project/python-subunit/ Website: https://pypi.org/project/python-subunit/
Category: protocols
*/ */
function subunit(hljs) { function subunit(hljs) {

View File

@ -101,16 +101,12 @@ const keywords = [
/as\?/, // operator /as\?/, // operator
/as!/, // operator /as!/, // operator
'as', // operator 'as', // operator
'borrowing', // contextual
'break', 'break',
'case', 'case',
'catch', 'catch',
'class', 'class',
'consume', // contextual
'consuming', // contextual
'continue', 'continue',
'convenience', // contextual 'convenience', // contextual
'copy', // contextual
'default', 'default',
'defer', 'defer',
'deinit', 'deinit',
@ -118,7 +114,6 @@ const keywords = [
'distributed', 'distributed',
'do', 'do',
'dynamic', // contextual 'dynamic', // contextual
'each',
'else', 'else',
'enum', 'enum',
'extension', 'extension',
@ -145,7 +140,6 @@ const keywords = [
'nonisolated', // contextual 'nonisolated', // contextual
'lazy', // contextual 'lazy', // contextual
'let', 'let',
'macro',
'mutating', // contextual 'mutating', // contextual
'nonmutating', // contextual 'nonmutating', // contextual
/open\(set\)/, // contextual /open\(set\)/, // contextual
@ -153,7 +147,6 @@ const keywords = [
'operator', 'operator',
'optional', // contextual 'optional', // contextual
'override', // contextual 'override', // contextual
'package',
'postfix', // contextual 'postfix', // contextual
'precedencegroup', 'precedencegroup',
'prefix', // contextual 'prefix', // contextual
@ -231,6 +224,7 @@ const numberSignKeywords = [
'#line', '#line',
'#selector', '#selector',
'#sourceLocation', '#sourceLocation',
'#warn_unqualified_access',
'#warning' '#warning'
]; ];
@ -344,16 +338,13 @@ const typeIdentifier = concat(/[A-Z]/, identifierCharacter, '*');
// Built-in attributes, which are highlighted as keywords. // Built-in attributes, which are highlighted as keywords.
// @available is handled separately. // @available is handled separately.
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/attributes
const keywordAttributes = [ const keywordAttributes = [
'attached',
'autoclosure', 'autoclosure',
concat(/convention\(/, either('swift', 'block', 'c'), /\)/), concat(/convention\(/, either('swift', 'block', 'c'), /\)/),
'discardableResult', 'discardableResult',
'dynamicCallable', 'dynamicCallable',
'dynamicMemberLookup', 'dynamicMemberLookup',
'escaping', 'escaping',
'freestanding',
'frozen', 'frozen',
'GKInspectable', 'GKInspectable',
'IBAction', 'IBAction',
@ -373,13 +364,10 @@ const keywordAttributes = [
'propertyWrapper', 'propertyWrapper',
'requires_stored_property_inits', 'requires_stored_property_inits',
'resultBuilder', 'resultBuilder',
'Sendable',
'testable', 'testable',
'UIApplicationMain', 'UIApplicationMain',
'unchecked',
'unknown', 'unknown',
'usableFromInline', 'usableFromInline'
'warn_unqualified_access'
]; ];
// Contextual keywords used in @available and #(un)available. // Contextual keywords used in @available and #(un)available.
@ -406,7 +394,6 @@ Website: https://swift.org
Category: common, system Category: common, system
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function swift(hljs) { function swift(hljs) {
const WHITESPACE = { const WHITESPACE = {
@ -573,50 +560,6 @@ function swift(hljs) {
] ]
}; };
const REGEXP_CONTENTS = [
hljs.BACKSLASH_ESCAPE,
{
begin: /\[/,
end: /\]/,
relevance: 0,
contains: [ hljs.BACKSLASH_ESCAPE ]
}
];
const BARE_REGEXP_LITERAL = {
begin: /\/[^\s](?=[^/\n]*\/)/,
end: /\//,
contains: REGEXP_CONTENTS
};
const EXTENDED_REGEXP_LITERAL = (rawDelimiter) => {
const begin = concat(rawDelimiter, /\//);
const end = concat(/\//, rawDelimiter);
return {
begin,
end,
contains: [
...REGEXP_CONTENTS,
{
scope: "comment",
begin: `#(?!.*${end})`,
end: /$/,
},
],
};
};
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure/#Regular-Expression-Literals
const REGEXP = {
scope: "regexp",
variants: [
EXTENDED_REGEXP_LITERAL('###'),
EXTENDED_REGEXP_LITERAL('##'),
EXTENDED_REGEXP_LITERAL('#'),
BARE_REGEXP_LITERAL
]
};
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID412 // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID412
const QUOTED_IDENTIFIER = { match: concat(/`/, identifier, /`/) }; const QUOTED_IDENTIFIER = { match: concat(/`/, identifier, /`/) };
const IMPLICIT_PARAMETER = { const IMPLICIT_PARAMETER = {
@ -636,7 +579,7 @@ function swift(hljs) {
// https://docs.swift.org/swift-book/ReferenceManual/Attributes.html // https://docs.swift.org/swift-book/ReferenceManual/Attributes.html
const AVAILABLE_ATTRIBUTE = { const AVAILABLE_ATTRIBUTE = {
match: /(@|#(un)?)available/, match: /(@|#(un)?)available/,
scope: 'keyword', className: "keyword",
starts: { contains: [ starts: { contains: [
{ {
begin: /\(/, begin: /\(/,
@ -650,17 +593,14 @@ function swift(hljs) {
} }
] } ] }
}; };
const KEYWORD_ATTRIBUTE = { const KEYWORD_ATTRIBUTE = {
scope: 'keyword', className: 'keyword',
match: concat(/@/, either(...keywordAttributes), lookahead(either(/\(/, /\s+/))), match: concat(/@/, either(...keywordAttributes))
}; };
const USER_DEFINED_ATTRIBUTE = { const USER_DEFINED_ATTRIBUTE = {
scope: 'meta', className: 'meta',
match: concat(/@/, identifier) match: concat(/@/, identifier)
}; };
const ATTRIBUTES = [ const ATTRIBUTES = [
AVAILABLE_ATTRIBUTE, AVAILABLE_ATTRIBUTE,
KEYWORD_ATTRIBUTE, KEYWORD_ATTRIBUTE,
@ -726,7 +666,6 @@ function swift(hljs) {
'self', 'self',
TUPLE_ELEMENT_NAME, TUPLE_ELEMENT_NAME,
...COMMENTS, ...COMMENTS,
REGEXP,
...KEYWORD_MODES, ...KEYWORD_MODES,
...BUILT_INS, ...BUILT_INS,
...OPERATORS, ...OPERATORS,
@ -741,7 +680,6 @@ function swift(hljs) {
const GENERIC_PARAMETERS = { const GENERIC_PARAMETERS = {
begin: /</, begin: /</,
end: />/, end: />/,
keywords: 'repeat each',
contains: [ contains: [
...COMMENTS, ...COMMENTS,
TYPE TYPE
@ -784,10 +722,9 @@ function swift(hljs) {
illegal: /["']/ illegal: /["']/
}; };
// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID362 // https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID362
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations/#Macro-Declaration const FUNCTION = {
const FUNCTION_OR_MACRO = {
match: [ match: [
/(func|macro)/, /func/,
/\s+/, /\s+/,
either(QUOTED_IDENTIFIER.match, identifier, operator) either(QUOTED_IDENTIFIER.match, identifier, operator)
], ],
@ -853,64 +790,6 @@ function swift(hljs) {
end: /}/ end: /}/
}; };
const CLASS_FUNC_DECLARATION = {
match: [
/class\b/,
/\s+/,
/func\b/,
/\s+/,
/\b[A-Za-z_][A-Za-z0-9_]*\b/
],
scope: {
1: "keyword",
3: "keyword",
5: "title.function"
}
};
const CLASS_VAR_DECLARATION = {
match: [
/class\b/,
/\s+/,
/var\b/,
],
scope: {
1: "keyword",
3: "keyword"
}
};
const TYPE_DECLARATION = {
begin: [
/(struct|protocol|class|extension|enum|actor)/,
/\s+/,
identifier,
/\s*/,
],
beginScope: {
1: "keyword",
3: "title.class"
},
keywords: KEYWORDS,
contains: [
GENERIC_PARAMETERS,
...KEYWORD_MODES,
{
begin: /:/,
end: /\{/,
keywords: KEYWORDS,
contains: [
{
scope: "title.class.inherited",
match: typeIdentifier,
},
...KEYWORD_MODES,
],
relevance: 0,
},
]
};
// Add supported submodes to string interpolation. // Add supported submodes to string interpolation.
for (const variant of STRING.variants) { for (const variant of STRING.variants) {
const interpolation = variant.contains.find(mode => mode.label === "interpol"); const interpolation = variant.contains.find(mode => mode.label === "interpol");
@ -942,11 +821,21 @@ function swift(hljs) {
keywords: KEYWORDS, keywords: KEYWORDS,
contains: [ contains: [
...COMMENTS, ...COMMENTS,
FUNCTION_OR_MACRO, FUNCTION,
INIT_SUBSCRIPT, INIT_SUBSCRIPT,
CLASS_FUNC_DECLARATION, {
CLASS_VAR_DECLARATION, beginKeywords: 'struct protocol class extension enum actor',
TYPE_DECLARATION, end: '\\{',
excludeEnd: true,
keywords: KEYWORDS,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
className: "title.class",
begin: /[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/
}),
...KEYWORD_MODES
]
},
OPERATOR_DECLARATION, OPERATOR_DECLARATION,
PRECEDENCEGROUP, PRECEDENCEGROUP,
{ {
@ -955,7 +844,6 @@ function swift(hljs) {
contains: [ ...COMMENTS ], contains: [ ...COMMENTS ],
relevance: 0 relevance: 0
}, },
REGEXP,
...KEYWORD_MODES, ...KEYWORD_MODES,
...BUILT_INS, ...BUILT_INS,
...OPERATORS, ...OPERATORS,

View File

@ -3,7 +3,6 @@ Language: Tagger Script
Author: Philipp Wolfer <ph.wolfer@gmail.com> Author: Philipp Wolfer <ph.wolfer@gmail.com>
Description: Syntax Highlighting for the Tagger Script as used by MusicBrainz Picard. Description: Syntax Highlighting for the Tagger Script as used by MusicBrainz Picard.
Website: https://picard.musicbrainz.org Website: https://picard.musicbrainz.org
Category: scripting
*/ */
function taggerscript(hljs) { function taggerscript(hljs) {
const NOOP = { const NOOP = {

View File

@ -3,7 +3,6 @@ Language: Tcl
Description: Tcl is a very simple programming language. Description: Tcl is a very simple programming language.
Author: Radek Liska <radekliska@gmail.com> Author: Radek Liska <radekliska@gmail.com>
Website: https://www.tcl.tk/about/language.html Website: https://www.tcl.tk/about/language.html
Category: scripting
*/ */
function tcl(hljs) { function tcl(hljs) {

View File

@ -2,7 +2,6 @@
Language: TP Language: TP
Author: Jay Strybis <jay.strybis@gmail.com> Author: Jay Strybis <jay.strybis@gmail.com>
Description: FANUC TP programming language (TPP). Description: FANUC TP programming language (TPP).
Category: hardware
*/ */
function tp(hljs) { function tp(hljs) {

View File

@ -40,9 +40,7 @@ const KEYWORDS = [
"import", "import",
"from", "from",
"export", "export",
"extends", "extends"
// It's reached stage 3, which is "recommended for implementation":
"using"
]; ];
const LITERALS = [ const LITERALS = [
"true", "true",
@ -165,7 +163,6 @@ Category: common, scripting, web
Website: https://developer.mozilla.org/en-US/docs/Web/JavaScript Website: https://developer.mozilla.org/en-US/docs/Web/JavaScript
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function javascript(hljs) { function javascript(hljs) {
const regex = hljs.regex; const regex = hljs.regex;
@ -292,7 +289,7 @@ function javascript(hljs) {
contains: [] // defined later contains: [] // defined later
}; };
const HTML_TEMPLATE = { const HTML_TEMPLATE = {
begin: '\.?html`', begin: 'html`',
end: '', end: '',
starts: { starts: {
end: '`', end: '`',
@ -305,7 +302,7 @@ function javascript(hljs) {
} }
}; };
const CSS_TEMPLATE = { const CSS_TEMPLATE = {
begin: '\.?css`', begin: 'css`',
end: '', end: '',
starts: { starts: {
end: '`', end: '`',
@ -318,7 +315,7 @@ function javascript(hljs) {
} }
}; };
const GRAPHQL_TEMPLATE = { const GRAPHQL_TEMPLATE = {
begin: '\.?gql`', begin: 'gql`',
end: '', end: '',
starts: { starts: {
end: '`', end: '`',
@ -415,7 +412,7 @@ function javascript(hljs) {
const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([ const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([
// eat recursive parens in sub expressions // eat recursive parens in sub expressions
{ {
begin: /(\s*)\(/, begin: /\(/,
end: /\)/, end: /\)/,
keywords: KEYWORDS$1, keywords: KEYWORDS$1,
contains: ["self"].concat(SUBST_AND_COMMENTS) contains: ["self"].concat(SUBST_AND_COMMENTS)
@ -423,8 +420,7 @@ function javascript(hljs) {
]); ]);
const PARAMS = { const PARAMS = {
className: 'params', className: 'params',
// convert this to negative lookbehind in v12 begin: /\(/,
begin: /(\s*)\(/, // to match the parms with
end: /\)/, end: /\)/,
excludeBegin: true, excludeBegin: true,
excludeEnd: true, excludeEnd: true,
@ -547,8 +543,8 @@ function javascript(hljs) {
...BUILT_IN_GLOBALS, ...BUILT_IN_GLOBALS,
"super", "super",
"import" "import"
].map(x => `${x}\\s*\\(`)), ]),
IDENT_RE$1, regex.lookahead(/\s*\(/)), IDENT_RE$1, regex.lookahead(/\(/)),
className: "title.function", className: "title.function",
relevance: 0 relevance: 0
}; };
@ -635,8 +631,8 @@ function javascript(hljs) {
NUMBER, NUMBER,
CLASS_REFERENCE, CLASS_REFERENCE,
{ {
scope: 'attr', className: 'attr',
match: IDENT_RE$1 + regex.lookahead(':'), begin: IDENT_RE$1 + regex.lookahead(':'),
relevance: 0 relevance: 0
}, },
FUNCTION_VARIABLE, FUNCTION_VARIABLE,
@ -669,7 +665,7 @@ function javascript(hljs) {
skip: true skip: true
}, },
{ {
begin: /(\s*)\(/, begin: /\(/,
end: /\)/, end: /\)/,
excludeBegin: true, excludeBegin: true,
excludeEnd: true, excludeEnd: true,
@ -775,10 +771,8 @@ Website: https://www.typescriptlang.org
Category: common, scripting Category: common, scripting
*/ */
/** @type LanguageFn */ /** @type LanguageFn */
function typescript(hljs) { function typescript(hljs) {
const regex = hljs.regex;
const tsLanguage = javascript(hljs); const tsLanguage = javascript(hljs);
const IDENT_RE$1 = IDENT_RE; const IDENT_RE$1 = IDENT_RE;
@ -795,15 +789,10 @@ function typescript(hljs) {
"unknown" "unknown"
]; ];
const NAMESPACE = { const NAMESPACE = {
begin: [ beginKeywords: 'namespace',
/namespace/, end: /\{/,
/\s+/, excludeEnd: true,
hljs.IDENT_RE contains: [ tsLanguage.exports.CLASS_REFERENCE ]
],
beginScope: {
1: "keyword",
3: "title.class"
}
}; };
const INTERFACE = { const INTERFACE = {
beginKeywords: 'interface', beginKeywords: 'interface',
@ -822,7 +811,7 @@ function typescript(hljs) {
}; };
const TS_SPECIFIC_KEYWORDS = [ const TS_SPECIFIC_KEYWORDS = [
"type", "type",
// "namespace", "namespace",
"interface", "interface",
"public", "public",
"private", "private",
@ -832,14 +821,8 @@ function typescript(hljs) {
"abstract", "abstract",
"readonly", "readonly",
"enum", "enum",
"override", "override"
"satisfies"
]; ];
/*
namespace is a TS keyword but it's fine to use it as a variable name too.
const message = 'foo';
const namespace = 'bar';
*/
const KEYWORDS$1 = { const KEYWORDS$1 = {
$pattern: IDENT_RE, $pattern: IDENT_RE,
keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS), keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS),
@ -847,7 +830,6 @@ function typescript(hljs) {
built_in: BUILT_INS.concat(TYPES), built_in: BUILT_INS.concat(TYPES),
"variable.language": BUILT_IN_VARIABLES "variable.language": BUILT_IN_VARIABLES
}; };
const DECORATOR = { const DECORATOR = {
className: 'meta', className: 'meta',
begin: '@' + IDENT_RE$1, begin: '@' + IDENT_RE$1,
@ -866,27 +848,10 @@ function typescript(hljs) {
Object.assign(tsLanguage.keywords, KEYWORDS$1); Object.assign(tsLanguage.keywords, KEYWORDS$1);
tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR); tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);
// highlight the function params
const ATTRIBUTE_HIGHLIGHT = tsLanguage.contains.find(c => c.scope === "attr");
// take default attr rule and extend it to support optionals
const OPTIONAL_KEY_OR_ARGUMENT = Object.assign({},
ATTRIBUTE_HIGHLIGHT,
{ match: regex.concat(IDENT_RE$1, regex.lookahead(/\s*\?:/)) }
);
tsLanguage.exports.PARAMS_CONTAINS.push([
tsLanguage.exports.CLASS_REFERENCE, // class reference for highlighting the params types
ATTRIBUTE_HIGHLIGHT, // highlight the params key
OPTIONAL_KEY_OR_ARGUMENT, // Added for optional property assignment highlighting
]);
// Add the optional property assignment highlighting for objects or classes
tsLanguage.contains = tsLanguage.contains.concat([ tsLanguage.contains = tsLanguage.contains.concat([
DECORATOR, DECORATOR,
NAMESPACE, NAMESPACE,
INTERFACE, INTERFACE,
OPTIONAL_KEY_OR_ARGUMENT, // Added for optional property assignment highlighting
]); ]);
// TS gets a simpler shebang rule than JS // TS gets a simpler shebang rule than JS

View File

@ -3,7 +3,6 @@ Language: Vala
Author: Antono Vasiljev <antono.vasiljev@gmail.com> Author: Antono Vasiljev <antono.vasiljev@gmail.com>
Description: Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C. Description: Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C.
Website: https://wiki.gnome.org/Projects/Vala Website: https://wiki.gnome.org/Projects/Vala
Category: system
*/ */
function vala(hljs) { function vala(hljs) {

View File

@ -4,7 +4,6 @@ Author: Jon Evans <jon@craftyjon.com>
Contributors: Boone Severson <boone.severson@gmail.com> Contributors: Boone Severson <boone.severson@gmail.com>
Description: Verilog is a hardware description language used in electronic design automation to describe digital and mixed-signal systems. This highlighter supports Verilog and SystemVerilog through IEEE 1800-2012. Description: Verilog is a hardware description language used in electronic design automation to describe digital and mixed-signal systems. This highlighter supports Verilog and SystemVerilog through IEEE 1800-2012.
Website: http://www.verilog.com Website: http://www.verilog.com
Category: hardware
*/ */
function verilog(hljs) { function verilog(hljs) {

View File

@ -4,7 +4,6 @@ Author: Igor Kalnitsky <igor@kalnitsky.org>
Contributors: Daniel C.K. Kho <daniel.kho@tauhop.com>, Guillaume Savaton <guillaume.savaton@eseo.fr> Contributors: Daniel C.K. Kho <daniel.kho@tauhop.com>, Guillaume Savaton <guillaume.savaton@eseo.fr>
Description: VHDL is a hardware description language used in electronic design automation to describe digital and mixed-signal systems. Description: VHDL is a hardware description language used in electronic design automation to describe digital and mixed-signal systems.
Website: https://en.wikipedia.org/wiki/VHDL Website: https://en.wikipedia.org/wiki/VHDL
Category: hardware
*/ */
function vhdl(hljs) { function vhdl(hljs) {

View File

@ -342,8 +342,7 @@ function xquery(_hljs) {
name: 'XQuery', name: 'XQuery',
aliases: [ aliases: [
'xpath', 'xpath',
'xq', 'xq'
'xqm'
], ],
case_insensitive: false, case_insensitive: false,
illegal: /(proc)|(abstract)|(extends)|(until)|(#)/, illegal: /(proc)|(abstract)|(extends)|(until)|(#)/,

Some files were not shown because too many files have changed in this diff Show More