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>
import marked from 'marked';
import { highlight } from 'highlight.js';
import hljs from 'highlight.js';
// marked
marked.setOptions({
renderer: new marked.Renderer(),
highlight: function(code, lang) {
try {
return highlight(lang, code).value;
return hljs.highlightAuto(code, [lang]).value;
} catch (e) {
return highlight('plaintext', code).value;
return hljs.highlightAuto(code).value;
}
},
gfm: true,

View File

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

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

@ -1,7 +1,7 @@
{
"name": "uView",
"version": "1.0.0",
"lockfileVersion": 3,
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/base64-arraybuffer": {
@ -26,9 +26,9 @@
}
},
"node_modules/highlight.js": {
"version": "11.11.1",
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.11.1.tgz",
"integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==",
"version": "11.8.0",
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.8.0.tgz",
"integrity": "sha512-MedQhoqVdr0U6SSnWPzfiadUcDHfN/Wzq25AkXiQv9oiOO/sG0S7XkvpFIqWBl9Yq1UYyYOOVORs5UW2XlPyzg==",
"engines": {
"node": ">=12.0.0"
}
@ -56,14 +56,14 @@
"integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
},
"node_modules/marked": {
"version": "16.0.0",
"resolved": "https://registry.npmmirror.com/marked/-/marked-16.0.0.tgz",
"integrity": "sha512-MUKMXDjsD/eptB7GPzxo4xcnLS6oo7/RHimUMHEDRhUooPwmN9BEpMl7AEOJv3bmso169wHI2wUF9VQgL7zfmA==",
"version": "4.3.0",
"resolved": "https://registry.npmmirror.com/marked/-/marked-4.3.0.tgz",
"integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==",
"bin": {
"marked": "bin/marked.js"
},
"engines": {
"node": ">= 20"
"node": ">= 12"
}
},
"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
Parser engine:
@ -326,7 +39,6 @@ Core Grammars:
[AdamRaichu]: https://github.com/AdamRaichu
[Ali Ukani]: https://github.com/ali
[Jeroen van Vianen]: https://github.com/morinel
[gnysek]: https://github.com/gnysek
[Rijenkii]: https://github.com/rijenkii
[faga295]: https://github.com/faga295
[rvanasa]: https://github.com/rvanasa
@ -335,8 +47,6 @@ Core Grammars:
[Keyacom]: https://github.com/Keyacom
[Boris Verkhovskiy]: https://github.com/verhovsky
[Cyrus Kao]: https://github.com/CyrusKao
[Zlondrej]: https://github.com/zlondrej
## Version 11.7.0
@ -425,7 +135,6 @@ Grammars:
[Mousetail]: https://github.com/mousetail
[Gabriel Gonçalves]: https://github.com/KTSnowy
[Nikita Sobolev]: https://github.com/sobolevn
[Misha Kaletsky]: https://github.com/mmkal
## 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)
[![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)
![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)
[![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 Web Workers](#using-web-workers)
- [Importing the Library](#importing-the-library)
- [Node.js CommonJS Modules / `require`](#nodejs-commonjs-modules--require)
- [Node.js ES6 Modules / `import`](#nodejs-es6-modules--import)
- [Browser ES6 Modules](#browser-es6-modules)
- [Node.js / `require`](#nodejs--require)
- [ES6 Modules / `import`](#es6-modules--import)
- [Getting the Library](#getting-the-library)
- [Fetch via CDN](#fetch-via-cdn)
- [cdnjs (link)](#cdnjs-link)
- [jsdelivr (link)](#jsdelivr-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)
- [Install via NPM package](#install-via-npm-package)
- [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
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
@ -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).
### Node.js CommonJS Modules / `require`
### Node.js / `require`
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:
@ -290,53 +294,6 @@ import hljs from 'highlight.js';
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
@ -370,20 +327,20 @@ see [DIGESTS.md](https://github.com/highlightjs/cdn-release/blob/main/DIGESTS.md
##### Common JS <!-- omit in toc -->
```html
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
<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.8.0/highlight.min.js"></script>
<!-- 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 -->
````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">
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
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);
</script>
@ -395,20 +352,20 @@ hljs.registerLanguage('go', go);
##### Common JS <!-- omit in toc -->
```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/styles/default.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.11.1/build/highlight.min.js"></script>
<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.8.0/build/highlight.min.js"></script>
<!-- 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 -->
```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">
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
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);
</script>
```
@ -418,20 +375,20 @@ hljs.registerLanguage('go', go);
##### Common JS <!-- omit in toc -->
```html
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/default.min.css">
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/highlight.min.js"></script>
<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.8.0/highlight.min.js"></script>
<!-- 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 -->
```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">
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
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);
</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
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.
@ -463,14 +420,6 @@ npm install 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.

View File

@ -29,7 +29,6 @@ The table below shows the full list of languages (and corresponding classes/alia
| AutoHotkey | autohotkey | |
| AutoIt | autoit | |
| Awk | awk, mawk, nawk, gawk | |
| Ballerina | ballerina, bal | [highlightjs-ballerina](https://github.com/highlightjs/highlightjs-ballerina) |
| Bash | bash, sh, zsh | |
| Basic | basic | |
| 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 | |
| Candid | candid, did | [highlightjs-motoko](https://github.com/rvanasa/highlightjs-motoko) |
| CMake | cmake, cmake.in | |
| COBOL | cobol, standard-cobol | [highlightjs-cobol](https://github.com/otterkit/highlightjs-cobol) |
| CODEOWNERS | codeowners | [highlightjs-codeowners](https://github.com/highlightjs/highlightjs-codeowners) |
| COBOL | cobol, standard-cobol | [highlightjs-cobol](https://github.com/otterkit/highlightjs-cobol) |
| Coq | coq | |
| CSP | csp | |
| CSS | css | |
@ -80,7 +78,7 @@ The table below shows the full list of languages (and corresponding classes/alia
| Erlang | erlang, erl | |
| Excel | excel, xls, xlsx | |
| Extempore | extempore, xtlang, xtm | [highlightjs-xtlang](https://github.com/highlightjs/highlightjs-xtlang) |
| F# | fsharp, fs, fsx, fsi, fsscript | |
| F# | fsharp, fs | |
| FIX | fix | |
| Flix | flix | [highlightjs-flix](https://github.com/flix/highlightjs-flix) |
| 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) |
| Golo | golo, gololang | |
| Gradle | gradle | |
| GraphQL | graphql, gql | |
| GraphQL | graphql | |
| Groovy | groovy | |
| GSQL | gsql | [highlightjs-gsql](https://github.com/DanBarkus/highlightjs-gsql) |
| 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 | |
| Inform7 | inform7, i7 | |
| IRPF90 | irpf90 | |
| Iptables | iptables | [highlightjs-iptables](https://github.com/highlightjs/highlightjs-iptables) |
| JSON | json, jsonc | |
| JSONata | jsonata | [highlightjs-jsonata](https://github.com/DevDimov/highlightjs-jsonata) |
| JSON | json | |
| Java | java, jsp | |
| JavaScript | javascript, js, jsx | |
| Jolie | jolie, iol, ol | [highlightjs-jolie](https://github.com/xiroV/highlightjs-jolie) |
| Julia | julia, jl | |
| Julia REPL | julia-repl | |
| Julia | julia, julia-repl | |
| Kotlin | kotlin, kt | |
| Lang | | [highlightjs-lang](https://github.com/highlightjs/highlightjs-lang)
| LaTeX | tex | |
@ -126,13 +121,11 @@ The table below shows the full list of languages (and corresponding classes/alia
| Lasso | lasso, ls, lassoscript | |
| Less | less | |
| LDIF | ldif | |
| Liquid | liquid | [highlightjs-liquid](https://github.com/highlightjs/highlightjs-liquid) |
| Lisp | lisp | |
| LiveCode Server | livecodeserver | |
| LiveScript | livescript, ls | |
| LookML | lookml | [highlightjs-lookml](https://github.com/spectacles-ci/highlightjs-lookml) |
| Lua | lua, pluto | |
| Luau | luau | [highlightjs-luau](https://github.com/highlightjs/highlightjs-luau) |
| Lua | lua | |
| Macaulay2 | macaulay2 | [highlightjs-macaulay2](https://github.com/d-torrance/highlightjs-macaulay2) |
| Makefile | makefile, mk, mak, make | |
| Markdown | markdown, md, mkdown, mkd | |
@ -141,10 +134,8 @@ The table below shows the full list of languages (and corresponding classes/alia
| Maxima | maxima | |
| Maya Embedded Language | mel | |
| Mercury | mercury | |
| MetaPost | metapost | [highlightjs-metapost](https://github.com/chupinmaxime/highlightjs-metapost) | |
| MIPS Assembler | mips, mipsasm | |
| 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) |
| Mizar | mizar | |
| 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) |
| OCaml | ocaml, ml | |
| 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 | |
| OpenSCAD | openscad, scad | |
| 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) |
| Parser3 | parser3 | |
| 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) |
| Plaintext | plaintext, txt, text | |
| Pony | pony | |
| PostgreSQL & PL/pgSQL | pgsql, postgres, postgresql | |
| PowerOn | poweron, po | [highlightjs-poweron](https://github.com/libum-llc/highlightjs-poweron) |
| PowerShell | powershell, ps, ps1 | |
| Processing | processing | |
| Prolog | prolog | |
@ -192,18 +180,12 @@ The table below shows the full list of languages (and corresponding classes/alia
| Q | k, kdb | |
| QML | qml | |
| 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) |
| ReasonML | reasonml, re | |
| Rebol & Red | redbol, rebol, red, red-system | [highlightjs-redbol](https://github.com/oldes/highlightjs-redbol) |
| RenderMan RIB | rib | |
| 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) |
| RISC-V Assembly | riscv, riscvasm | [highlightjs-riscvasm](https://github.com/highlightjs/highlightjs-riscvasm) |
| Roboconf | graph, instances | |
| 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) |
@ -231,7 +213,7 @@ The table below shows the full list of languages (and corresponding classes/alia
| Stylus | stylus, styl | |
| SubUnit | subunit | |
| 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 | |
| Tcl | tcl, tk | |
| 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) |
| TP | tp | |
| 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 | |
| TypeScript | typescript, ts, tsx, mts, cts | |
| 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 | |
| VBA | vba | [highlightjs-vba](https://github.com/dullin/highlightjs-vba) |
| VBScript | vbscript, vbs | |
@ -252,17 +232,14 @@ The table below shows the full list of languages (and corresponding classes/alia
| Vala | vala | |
| Verilog | verilog, v | |
| 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++ | axapta, x++ | |
| x86 Assembly | x86asm | |
| x86 Assembly (AT&T) | x86asmatt | [highlightjs-x86asmatt](https://github.com/gondow/highlightjs-x86asmatt) |
| XL | xl, tao | |
| XQuery | xquery, xpath, xq, xqm | |
| XQuery | xquery, xpath, xq | |
| YAML | yml, yaml | |
| ZenScript | zenscript, zs |[highlightjs-zenscript](https://github.com/highlightjs/highlightjs-zenscript) |
| Zephir | zephir, zep | |
| Zig | zig |[highlightjs-zig](https://github.com/fwx5618177/highlightjs-zig) |
<!-- LANGLIST_END -->
<!-- document it until we can fix it -->

View File

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

View File

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

View File

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

View File

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

View File

@ -52,44 +52,9 @@ function cPlusPlus(hljs) {
const NUMBERS = {
className: 'number',
variants: [
// Floating-point literal.
{ begin:
"[+-]?(?:" // Leading sign.
// 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.
}
{ begin: '\\b(0b[01\']+)' },
{ begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)' },
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
],
relevance: 0
};
@ -247,8 +212,6 @@ function cPlusPlus(hljs) {
'counting_semaphore',
'deque',
'false_type',
'flat_map',
'flat_set',
'future',
'imaginary',
'initializer_list',
@ -574,7 +537,7 @@ function cPlusPlus(hljs) {
[
PREPROCESSOR,
{ // 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: '>',
keywords: CPP_KEYWORDS,
contains: [
@ -607,10 +570,8 @@ Language: Arduino
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.
Website: https://www.arduino.cc
Category: system
*/
/** @type LanguageFn */
function arduino(hljs) {
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 ',
built_in:
'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
+ '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

View File

@ -3,7 +3,6 @@ Language: AspectJ
Author: Hakan Ozler <ozler.hakan@gmail.com>
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.
Category: system
Audit: 2020
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -52,44 +52,9 @@ function cpp(hljs) {
const NUMBERS = {
className: 'number',
variants: [
// Floating-point literal.
{ begin:
"[+-]?(?:" // Leading sign.
// 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.
}
{ begin: '\\b(0b[01\']+)' },
{ begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)' },
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
],
relevance: 0
};
@ -247,8 +212,6 @@ function cpp(hljs) {
'counting_semaphore',
'deque',
'false_type',
'flat_map',
'flat_set',
'future',
'imaginary',
'initializer_list',
@ -574,7 +537,7 @@ function cpp(hljs) {
[
PREPROCESSOR,
{ // 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: '>',
keywords: CPP_KEYWORDS,
contains: [

View File

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

View File

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

View File

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

View File

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

View File

@ -25,15 +25,6 @@ function dart(hljs) {
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 = {
className: 'string',
variants: [
@ -96,7 +87,7 @@ function dart(hljs) {
]
};
BRACED_SUBST.contains = [
NUMBER,
hljs.C_NUMBER_MODE,
STRING
];
@ -257,7 +248,7 @@ function dart(hljs) {
hljs.UNDERSCORE_TITLE_MODE
]
},
NUMBER,
hljs.C_NUMBER_MODE,
{
className: 'meta',
begin: '@[A-Za-z]+'

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ function erlang(hljs) {
const ERLANG_RESERVED = {
keyword:
'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:
'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 = {
beginKeywords: 'fun receive if try case maybe',
beginKeywords: 'fun receive if try case',
end: 'end',
keywords: ERLANG_RESERVED
};
@ -114,15 +88,12 @@ function erlang(hljs) {
hljs.inherit(hljs.APOS_STRING_MODE, { className: '' }),
BLOCK_STATEMENTS,
FUNCTION_CALL,
SIGIL,
TRIPLE_QUOTE,
hljs.QUOTE_STRING_MODE,
NUMBER,
TUPLE,
VAR1,
VAR2,
RECORD_ACCESS,
CHAR_LITERAL
RECORD_ACCESS
];
const BASIC_MODES = [
@ -130,15 +101,12 @@ function erlang(hljs) {
NAMED_FUN,
BLOCK_STATEMENTS,
FUNCTION_CALL,
SIGIL,
TRIPLE_QUOTE,
hljs.QUOTE_STRING_MODE,
NUMBER,
TUPLE,
VAR1,
VAR2,
RECORD_ACCESS,
CHAR_LITERAL
RECORD_ACCESS
];
FUNCTION_CALL.contains[1].contains = BASIC_MODES;
TUPLE.contains = BASIC_MODES;
@ -154,7 +122,6 @@ function erlang(hljs) {
"-author",
"-copyright",
"-doc",
"-moduledoc",
"-vsn",
"-import",
"-include",
@ -166,9 +133,7 @@ function erlang(hljs) {
"-file",
"-behaviour",
"-behavior",
"-spec",
"-on_load",
"-nifs",
"-spec"
];
const PARAMS = {
@ -177,7 +142,6 @@ function erlang(hljs) {
end: '\\)',
contains: BASIC_MODES
};
return {
name: 'Erlang',
aliases: [ 'erl' ],
@ -211,22 +175,14 @@ function erlang(hljs) {
$pattern: '-' + hljs.IDENT_RE,
keyword: DIRECTIVES.map(x => `${x}|1.5`).join(" ")
},
contains: [
PARAMS,
SIGIL,
TRIPLE_QUOTE,
hljs.QUOTE_STRING_MODE
]
contains: [ PARAMS ]
},
NUMBER,
SIGIL,
TRIPLE_QUOTE,
hljs.QUOTE_STRING_MODE,
RECORD_ACCESS,
VAR1,
VAR2,
TUPLE,
CHAR_LITERAL,
{ begin: /\.$/ } // relevance booster
]
};

View File

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

View File

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

View File

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

View File

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

View File

@ -3,174 +3,61 @@
Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com>
Description: G-code syntax highlighter for Fanuc and other common CNC machine tool controls.
Website: https://www.sis.se/api/document/preview/911952/
Category: hardware
*/
function gcode(hljs) {
const regex = hljs.regex;
const GCODE_IDENT_RE = '[A-Z_][A-Z0-9_.]*';
const GCODE_CLOSE_RE = '%';
const GCODE_KEYWORDS = {
$pattern: /[A-Z]+|%/,
keyword: [
// conditions
'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'
]
$pattern: GCODE_IDENT_RE,
keyword: 'IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT '
+ 'EQ LT GT NE GE LE OR XOR'
};
// TODO: post v12 lets use look-behind, until then \b and a callback filter will be used
// const LETTER_BOUNDARY_RE = /(?<![A-Z])/;
const LETTER_BOUNDARY_RE = /\b/;
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_START = {
className: 'meta',
begin: '([O])([0-9]+)'
};
const NUMBER = hljs.inherit(hljs.C_NUMBER_MODE, { begin: '([-+]?((\\.\\d+)|(\\d+)(\\.\\d*)?))|' + hljs.C_NUMBER_RE });
const GCODE_CODE = [
// comments
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT(/\(/, /\)/),
hljs.COMMENT(/;/, /$/),
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
// gcodes
NUMBER,
hljs.inherit(hljs.APOS_STRING_MODE, { illegal: null }),
hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }),
{
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: [
// 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,
'on:begin': LETTER_BOUNDARY_CALLBACK
},
// T Tools
{ match: regex.concat(LETTER_BOUNDARY_RE, TOOLS_RE), },
{
begin: TOOLS_RE,
'on:begin': LETTER_BOUNDARY_CALLBACK
begin: 'N',
end: '\\d+',
illegal: '\\W'
}
]
},
{
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 {
@ -179,10 +66,14 @@ function gcode(hljs) {
// Some implementations (CNC controls) of G-code are interoperable with uppercase and lowercase letters seamlessly.
// However, most prefer all uppercase and uppercase is customary.
case_insensitive: true,
// TODO: post v12 with the use of look-behind this can be enabled
disableAutodetect: true,
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',
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)
relevance: 0
begin: hljs.C_NUMBER_RE + '[i]',
relevance: 1
},
{
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
}
hljs.C_NUMBER_MODE
]
},
{ begin: /:=/ // relevance booster

View File

@ -3,7 +3,6 @@ Language: Golo
Author: Philippe Charriere <ph.charriere@gmail.com>
Description: a lightweight dynamic language for the JVM
Website: http://golo-lang.org/
Category: system
*/
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.
Website: https://gradle.org
Author: Damian Mee <mee.damian@gmail.com>
Category: build-system
*/
function gradle(hljs) {

View File

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

View File

@ -7,32 +7,8 @@ Category: functional
*/
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: [
// Double dash forms a valid comment only if it's not part of legal lexeme.
// 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
};
/* 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 = {
className: 'number',
relevance: 0,
@ -103,7 +92,6 @@ function haskell(hljs) {
+ 'qualified type data newtype deriving class instance as default '
+ 'infix infixl infixr foreign export ccall stdcall cplusplus '
+ 'jvm dotnet safe unsafe family forall mdo proc rec',
unicodeRegex: true,
contains: [
// Top-level constructions.
{
@ -205,8 +193,6 @@ function haskell(hljs) {
NUMBER,
CONSTRUCTOR,
hljs.inherit(hljs.TITLE_MODE, { begin: '^[_a-z][\\w\']*' }),
// No markup, prevents infix operators from being recognized as comments.
{ begin: `(?!-)${symbol}--+|--+(?!-)${symbol}`},
COMMENT,
{ // No markup, relevance booster
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)
Contributors: Kenton Hamaluik <kentonh@gmail.com>
Website: https://haxe.org
Category: system
*/
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 ';
@ -19,8 +14,8 @@ function haxe(hljs) {
name: 'Haxe',
aliases: [ 'hx' ],
keywords: {
keyword: 'abstract 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 '
keyword: 'break case cast catch continue default do dynamic else enum extern '
+ '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 '
+ HAXE_BASIC_TYPES,
built_in:
@ -37,12 +32,12 @@ function haxe(hljs) {
hljs.BACKSLASH_ESCAPE,
{
className: 'subst', // interpolation
begin: /\$\{/,
end: /\}/
begin: '\\$\\{',
end: '\\}'
},
{
className: 'subst', // interpolation
begin: /\$/,
begin: '\\$',
end: /\W\}/
}
]
@ -50,20 +45,11 @@ function haxe(hljs) {
hljs.QUOTE_STRING_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'number',
begin: HAXE_NUMBER_RE,
relevance: 0
},
{
className: 'variable',
begin: "\\$" + IDENT_RE,
},
hljs.C_NUMBER_MODE,
{
className: 'meta', // compiler meta
begin: /@:?/,
end: /\(|$/,
excludeEnd: true,
begin: '@:',
end: '$'
},
{
className: 'meta', // compiler conditionals
@ -73,55 +59,55 @@ function haxe(hljs) {
},
{
className: 'type', // function types
begin: /:[ \t]*/,
end: /[^A-Za-z0-9_ \t\->]/,
begin: ':[ \t]*',
end: '[^A-Za-z0-9_ \t\\->]',
excludeBegin: true,
excludeEnd: true,
relevance: 0
},
{
className: 'type', // types
begin: /:[ \t]*/,
end: /\W/,
begin: ':[ \t]*',
end: '\\W',
excludeBegin: true,
excludeEnd: true
},
{
className: 'type', // instantiation
beginKeywords: 'new',
end: /\W/,
begin: 'new *',
end: '\\W',
excludeBegin: true,
excludeEnd: true
},
{
className: 'title.class', // enums
className: 'class', // enums
beginKeywords: 'enum',
end: /\{/,
end: '\\{',
contains: [ hljs.TITLE_MODE ]
},
{
className: 'title.class', // abstracts
begin: '\\babstract\\b(?=\\s*' + hljs.IDENT_RE + '\\s*\\()',
end: /[\{$]/,
className: 'class', // abstracts
beginKeywords: 'abstract',
end: '[\\{$]',
contains: [
{
className: 'type',
begin: /\(/,
end: /\)/,
begin: '\\(',
end: '\\)',
excludeBegin: true,
excludeEnd: true
},
{
className: 'type',
begin: /from +/,
end: /\W/,
begin: 'from +',
end: '\\W',
excludeBegin: true,
excludeEnd: true
},
{
className: 'type',
begin: /to +/,
end: /\W/,
begin: 'to +',
end: '\\W',
excludeBegin: true,
excludeEnd: true
},
@ -130,15 +116,15 @@ function haxe(hljs) {
keywords: { keyword: 'abstract from to' }
},
{
className: 'title.class', // classes
begin: /\b(class|interface) +/,
end: /[\{$]/,
className: 'class', // classes
begin: '\\b(class|interface) +',
end: '[\\{$]',
excludeEnd: true,
keywords: 'class interface',
contains: [
{
className: 'keyword',
begin: /\b(extends|implements) +/,
begin: '\\b(extends|implements) +',
keywords: 'extends implements',
contains: [
{
@ -152,11 +138,11 @@ function haxe(hljs) {
]
},
{
className: 'title.function',
className: 'function',
beginKeywords: 'function',
end: /\(/,
end: '\\(',
excludeEnd: true,
illegal: /\S/,
illegal: '\\S',
contains: [ hljs.TITLE_MODE ]
}
],

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,6 @@ Description: Julia REPL sessions
Author: Morten Piibeleht <morten.piibeleht@gmail.com>
Website: https://julialang.org
Requires: julia.js
Category: scientific
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>
Contributors: Alex Arslan <ararslan@comcast.net>, Fredrik Ekre <ekrefredrik@gmail.com>
Website: https://julialang.org
Category: scientific
*/
function julia(hljs) {

View File

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

View File

@ -3,7 +3,6 @@ Language: Lasso
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.
Website: http://www.lassosoft.com/What-Is-Lasso
Category: database, web
*/
function lasso(hljs) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -216,12 +216,6 @@ function markdown(hljs) {
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 {
name: 'Markdown',
aliases: [
@ -239,8 +233,7 @@ function markdown(hljs) {
CODE,
HORIZONTAL_RULE,
LINK,
LINK_REFERENCE,
ENTITY
LINK_REFERENCE
]
};
}

View File

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

View File

@ -3,7 +3,6 @@ Language: Mercury
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.
Website: https://www.mercurylang.org
Category: functional
*/
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.
Author: Arthur Bikmullin <devolonter@gmail.com>
Website: https://blitzresearch.itch.io/monkey2
Category: gaming
*/
function monkey(hljs) {

View File

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

View File

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

View File

@ -3,369 +3,91 @@ Language: Nix
Author: Domen Kožar <domen@dev.si>
Description: Nix functional language
Website: http://nixos.org/nix
Category: system
*/
/** @type LanguageFn */
function nix(hljs) {
const regex = hljs.regex;
const KEYWORDS = {
keyword: [
"assert",
"else",
"if",
"rec",
"with",
"let",
"in",
"inherit",
"let",
"or",
"rec",
"then",
"with",
"assert",
"if",
"else",
"then"
],
literal: [
"true",
"false",
"null",
"or",
"and",
"null"
],
built_in: [
// toplevel builtins
"import",
"abort",
"baseNameOf",
"builtins",
"derivation",
"derivationStrict",
"dirOf",
"fetchGit",
"fetchMercurial",
"fetchTarball",
"fetchTree",
"fromTOML",
"import",
"isNull",
"builtins",
"map",
"placeholder",
"removeAttrs",
"scopedImport",
"throw",
"toString",
],
"derivation"
]
};
const BUILTINS = {
scope: 'built_in',
match: regex.either(...[
"abort",
"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 ANTIQUOTE = {
className: 'subst',
begin: /\$\{/,
end: /\}/,
keywords: KEYWORDS
};
const IDENTIFIER_REGEX = '[A-Za-z_][A-Za-z0-9_\'-]*';
const LOOKUP_PATH = {
scope: 'symbol',
match: new RegExp(`<${IDENTIFIER_REGEX}(/${IDENTIFIER_REGEX})*>`),
const ESCAPED_DOLLAR = {
className: 'char.escape',
begin: /''\$/,
};
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 = {
beforeMatch: /(^|\{|;)\s*/,
begin: new RegExp(`${IDENTIFIER_REGEX}(\\.${IDENTIFIER_REGEX})*\\s*=(?!=)`),
begin: /[a-zA-Z0-9-_]+(\s*=)/,
returnBegin: true,
relevance: 0,
contains: [
{
scope: 'attr',
match: new RegExp(`${IDENTIFIER_REGEX}(\\.${IDENTIFIER_REGEX})*(?=\\s*=)`),
relevance: 0.2,
className: 'attr',
begin: /\S+/,
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 = {
scope: 'string',
className: 'string',
contains: [ ESCAPED_DOLLAR, ANTIQUOTE ],
variants: [
{
begin: "''",
end: "''",
contains: [
INDENTED_ESCAPED_DOLLAR,
ANTIQUOTE,
ESCAPED_DOUBLEQUOTE,
ESCAPED_LITERAL,
],
end: "''"
},
{
begin: '"',
end: '"',
contains: [
NORMAL_ESCAPED_DOLLAR,
ANTIQUOTE,
ESCAPED_LITERAL,
],
},
],
end: '"'
}
]
};
const FUNCTION_PARAMS = {
scope: 'params',
match: new RegExp(`${IDENTIFIER_REGEX}\\s*:(?=\\s)`),
};
const EXPRESSIONS = [
NUMBER,
hljs.NUMBER_MODE,
hljs.HASH_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT(
/\/\*\*(?!\/)/,
/\*\//,
{
subLanguage: 'markdown',
relevance: 0
}
),
BUILTINS,
STRING,
LOOKUP_PATH,
PATH,
FUNCTION_PARAMS,
ATTRS,
MINUS_OPERATOR,
OPERATOR,
ATTRS
];
ANTIQUOTE.contains = EXPRESSIONS;
const REPL = [
{
scope: 'meta.prompt',
match: /^nix-repl>(?=\s)/,
relevance: 10,
},
{
scope: 'meta',
beforeMatch: /\s+/,
begin: /:([a-z]+|\?)/,
},
];
return {
name: 'Nix',
aliases: [ "nixos" ],
keywords: KEYWORDS,
contains: EXPRESSIONS.concat(REPL),
contains: EXPRESSIONS
};
}

View File

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

View File

@ -3,7 +3,6 @@ Language: Oxygene
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.
Website: https://www.elementscompiler.com/elements/default.aspx
Category: build-system
*/
function oxygene(hljs) {

View File

@ -26,7 +26,6 @@ function perl(hljs) {
'chown',
'chr',
'chroot',
'class',
'close',
'closedir',
'connect',
@ -56,7 +55,6 @@ function perl(hljs) {
'exit',
'exp',
'fcntl',
'field',
'fileno',
'flock',
'for',
@ -116,7 +114,6 @@ function perl(hljs) {
'lt',
'ma',
'map',
'method',
'mkdir',
'msgctl',
'msgget',
@ -261,45 +258,19 @@ function perl(hljs) {
end: /\}/
// contains defined later
};
const ATTR = {
scope: 'attr',
match: /\s+:\s*\w+(\s*\(.*?\))?/,
};
const VAR = {
scope: 'variable',
variants: [
{ begin: /\$\d/ },
{ begin: regex.concat(
/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,
// negative look-ahead tries to avoid matching patterns that are not
// 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 VAR = { variants: [
{ begin: /\$\d/ },
{ begin: regex.concat(
/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,
// negative look-ahead tries to avoid matching patterns that are not
// Perl at all like $ident$, @ident@, etc.
`(?![A-Za-z])(?![@$%])`
) },
{
begin: /[$%@][^\s\w{]/,
relevance: 0
}
] };
const STRING_CONTAINS = [
hljs.BACKSLASH_ESCAPE,
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
begin: '(\\/\\/|' + hljs.RE_STARTERS_RE + '|\\b(split|return|print|reverse|grep)\\b)\\s*',
keywords: 'split return print reverse grep',
@ -456,19 +431,11 @@ function perl(hljs) {
},
{
className: 'function',
beginKeywords: 'sub method',
beginKeywords: 'sub',
end: '(\\s*\\(.*?\\))?[;{]',
excludeEnd: true,
relevance: 5,
contains: [ hljs.TITLE_MODE, ATTR ]
},
{
className: 'class',
beginKeywords: 'class',
end: '[;{]',
excludeEnd: true,
relevance: 5,
contains: [ hljs.TITLE_MODE, ATTR, NUMBER ]
contains: [ hljs.TITLE_MODE ]
},
{
begin: '-\\w\\b',

View File

@ -14,7 +14,6 @@ Description:
- 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
some names highlighted while others not looks ugly.
Category: database
*/
function pgsql(hljs) {

View File

@ -22,15 +22,12 @@ function php(hljs) {
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,}/,
NOT_PERL_ETC);
const UPCASE_NAME_RE = regex.concat(
/[A-Z]+/,
NOT_PERL_ETC);
const VARIABLE = {
scope: 'variable',
match: '\\$+' + IDENT_RE,
};
const PREPROCESSOR = {
scope: "meta",
scope: 'meta',
variants: [
{ begin: /<\?php/, relevance: 10 }, // boost for obvious PHP
{ begin: /<\?=/ },
@ -444,12 +441,7 @@ function php(hljs) {
];
const ATTRIBUTES = {
begin: regex.concat(/#\[\s*\\?/,
regex.either(
PASCAL_CASE_CLASS_NAME_RE,
UPCASE_NAME_RE
)
),
begin: regex.concat(/#\[\s*/, PASCAL_CASE_CLASS_NAME_RE),
beginScope: "meta",
end: /]/,
endScope: "meta",
@ -479,10 +471,7 @@ function php(hljs) {
...ATTRIBUTE_CONTAINS,
{
scope: 'meta',
variants: [
{ match: PASCAL_CASE_CLASS_NAME_RE },
{ match: UPCASE_NAME_RE }
]
match: PASCAL_CASE_CLASS_NAME_RE
}
]
};
@ -562,7 +551,6 @@ function php(hljs) {
keywords: KEYWORDS,
contains: [
'self',
ATTRIBUTES,
VARIABLE,
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
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,
capabilities-secure, high performance programming language.
Website: https://www.ponylang.io
Category: system
*/
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>
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/
Category: scripting
*/
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.
Author: Raivo Laanemets <raivo@infdot.com>
Website: https://en.wikipedia.org/wiki/Prolog
Category: functional
*/
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)
Credits: I've taken inspiration from the PureBasic language file for GeSHi, created by Gustavo Julio Fiorenza (GuShH).
Website: https://www.purebasic.com
Category: system
*/
// Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000;

View File

@ -373,8 +373,7 @@ function python(hljs) {
NUMBER,
{
// very common convention
scope: 'variable.language',
match: /\bself\b/
begin: /\bself\b/
},
{
// eat "if" prior to string so that it won't accidentally be
@ -382,7 +381,6 @@ function python(hljs) {
beginKeywords: "if",
relevance: 0
},
{ match: /\bor\b/, scope: "keyword" },
STRING,
COMMENT_TYPE,
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)
Author: Sergey Vidyuk <svidyuk@gmail.com>
Website: https://kx.com/connect-with-us/developers/
Category: enterprise, functional, database
*/
function q(hljs) {

View File

@ -6,135 +6,301 @@ Author: Gidi Meir Morris <oss@gidi.io>
Category: functional
*/
function reasonml(hljs) {
const BUILT_IN_TYPES = [
"array",
"bool",
"bytes",
"char",
"exn|5",
"float",
"int",
"int32",
"int64",
"list",
"lazy_t|5",
"nativeint|5",
"ref",
"string",
"unit",
function orReValues(ops) {
return ops
.map(function(op) {
return op
.split('')
.map(function(char) {
return '\\' + char;
})
.join('');
})
.join('|');
}
const RE_IDENT = '~?[a-z$_][0-9a-zA-Z$_]*';
const RE_MODULE_IDENT = '`?[A-Z$_][0-9a-zA-Z$_]*';
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 {
name: 'ReasonML',
aliases: [ 're' ],
keywords: {
$pattern: /[a-z_]\w*!?/,
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: /(:-|:=|\$\{|\+=)/,
keywords: KEYWORDS,
illegal: '(:-|:=|\\$\\{|\\+=)',
contains: [
hljs.COMMENT('/\\*', '\\*/', { illegal: '^(#,\\/\\/)' }),
{
scope: 'literal',
match: /\[(\|\|)?\]|\(\)/,
className: 'character',
begin: '\'(\\\\[^\']+|[^\'])\'',
illegal: '\\n',
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.COMMENT(/\/\*/, /\*\//, { illegal: /^(#,\/\/)/ }),
{ /* type variable */
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
},
PATTERN_MATCH_BLOCK_MODE,
FUNCTION_BLOCK_MODE,
{
scope: 'operator',
match: /\s+(\|\||\+[\+\.]?|\*[\*\/\.]?|\/[\.]?|\.\.\.|\|>|&&|===?)\s+/,
relevance: 0
},
hljs.inherit(hljs.APOS_STRING_MODE, {
scope: 'string',
relevance: 0
}),
hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }),
{
scope: 'number',
variants: [
{ match: /\b0[xX][a-fA-F0-9_]+[Lln]?/ },
{ match: /\b0[oO][0-7_]+[Lln]?/ },
{ match: /\b0[bB][01_]+[Lln]?/ },
{ match: /\b[0-9][0-9_]*([Lln]|(\.[0-9_]*)?([eE][-+]?[0-9_]+)?)/ },
],
relevance: 0
className: 'module-def',
begin: "\\bmodule\\s+" + RE_IDENT + "\\s+" + RE_MODULE_IDENT + "\\s+=\\s+\\{",
end: /\}/,
returnBegin: true,
keywords: KEYWORDS,
relevance: 0,
contains: [
{
className: 'module',
relevance: 0,
begin: RE_MODULE_IDENT
},
{
begin: /\{/,
end: /\}/,
relevance: 0,
skip: true
}
].concat(MODULE_ACCESS_CONTENTS)
},
MODULE_ACCESS_MODE
]
};
}

View File

@ -3,7 +3,6 @@ Language: MikroTik RouterOS script
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
Website: https://wiki.mikrotik.com/wiki/Manual:Scripting
Category: scripting
*/
// 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/
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>
Category: common, scripting
Category: common
*/
function ruby(hljs) {
@ -350,7 +350,7 @@ function ruby(hljs) {
},
{
className: 'params',
begin: /\|(?!=)/,
begin: /\|/,
end: /\|/,
excludeBegin: true,
excludeEnd: true,

View File

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

View File

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

View File

@ -88,11 +88,7 @@ function scala(hljs) {
excludeBegin: true,
excludeEnd: true,
relevance: 0,
contains: [
TYPE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
]
contains: [ TYPE ]
},
{
className: 'params',
@ -101,11 +97,7 @@ function scala(hljs) {
excludeBegin: true,
excludeEnd: true,
relevance: 0,
contains: [
TYPE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
]
contains: [ TYPE ]
},
NAME
]
@ -159,34 +151,6 @@ function scala(hljs) {
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 {
name: 'Scala',
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'
},
contains: [
USING_DIRECTIVE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
STRING,

View File

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

View File

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

View File

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

View File

@ -24,19 +24,19 @@ function sql(hljs) {
const regex = hljs.regex;
const COMMENT_MODE = hljs.COMMENT('--', '$');
const STRING = {
scope: 'string',
className: 'string',
variants: [
{
begin: /'/,
end: /'/,
contains: [ { match: /''/ } ]
contains: [ { begin: /''/ } ]
}
]
};
const QUOTED_IDENTIFIER = {
begin: /"/,
end: /"/,
contains: [ { match: /""/ } ]
contains: [ { begin: /""/ } ]
};
const LITERALS = [
@ -606,42 +606,22 @@ function sql(hljs) {
});
const VARIABLE = {
scope: "variable",
match: /@[a-z0-9][a-z0-9_]*/,
className: "variable",
begin: /@[a-z0-9][a-z0-9_]*/,
};
const OPERATOR = {
scope: "operator",
match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
className: "operator",
begin: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
relevance: 0,
};
const FUNCTION_CALL = {
match: regex.concat(/\b/, regex.either(...FUNCTIONS), /\s*\(/),
begin: regex.concat(/\b/, regex.either(...FUNCTIONS), /\s*\(/),
relevance: 0,
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
function reduceRelevancy(list, {
exceptions, when
@ -674,10 +654,19 @@ function sql(hljs) {
},
contains: [
{
scope: "type",
match: kws_to_regex(MULTI_WORD_TYPES)
begin: regex.either(...COMBOS),
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,
VARIABLE,
STRING,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,6 @@ Language: Vala
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.
Website: https://wiki.gnome.org/Projects/Vala
Category: system
*/
function vala(hljs) {

View File

@ -4,7 +4,6 @@ Author: Jon Evans <jon@craftyjon.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.
Website: http://www.verilog.com
Category: hardware
*/
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>
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
Category: hardware
*/
function vhdl(hljs) {

View File

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

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