Skip to content

Commit 3919816

Browse files
0xflotusmertyildiranjoshgoebeldullinpplantinga
authored
merge master (#3)
* (docs) Add Chaos to supported languages (highlightjs#2510) * fix(parser) fixes sublanguage with no rule matches (highlightjs#2506) * fix(parser) fixes sublanguage with no rule matches Resolves highlightjs#2504. * (chore) Add ESLint config and clean up the major stuff (highlightjs#2503) * (chore) eslint:recommended * (chore): eslint_standard * relax eslint rules for language grammars (to discourage rewriting them in one fell swoop; I'd rather have the blame history intact) * remove extra escaping * clean up variables * more camelcase * (docs) Add Visual Basic for Applications (VBA) to supported languages (highlightjs#2512) * (yaml) improve tag support; add verbatim tags (highlightjs#2487) * YAML parse non-word characters as part of tags * adds support for verbatim tags Co-authored-by: Josh Goebel <[email protected]> * fix(javascript/typescript): lambda with parens in parameters fails (highlightjs#2502) * fix(javascript/typescript): lambda with parens in parameters fails - Fixes both JavaScript and TypeScript grammars Fixes samples like: const bad = ((a, b) => [...a, b]); sides.every((length,width=(3+2+(4/5))) => length > 0 ); This is done by counting parens in the regex that finds arrows functions. Currently we can only handle 2 levels of nesting as shown in the second example above. * allow much richer highlighting inside params * improve highlighting inside arguments on typescript * enh(cpp): Improve highlighting of unterminated raw strings PR highlightjs#1897 switched C++ raw strings to use backreferences, however this breaks souce files where raw strings are truncated. Like comments, it would be preferable to highlight them. - Add `on:begin` and `on:end` to allow more granular matching when then end match is dynamic and based on a part of the begin match - This deprecates the `endSameAsBegin` attribute. That attribute was a very specific way to solve this problem, but now we have a much more general solution in these added callbacks. Also related: highlightjs#2259. Co-authored-by: Josh Goebel <[email protected]> * (chore) C-like uses the new END_SAME_AS_BEGIN mode * (chore) Ruby uses END_SAME_AS_BEGIN mode/rule * (parser) make END_SAME_AS_BEGIN a function helper Adds a mode helper to replace the deprecated `endSameAsBegin` attribute. The first match group from the begin regex will be compared to the first match group from the end regex and the end regex will only match if both strings are identical. Note this is more advanced functionality than before since now you can match a larger selection of text yet only use a small portion of it for the actual "end must match begin" portion. * (pgsql) add test for $$ quoting existing behavior - even if that existing behavior is questionable - the ending span should really close before the $$, not after Fixing this would involve delving into the sublanguage behavior and I'm not sure we have time to tackle that right this moment. * (chore) pgsql uses END_SAME_AS_BEGIN mode/rule now also * (docs) rename to `mode_reference`; docs for callbacks - I can never find this file because it's name didn't fully match. - rename callbacks to `on:begin` and `on:end` * prevented setter keyword conflicting with setTimeout|setInterval and highlighted them (highlightjs#2514) (highlightjs#2515) * fix(javascript) prevent setter keyword 'set' conflicting with setTimeout|setInterval (highlightjs#2514) * enh(javascript) setTimeout|setInterval now highlighted (highlightjs#2514) * enh (javascript) clearInterval and clearTimeout now highlighted * add keywords to TypeScript also * (docs) add TLDR instructions for building and testing * (dev) improve developer tool UI * (parser) Build common EMCAscript foundation Builds a common keyword foundation for any grammar that is building on top of JavaScript: - LiveScript - CoffeeScript - TypeScript Also uses this common foundation for JS itself. * (parser) Adds SHEBANG mode * (yaml) Add support for inline sequences and mappings (highlightjs#2513) * Use containers to match inline sequences and mappings * Add string type for inside inline elements * Handle nested inline sequences and mappings * Disallow all braces brackets and commas from strings inside inline mappings or sequences * clean up implementation * feed the linter Co-authored-by: Josh Goebel <[email protected]> * [enh] Add `OPTIMIZE:` and `HACK:` to comment doctags * (build) browser build is CommonJS and IIFE, no more AMD (highlightjs#2511) * (build) browser build is CommonJS and IIFE (global) now * (build) dropping support for AMD, which we never truly supported properly in the first place * (build) add test to make sure browser build works as commonJS module Resolves highlightjs#2505 * fix(parser) Fix freezing issue with illegal 0 width matches (highlightjs#2524) * fix[parser] add edge case handle for illegal 0 width matches * add last ditch catch all that tries to detect other uncaught freezes * (docs) added unicorn-rails-log as an 3rd-party language (highlightjs#2528) - (docs) Add syntax highlighting for Rails Unicorn logging to supported languages. * (docs) fix supported languages link: it moved again! (highlightjs#2533) * fix(ts/js) use identifier to match potential keywords (highlightjs#2519) - (parser) Adds `keywords.$pattern` key to grammar definitions - `lexemes` is now deprecated in favor of `keywords.$pattern` key - enh(typescript) use identifier to match potential keywords, preventing false positives - enh(javascript) use identifier to match potential keywords, preventing false positives * fix(javascript) fix regex inside parens after a non-regex (highlightjs#2531) * make the object attr container smarter * deal with multi-line comments also * comments in any order, spanning multiple lines Essentially makes the object attr container much more sensitive by allowing it to look-ahead thru comments to find object keys - and therefore prevent them from being incorrectly matched by the "value container" rule. * (parser) Add hljs.registerAlias() public API (highlightjs#2540) * Add hljs.registerAlias(alias, languageName) public API * Add .registerAlias() test * enh(cpp) add `pair`, `make_pair`, `priority_queue` as built-ins (highlightjs#2538) * (fix) `fixMarkup` would rarely destroy markup when `useBR` was enabled (highlightjs#2532) * enh(cpp) Recognize `priority_queue`, `pair` as containers (highlightjs#2541) * chore: rename `registerAlias` to `registerAliases` Plural form is clearly better as it's not surprising to the reader to see it being passed an array - where as the singular form might have been. Meanwhile it's also easy to assume that it also supports arrays of any size - including an array with a singular alias. The fact that it can magically accept a string as the first argument might not be obvious, but we document it and even if one didn't know this they could still use the array form of the API without any issue by passing a one item array. * (swift) @objcMembers not completely highlighted (highlightjs#2543) * Fixed @objcMembers in Swift Would match `@objc` first, and the `Members` part would be unhighlighted * Update CHANGES.md * Update swift.js * (docs) add OCL to list of supported languages (highlightjs#2547) * (docs) Add Svelte to list of supported languages (highlightjs#2549) * enh(dart) Add `late` and `required` keywords, and `Never` built-in type (Dart 2.9) (highlightjs#2551) * Add new Dart 2.9 keywords for Null Safety language feature * enh(erlang) add support for underscore separators in numeric literals (highlightjs#2554) * (erlang) add support for underscore separators in numeric literals * (erlang) add tests * (docs) add Jolie to Supported Languages (highlightjs#2556) * (parser/docs) Add jsdoc annotations and TypeScript type file (highlightjs#2517) Adds JSDoc annotations and a .tsconfig that allows TypeScript to be run in it's "allowJS" mode and apply type and sanity checking to JavaScript code also. See Type Checking JavaScript Files. I've been using TypeScript a lot lately and finding it very beneficial and wanted to get those same benefits here but without converting the whole project to TypeScript. It was rough at the beginning but now that this is finished I think it's about 80%-90% of the benefits without any of the TS compilation pipeline. The big difference in being JSDoc for adding typing information vs inline types with TypeScript. Should be super helpful for maintainers using an editor with tight TypeScript integration and the improved docs/comments should help everyone else. - Adds types/index.d.ts to NPM build (should be useful for TypeScript peeps) - Improves documentation of many functions - Adds JSDoc annotations to almost all functions - Adds JSDoc type annotations to variables that can't be inferred - Refactors a few smaller things to allow the TypeScript compiler to better infer what is happening (and usually also made the code clearer) * (parser) highlightBlock result key `re` => `relevance` (highlightjs#2553) * enh(handlebars) Support for sub-expressions, path-expressions, hashes, block-parameters and literals (highlightjs#2344) - `htmlbars` grammar is now deprecated. Use `handlebars` instead. A stub is included so that anyone literally referencing the old `htmlbars` file (say manually requiring it in Node.js, etc) is still covered, but everyone should transition to `handlebars` now. * fix(typescript) Add missing `readonly` keyword (highlightjs#2562) * (docs) Mention `c` is a possible class for C (highlightjs#2577) * fix(groovy) strings are not allowed inside ternary clauses (highlightjs#2565) * fix(groovy) strings are not allowed inside ternary clauses * whitespace can also include tabs * Update @typescript-eslint/parser to the latest version 🚀 (highlightjs#2575) * chore(package): update @typescript-eslint/parser to version 3.0.0 * chore(package): update lockfile package-lock.json Co-authored-by: greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com> Co-authored-by: Josh Goebel <[email protected]> * Update @typescript-eslint/eslint-plugin to the latest version 🚀 (highlightjs#2576) * chore(package): update @typescript-eslint/eslint-plugin to version 3.0.0 * chore(package): update lockfile package-lock.json Co-authored-by: greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com> Co-authored-by: Josh Goebel <[email protected]> * (parser) properly escape ' and " in HTML output (highlightjs#2564) * escape quotes also in final HTML output * [style] update test coding style * update markup tests with new escaping This shouldn't be a security issue -- we've always escaped double quotes inside of HTML attribute values (where they could be used to break out of context) - and we've always used double quotes for enclosing attribute values. This just goes all the way and now properly escapes quotes everywhere. Better safe than sorry. * (docs) add changelog entry for last PR * add nnfx theme (highlightjs#2571) * (themes) Add new lioshi theme (highlightjs#2581) * Added Cisco Command Line to SUPPORTED_LANGUAGES.md (highlightjs#2583) * (themes) add `nnfx-dark` theme (highlightjs#2584) * enh(protobuf) Support multiline comments (highlightjs#2597) * enh(java) added support for hexadecimal floating point literals (highlightjs#2509) - Added support for many additional types of floating point literals - Added related tests There still may be a few gaps, but this is a pretty large improvement. Co-authored-by: Josh Goebel <[email protected]> * (chore) Update issue templates (highlightjs#2574) Co-authored-by: Vladimir Jimenez <[email protected]> * enh(toml)(ini) Improve parsing of complex keys (highlightjs#2595) Fixes: highlightjs#2594 * (chore) add `.js` extension to import statements (highlightjs#2601) Adds file extensions to all import specifiers in ./src/ files. This is useful to run the files straight from source with a web browser , Node.js ESM or Deno. - Also add eslint rules regarding extensions for imports * enh(dart) highlight built-in nullable types (highlightjs#2598) * Dart: allow built-in nullable types with trailing ? to be highlighted * enh(csharp) highlight generics in more cases (highlightjs#2599) * (chore) fix tiny style issues, add linting npm task - fixes tiny style issues - adds `npm run lint` for linting the main library source (not languages which are still much messier) * (chore) bump dev dependencies * (chore) upgrade some dev stuff to newer versions * bump v10.1.0 * (chore) bump copyright * (chore) more import below metadata comment Co-authored-by: M. Mert Yıldıran <[email protected]> Co-authored-by: Josh Goebel <[email protected]> Co-authored-by: Hugo Leblanc <[email protected]> Co-authored-by: Peter Massey-Plantinga <[email protected]> Co-authored-by: David Benjamin <[email protected]> Co-authored-by: Vania Kucher <[email protected]> Co-authored-by: SweetPPro <[email protected]> Co-authored-by: Alexandre ZANNI <[email protected]> Co-authored-by: Taufik Nurrohman <[email protected]> Co-authored-by: Lin <[email protected]> Co-authored-by: nicked <[email protected]> Co-authored-by: Nicolas Homble <[email protected]> Co-authored-by: Ryandi Tjia <[email protected]> Co-authored-by: Sam Rawlins <[email protected]> Co-authored-by: Sergey Prokhorov <[email protected]> Co-authored-by: Brian Alberg <[email protected]> Co-authored-by: Nils Knappmeier <[email protected]> Co-authored-by: Martin <[email protected]> Co-authored-by: Derek Lewis <[email protected]> Co-authored-by: greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com> Co-authored-by: Jim Mason <[email protected]> Co-authored-by: lioshi <[email protected]> Co-authored-by: BMatheas <[email protected]> Co-authored-by: Pavel Evstigneev <[email protected]> Co-authored-by: Vladimir Jimenez <[email protected]> Co-authored-by: Antoine du Hamel <[email protected]> Co-authored-by: TupikovVladimir <[email protected]>
1 parent 2d90a5c commit 3919816

File tree

331 files changed

+6437
-2046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+6437
-2046
lines changed

.eslintrc.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"node": true,
6+
"mocha": true
7+
},
8+
"extends": [
9+
"eslint:recommended",
10+
"standard"
11+
],
12+
"globals": {
13+
"Atomics": "readonly",
14+
"SharedArrayBuffer": "readonly"
15+
},
16+
"parserOptions": {
17+
"ecmaVersion": 2018,
18+
"sourceType": "module"
19+
},
20+
"parser": '@typescript-eslint/parser',
21+
"plugins": [
22+
"@typescript-eslint"
23+
],
24+
"rules": {
25+
"array-callback-return": "error",
26+
"block-scoped-var": "error",
27+
// we like our semi-colons
28+
"semi": ["error","always"],
29+
// our codebase doesn't do this at all, so disabled for now
30+
"space-before-function-paren": ["error","never"],
31+
// for now ignore diff between types of quoting
32+
"quotes": "off",
33+
// this is the style we are already using
34+
"operator-linebreak": ["error","before", { "overrides": { "?": "after", ":": "after", "+": "after" } }],
35+
// sometimes we declare variables with extra spacing
36+
"indent": ["error", 2, {"VariableDeclarator":2}],
37+
// seems like a good idea not to use explicit undefined
38+
"no-undefined": "error",
39+
// ensure import specifier contains file extension
40+
"import/extensions": ["error", "always"],
41+
42+
// TODO maybe
43+
"camelcase": "off", // TODO: turn on later
44+
"init-declarations": ["error","always"]
45+
},
46+
"overrides": [
47+
{
48+
"files": ["src/**/*.js"],
49+
"rules": {
50+
// make sure there is no Node.js specific API slipping into the source files
51+
"import/no-nodejs-modules": "error",
52+
"import/no-commonjs": "error",
53+
}
54+
},
55+
{
56+
"files": ["src/languages/*.js"],
57+
"rules": {
58+
"no-unused-expressions": "off",
59+
// languages are all over the map and we don't want to
60+
// do a mass edit so turn off the most egregious rule violations
61+
"indent": "off",
62+
"comma-dangle": "off",
63+
"array-bracket-spacing": "off",
64+
"object-curly-spacing": "off",
65+
"key-spacing": "off",
66+
"object-curly-newline": "off",
67+
"object-property-newline": "off"
68+
}
69+
}
70+
]
71+
};
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Language request
3+
about: I really wish Highlight.js could highlight ...
4+
title: PLEASE read the below carefully.
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
First let us say that we'd also love it if Highlight.js could highlight whichever language you're about to request support for! And there is a chance you can help make that happen! But first...
11+
12+
...PLEASE READ THE FOLLOWING...
13+
14+
Highlight.js does not have a fundamental plan for implementing new languages
15+
- i.e., the core team doesn't usually develop new languages. The core team
16+
instead focuses on parser development, bugs, and supporting the existing
17+
languages. They also currently does not have time to review, merge and
18+
maintain any additional languages (fixing bugs, dealing with issues, etc).
19+
20+
Instead, the project works by encouraging 3rd party language grammars from
21+
contributors willing to help develop and maintain them. We're also happy to
22+
host those 3rd party language grammars at the ``highlightjs`` GitHub
23+
organization - no matter how obscure or weird. Or you're wlecome to host it
24+
yourself - we're still happy to link to it.
25+
26+
This means that *there's no point in requesting a new language without also
27+
providing a 3rd party implementation* (we'll simply close "Please support
28+
language Xyz" issues with a link to this explanation). If you'd like to see
29+
a particular language available but cannot implement it, the best way to
30+
make it happen is to find another developer interested in doing so.
31+
32+
For more info on actually developing a language see our :doc:`language-guide`,
33+
and for information on how to properly package your 3rd party language module
34+
see :doc:`language-contribution`.
35+
36+
If you are interested in contributing a 3rd party language grammar you can start with:
37+
38+
- https://highlightjs.readthedocs.io/en/latest/language-contribution.html
39+
40+
---
41+
42+
You actually don't need to create this issue at all unless you have a specific question about the 3rd party language grammar creation process - which we'd be glad to answer.

.jshintrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// whole codebase isn't ES8/9 yet, but our tests and some things are
22
{
33
"esversion": 9,
4-
"node": true
4+
"node": true,
5+
// eslint warns us about semicolons
6+
"-W033": false
57
}

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@ script:
2929
npm run test
3030
else
3131
npm run test-browser
32+
# our browser build should also work fine as a Node.js CommonJS module
33+
node test/builds/browser_build_as_commonjs.js
3234
fi
3335
sudo: false # Use container-based architecture

AUTHORS.txt

+2
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,5 @@ Contributors:
286286
- G8t Guy <[email protected]>
287287
- Samia Ali <[email protected]>
288288
- Alexandre Grison <[email protected]>
289+
- Jim Mason <[email protected]>
290+

CHANGES.md

+92
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,95 @@
1+
## Version 10.1.0
2+
3+
New themes:
4+
5+
- *NNFX* and *NNFX-dark* by [Jim Mason][]
6+
- *lioshi* by [lioshi][]
7+
8+
Parser Engine:
9+
10+
- (parser) Now escapes quotes in text content when escaping HTML (#2564) [Josh Goebel][]
11+
- (parser) Adds `keywords.$pattern` key to grammar definitions (#2519) [Josh Goebel][]
12+
- (parser) Adds SHEBANG utility mode [Josh Goebel][]
13+
- (parser) Adds `registerAliases` method (#2540) [Taufik Nurrohman][]
14+
- (enh) Added `on:begin` callback for modes (#2261) [Josh Goebel][]
15+
- (enh) Added `on:end` callback for modes (#2261) [Josh Goebel][]
16+
- (enh) Added ability to programatically ignore begin and end matches (#2261) [Josh Goebel][]
17+
- (enh) Added `END_SAME_AS_BEGIN` mode to replace `endSameAsBegin` parser attribute (#2261) [Josh Goebel][]
18+
- (fix) `fixMarkup` would rarely destroy markup when `useBR` was enabled (#2532) [Josh Goebel][]
19+
20+
Deprecations:
21+
22+
- `htmlbars` grammar is now deprecated. Use `handlebars` instead. (#2344) [Nils Knappmeier][]
23+
- when using `highlightBlock` `result.re` deprecated. Use `result.relevance` instead. (#2552) [Josh Goebel][]
24+
- ditto for `result.second_best.re` => `result.second_best.relevance` (#2552)
25+
- `lexemes` is now deprecated in favor of `keywords.$pattern` key (#2519) [Josh Goebel][]
26+
- `endSameAsBegin` is now deprecated. (#2261) [Josh Goebel][]
27+
28+
Language Improvements:
29+
30+
- fix(groovy) strings are not allowed inside ternary clauses (#2217) [Josh Goebel][]
31+
- fix(typescript) add `readonly` keyword (#2562) [Martin (Lhoerion)][]
32+
- fix(javascript) fix regex inside parens after a non-regex (#2530) [Josh Goebel][]
33+
- enh(typescript) use identifier to match potential keywords, preventing false positivites (#2519) [Josh Goebel][]
34+
- enh(javascript) use identifier to match potential keywords, preventing false positivites (#2519) [Josh Goebel][]
35+
- [enh] Add `OPTIMIZE:` and `HACK:` to the labels highlighted inside comments [Josh Goebel][]
36+
- enh(typescript/javascript/coffeescript/livescript) derive ECMAscript keywords from a common foudation (#2518) [Josh Goebel][]
37+
- enh(typescript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Josh Goebel][]
38+
- enh(javascript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Vania Kucher][]
39+
- enh(cpp) add `pair`, `make_pair`, `priority_queue` as built-ins (#2538) [Hankun Lin][]
40+
- enh(cpp) recognize `priority_queue` `pair` as cpp containers (#2541) [Hankun Lin][]
41+
- fix(javascript) prevent `set` keyword conflicting with setTimeout, etc. (#2514) [Vania Kucher][]
42+
- fix(cpp) Fix highlighting of unterminated raw strings (#2261) [David Benjamin][]
43+
- fix(javascript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
44+
- fix(typescript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
45+
- fix(yaml) Fix tags to include non-word characters (#2486) [Peter Plantinga][]
46+
- fix(swift) `@objcMembers` was being partially highlighted (#2543) [Nick Randall][]
47+
- enh(dart) Add `late` and `required` keywords, the `Never` built-in type, and nullable built-in types (#2550) [Sam Rawlins][]
48+
- enh(erlang) Add underscore separators to numeric literals (#2554) [Sergey Prokhorov][]
49+
- enh(handlebars) Support for sub-expressions, path-expressions, hashes, block-parameters and literals (#2344) [Nils Knappmeier][]
50+
- enh(protobuf) Support multiline comments (#2597) [Pavel Evstigneev][]
51+
- fix(toml) Improve key parsing (#2595) [Antoine du Hamel][]
52+
53+
[Josh Goebel]: https://github.com/yyyc514
54+
[Peter Plantinga]: https://github.com/pplantinga
55+
[David Benjamin]: https://github.com/davidben
56+
[Vania Kucher]: https://github.com/qWici
57+
[Hankun Lin]: https://github.com/Linhk1606
58+
[Nick Randall]: https://github.com/nicked
59+
[Sam Rawlins]: https://github.com/srawlins
60+
[Sergey Prokhorov]: https://github.com/seriyps
61+
[Nils Knappmeier]: https://github.com/nknapp
62+
[Martin (Lhoerion)]: https://github.com/Lhoerion
63+
[Jim Mason]: https://github.com/RocketMan
64+
[lioshi]: https://github.com/lioshi
65+
[Pavel Evstigneev]: https://github.com/Paxa
66+
[Antoine du Hamel]: https://github.com/aduh95
67+
68+
69+
## Version 10.0.2
70+
71+
Brower build:
72+
73+
- [Issue](https://github.com/highlightjs/highlight.js/issues/2505) (bug) Fix: Version 10 fails to load as CommonJS module. (#2511) [Josh Goebel][]
74+
- [Issue](https://github.com/highlightjs/highlight.js/issues/2505) (removal) AMD module loading support has been removed. (#2511) [Josh Goebel][]
75+
76+
Parser Engine Changes:
77+
78+
- [Issue](https://github.com/highlightjs/highlight.js/issues/2522) fix(parser) Fix freez issue with illegal 0 width matches (#2524) [Josh Goebel][]
79+
80+
81+
[Josh Goebel]: https://github.com/yyyc514
82+
83+
84+
## Version 10.0.1
85+
86+
Parser Engine Changes:
87+
88+
- (bug) Fix sublanguage with no relevance score (#2506) [Josh Goebel][]
89+
90+
[Josh Goebel]: https://github.com/yyyc514
91+
92+
193
## Version 10.0.0
294

395
New languages:

SUPPORTED_LANGUAGES.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
3131
| BNF | bnf | |
3232
| Brainfuck | brainfuck, bf | |
3333
| C# | csharp, cs | |
34-
| C | h | |
34+
| C | c, h | |
3535
| C++ | cpp, hpp, cc, hh, c++, h++, cxx, hxx | |
3636
| C/AL | cal | |
3737
| Cache Object Script | cos, cls | |
@@ -40,6 +40,8 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
4040
| CSP | csp | |
4141
| CSS | css | |
4242
| Cap’n Proto | capnproto, capnp | |
43+
| Chaos | chaos, kaos | [highlightjs-chaos](https://github.com/chaos-lang/highlightjs-chaos) |
44+
| Cisco CLI | cisco | [highlightjs-cisco-cli](https://github.com/BMatheas/highlightjs-cisco-cli) |
4345
| Clojure | clojure, clj | |
4446
| CoffeeScript | coffeescript, coffee, cson, iced | |
4547
| CpcdosC+ | cpc | [highlightjs-cpcdos](https://github.com/SPinti-Software/highlightjs-cpcdos) |
@@ -91,6 +93,7 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
9193
| JSON | json | |
9294
| Java | java, jsp | |
9395
| JavaScript | javascript, js, jsx | |
96+
| Jolie | jolie, iol, ol | [highlightjs-jolie](https://github.com/xiroV/highlightjs-jolie) |
9497
| Kotlin | kotlin, kt | |
9598
| LaTeX | tex | |
9699
| Leaf | leaf | |
@@ -120,6 +123,7 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
120123
| Nginx | nginx, nginxconf | |
121124
| Nim | nimrod | |
122125
| Nix | nix | |
126+
| Object Constraint Language | ocl | [highlightjs-ocl](https://github.com/nhomble/highlightjs-ocl) |
123127
| OCaml | ocaml, ml | |
124128
| Objective C | objectivec, mm, objc, obj-c | |
125129
| OpenGL Shading Language | glsl | |
@@ -172,6 +176,7 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
172176
| Stylus | stylus, styl | |
173177
| SubUnit | subunit | |
174178
| Supercollider | supercollider, sc | [highlightjs-supercollider](https://github.com/highlightjs/highlightjs-supercollider) |
179+
| Svelte | svelte | [highlightjs-svelte](https://github.com/AlexxNB/highlightjs-svelte) |
175180
| Swift | swift | |
176181
| Tcl | tcl, tk | |
177182
| Terraform (HCL) | terraform, tf, hcl | [highlightjs-terraform](https://github.com/highlightjs/highlightjs-terraform) |
@@ -181,7 +186,9 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
181186
| Transact-SQL | tsql | [highlightjs-tsql](https://github.com/highlightjs/highlightjs-tsql) |
182187
| Twig | twig, craftcms | |
183188
| TypeScript | typescript, ts | |
189+
| Unicorn Rails log | unicorn-rails-log | [highlightjs-unicorn-rails-log](https://github.com/sweetppro/highlightjs-unicorn-rails-log)
184190
| VB.Net | vbnet, vb | |
191+
| VBA | vba | [highlightjs-vba](https://github.com/dullin/highlightjs-vba) |
185192
| VBScript | vbscript, vbs | |
186193
| VHDL | vhdl | |
187194
| Vala | vala | |

docs/api.rst

+20-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Highlight.js exports a few functions as methods of the ``hljs`` object.
55

66

77
``highlight(languageName, code, ignore_illegals, continuation)``
8-
---------------------------------------------------------
8+
----------------------------------------------------------------
99

1010
Core highlighting function.
1111
Accepts a language name, or an alias, and a string with the code to highlight.
@@ -32,7 +32,7 @@ Returns an object with the following properties:
3232

3333

3434
``highlightAuto(code, languageSubset)``
35-
----------------------------------------
35+
---------------------------------------
3636

3737
Highlighting with language detection.
3838
Accepts a string with the code to highlight and an optional array of language names and aliases restricting detection to only those languages. The subset can also be set with ``configure``, but the local parameter overrides the option if set.
@@ -76,7 +76,7 @@ Configures global options:
7676
* ``classPrefix``: a string prefix added before class names in the generated markup, used for backwards compatibility with stylesheets.
7777
* ``languages``: an array of language names and aliases restricting auto detection to only these languages.
7878
* ``languageDetectRe``: a regex to configure how CSS class names map to language (allows class names like say `color-as-php` vs the default of `language-php`, etc.)
79-
* ``noHighlightRe``: a regex to configure which CSS classes are to be skipped completely
79+
* ``noHighlightRe``: a regex to configure which CSS classes are to be skipped completely.
8080

8181
Accepts an object representing options with the values to updated. Other options don't change
8282
::
@@ -85,15 +85,14 @@ Accepts an object representing options with the values to updated. Other options
8585
tabReplace: ' ', // 4 spaces
8686
classPrefix: '' // don't append class prefix
8787
// … other options aren't changed
88-
})
88+
});
8989
hljs.initHighlighting();
9090

9191

9292
``initHighlighting()``
9393
----------------------
9494

95-
Applies highlighting to all ``<pre><code>..</code></pre>`` blocks on a page.
96-
95+
Applies highlighting to all ``<pre><code>...</code></pre>`` blocks on a page.
9796

9897

9998
``initHighlightingOnLoad()``
@@ -102,24 +101,32 @@ Applies highlighting to all ``<pre><code>..</code></pre>`` blocks on a page.
102101
Attaches highlighting to the page load event.
103102

104103

105-
``registerLanguage(name, language)``
104+
``registerLanguage(languageName, languageDefinition)``
106105
------------------------------------
107106

108107
Adds new language to the library under the specified name. Used mostly internally.
109108

110-
* ``name``: a string with the name of the language being registered
111-
* ``language``: a function that returns an object which represents the
109+
* ``languageName``: a string with the name of the language being registered
110+
* ``languageDefinition``: a function that returns an object which represents the
112111
language definition. The function is passed the ``hljs`` object to be able
113112
to use common regular expressions defined within it.
114113

115114

115+
``registerAliases(alias|aliases, {languageName})``
116+
--------------------------------------------------
117+
118+
Adds new language alias or aliases to the library for the specified language name defined under ``languageName`` key.
119+
120+
* ``alias|aliases``: a string or array with the name of alias being registered
121+
* ``languageName``: the language name as specified by ``registerLanguage``.
122+
123+
116124
``listLanguages()``
117-
----------------------------
125+
-------------------
118126

119127
Returns the languages names list.
120128

121129

122-
123130
.. _getLanguage:
124131

125132

@@ -132,7 +139,7 @@ Returns the language object if found, ``undefined`` otherwise.
132139

133140

134141
``requireLanguage(name)``
135-
---------------------
142+
-------------------------
136143

137144
Looks up a language by name or alias.
138145

@@ -150,5 +157,5 @@ Enables *debug/development* mode. **This mode purposely makes Highlight.js more
150157

151158
For example, if a new version suddenly had a serious bug (or breaking change) that affected only a single language:
152159

153-
* **In Safe Mode**: All other languages would continue to highlight just fine. The broken language would appear as a code block, but without any highlighting (as if it were plaintext).
160+
* **In Safe Mode**: All other languages would continue to highlight just fine. The broken language would appear as a code block, but without any highlighting (as if it were plaintext).
154161
* **In Debug Mode**: All highlighting would stop when an error was encountered and a JavaScript error would be thrown.

0 commit comments

Comments
 (0)