Skip to content

Commit 3bebe27

Browse files
authored
Merge branch 'main' into version_11
2 parents c46a0cf + 421b23b commit 3bebe27

Some content is hidden

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

46 files changed

+392
-204
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: Lint
66
on:
77
pull_request:
88
branches:
9-
- master
9+
- main
1010

1111
jobs:
1212
lint:

.github/workflows/node.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [ main ]
99
pull_request:
10-
branches: [ master ]
10+
branches: [ main ]
1111

1212
jobs:
1313
build:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
# else (beta)
7373
- name: Beta Release
7474
if: env.RELEASING == 'beta'
75-
run: echo "BRANCH_NAME=master" >> $GITHUB_ENV
75+
run: echo "BRANCH_NAME=main" >> $GITHUB_ENV
7676
- name: Confirm release is either stable or beta
7777
if: ${{ !(env.RELEASING == 'stable' || env.RELEASING == 'beta') }}
7878
run: |

CHANGES.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
## Version 10.7.0 (in progress)
1+
## Version 10.7.1
22

3-
Bugs:
3+
- fix(parser) Resolves issues with TypeScript types [Josh Goebel][]
44

5+
### Version 10.7.0
6+
7+
Parser:
8+
9+
- enh(api) add `unregisterLanguage` method (#3009) [Antoine du Hamel][]
10+
- enh: Make alias registration case insensitive (#3026) [David Ostrovsky][]
511
- fix(parser) `highlightAll()` now works if the library is lazy loaded [Josh Goebel][]
612

713
New Languages:
@@ -12,6 +18,7 @@ New Languages:
1218

1319
Language grammar improvements:
1420

21+
- fix(python) allow keywords immediately following numbers (#2985) [Josh Goebel][]
1522
- fix(xml) char immediately following tag close mis-highlighted (#3044) [Josh Goebel][]
1623
- fix(ruby) fix `defined?()` mis-highlighted as `def` (#3025) [Josh Goebel][]
1724
- fix(c) comments after `#include <str>` blocks (#3041) [Josh Goebel][]
@@ -34,17 +41,16 @@ Language grammar improvements:
3441

3542
Deprecations:
3643

44+
- `highlight(languageName, code, ignoreIllegals, continuation)` deprecated as of 10.7
45+
- Please use the newer API which takes `code` and then accepts options as an object
46+
- IE: `highlight(code, {language, ignoreIllegals})`
47+
- `continuation` is for internal use only and no longer supported
3748
- `highlightBlock(el)` deprecated as of 10.7.
3849
- Please use `highlightElement(el)` instead.
3950
- Plugin callbacks renamed `before/after:highlightBlock` => `before/after:highlightElement`
4051
- Plugin callback now takes `el` vs `block` attribute
4152
- The old API and callbacks will be supported until v12.
4253

43-
API:
44-
45-
- enh(api) add `unregisterLanguage` method (#3009) [Antoine du Hamel][]
46-
- enh: Make alias registration case insensitive (#3026) [David Ostrovsky][]
47-
4854
[Stef Levesque]: https://github.com/stef-levesque
4955
[Josh Goebel]: https://github.com/joshgoebel
5056
[John Cheung]: https://github.com/Real-John-Cheung

README.CDN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ markup, doesn’t depend on any framework, and has automatic language
2222
detection.
2323

2424
If you'd like to read the full README:<br>
25-
<https://github.com/highlightjs/highlight.js/blob/master/README.md>
25+
<https://github.com/highlightjs/highlight.js/blob/main/README.md>
2626

2727
## License
2828

@@ -41,5 +41,5 @@ Further in-depth documentation for the API and other topics is at
4141
A list of the Core Team and contributors can be found in the [CONTRIBUTORS.md][8] file.
4242

4343
[1]: https://www.npmjs.com/package/highlight.js
44-
[7]: https://github.com/highlightjs/highlight.js/blob/master/LICENSE
45-
[8]: https://github.com/highlightjs/highlight.js/blob/master/CONTRIBUTORS.md
44+
[7]: https://github.com/highlightjs/highlight.js/blob/main/LICENSE
45+
[8]: https://github.com/highlightjs/highlight.js/blob/main/CONTRIBUTORS.md

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![latest version](https://badgen.net/npm/v/highlight.js?label=latest)](https://www.npmjs.com/package/highlight.js)
44
[![slack](https://badgen.net/badge/icon/slack?icon=slack&label&color=pink)](https://join.slack.com/t/highlightjs/shared_invite/zt-mj0utgqp-TNFf4VQICnDnPg4zMHChFw)
55
[![discord](https://badgen.net/badge/icon/discord?icon=discord&label&color=pink)](https://discord.gg/M24EbU7ja9)
6-
[![license](https://badgen.net/github/license/highlightjs/highlight.js?color=cyan)](https://github.com/highlightjs/highlight.js/blob/master/LICENSE)
6+
[![license](https://badgen.net/github/license/highlightjs/highlight.js?color=cyan)](https://github.com/highlightjs/highlight.js/blob/main/LICENSE)
77
[![install size](https://badgen.net/packagephobia/install/highlight.js?label=npm+install)](https://packagephobia.now.sh/result?p=highlight.js)
88
![minified](https://img.shields.io/github/size/highlightjs/cdn-release/build/highlight.min.js?label=minified)
99
[![NPM downloads weekly](https://badgen.net/npm/dw/highlight.js?label=npm+downloads&color=purple)](https://www.npmjs.com/package/highlight.js)
@@ -18,7 +18,7 @@
1818
[![vulnerabilities](https://badgen.net/snyk/highlightjs/highlight.js)](https://snyk.io/test/github/highlightjs/highlight.js?targetFile=package.json)
1919

2020
<!-- [![Build CI](https://img.shields.io/github/workflow/status/highlightjs/highlight.js/Node.js%20CI)](https://github.com/highlightjs/highlight.js/actions?query=workflow%3A%22Node.js+CI%22) -->
21-
<!-- [![commits since release](https://img.shields.io/github/commits-since/highlightjs/highlight.js/latest?label=commits+since)](https://github.com/highlightjs/highlight.js/commits/master) -->
21+
<!-- [![commits since release](https://img.shields.io/github/commits-since/highlightjs/highlight.js/latest?label=commits+since)](https://github.com/highlightjs/highlight.js/commits/main) -->
2222
<!-- [![](https://data.jsdelivr.com/v1/package/gh/highlightjs/cdn-release/badge?style=rounded)](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release) -->
2323
<!-- [![Total Lines](https://img.shields.io/tokei/lines/github/highlightjs/highlight.js)]() -->
2424
<!-- [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/highlight.js.svg)](https://bundlephobia.com/result?p=highlight.js) -->
@@ -35,11 +35,11 @@ As always our major releases do contain breaking changes which may require actio
3535

3636
#### Upgrading to Version 10
3737

38-
Please read [VERSION_10_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_UPGRADE.md) for high-level summary of breaking changes and any actions you may need to take. See [VERSION_10_BREAKING_CHANGES.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_BREAKING_CHANGES.md) for a more detailed list and [CHANGES.md](https://github.com/highlightjs/highlight.js/blob/master/CHANGES.md) to learn what else is new.
38+
Please read [VERSION_10_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/main/VERSION_10_UPGRADE.md) for high-level summary of breaking changes and any actions you may need to take. See [VERSION_10_BREAKING_CHANGES.md](https://github.com/highlightjs/highlight.js/blob/main/VERSION_10_BREAKING_CHANGES.md) for a more detailed list and [CHANGES.md](https://github.com/highlightjs/highlight.js/blob/main/CHANGES.md) to learn what else is new.
3939

4040
##### Support for older versions
4141

42-
Please see [SECURITY.md](https://github.com/highlightjs/highlight.js/blob/master/SECURITY.md) for support information.
42+
Please see [SECURITY.md](https://github.com/highlightjs/highlight.js/blob/main/SECURITY.md) for support information.
4343

4444
## Getting Started
4545

@@ -211,7 +211,7 @@ const hljs = require('highlight.js/lib/core'); // require only the core library
211211
// separately require languages
212212
hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));
213213

214-
const highlightedCode = hljs.highlight('xml', '<span>Hello World!</span>').value
214+
const highlightedCode = hljs.highlight('<span>Hello World!</span>', {language: 'xml'}).value
215215
```
216216

217217

@@ -266,33 +266,33 @@ r.js -o name=hljs paths.hljs=/path/to/highlight out=highlight.js
266266

267267
A prebuilt version of Highlight.js bundled with many common languages is hosted by several popular CDNs.
268268
When using Highlight.js via CDN you can use Subresource Integrity for additional security. For details
269-
see [DIGESTS.md](https://github.com/highlightjs/cdn-release/blob/master/DIGESTS.md).
269+
see [DIGESTS.md](https://github.com/highlightjs/cdn-release/blob/main/DIGESTS.md).
270270

271271
**cdnjs** ([link](https://cdnjs.com/libraries/highlight.js))
272272

273273
```html
274-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/styles/default.min.css">
275-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/highlight.min.js"></script>
274+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.1/styles/default.min.css">
275+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.1/highlight.min.js"></script>
276276
<!-- and it's easy to individually load additional languages -->
277-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.6.0/languages/go.min.js"></script>
277+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.1/languages/go.min.js"></script>
278278
```
279279

280280
**jsdelivr** ([link](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release))
281281

282282
```html
283-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.6.0/build/styles/default.min.css">
284-
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.6.0/build/highlight.min.js"></script>
283+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.7.1/build/styles/default.min.css">
284+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.7.1/build/highlight.min.js"></script>
285285
<!-- and it's easy to individually load additional languages -->
286-
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.6.0/build/languages/go.min.js"></script>
286+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.7.1/build/languages/go.min.js"></script>
287287
```
288288

289289
**unpkg** ([link](https://unpkg.com/browse/@highlightjs/cdn-assets/))
290290

291291
```html
292-
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@10.6.0/styles/default.min.css">
293-
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.6.0/highlight.min.js"></script>
292+
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@10.7.1/styles/default.min.css">
293+
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.7.1/highlight.min.js"></script>
294294
<!-- and it's easy to individually load additional languages -->
295-
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.6.0/languages/go.min.js"></script>
295+
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.7.1/languages/go.min.js"></script>
296296
```
297297

298298
**Note:** *The CDN-hosted `highlight.min.js` package doesn't bundle every language.* It would be
@@ -365,7 +365,7 @@ A list of the Core Team and contributors can be found in the [CONTRIBUTORS.md][8
365365
[4]: http://highlightjs.readthedocs.io/en/latest/api.html#configure-options
366366
[5]: https://highlightjs.org/download/
367367
[6]: http://highlightjs.readthedocs.io/en/latest/building-testing.html
368-
[7]: https://github.com/highlightjs/highlight.js/blob/master/LICENSE
369-
[8]: https://github.com/highlightjs/highlight.js/blob/master/CONTRIBUTORS.md
370-
[9]: https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md
368+
[7]: https://github.com/highlightjs/highlight.js/blob/main/LICENSE
369+
[8]: https://github.com/highlightjs/highlight.js/blob/main/CONTRIBUTORS.md
370+
[9]: https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md
371371
[10]: https://github.com/highlightjs/

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Due to both time and resource constrains the Highlight.js core team fully suppor
77
| Version | | Status |
88
| :-----: | :-: | :------ |
99
| 11.0 | :white_check_mark: | The 11.x series recieves regular updates, new features & security fixes. |
10-
| 10.6.0 | :white_check_mark: | The 10.x series is in maintence mode. EOL TBD.<br>See [VERSION_11_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_11_UPGRADE.md).|
10+
| 10.7.1 | :white_check_mark: | The 10.x series is in maintence mode. EOL TBD.<br>See [VERSION_11_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_11_UPGRADE.md).|
1111
| <= 10.4.0 | :x: | Known vulnerabities. |
1212
| 9.18.5 | :x: | [EOL](https://github.com/highlightjs/highlight.js/issues/2877). No longer supported. |
1313
| <= 9.18.3 | :x: | Known vulnerabities. |

SUPPORTED_LANGUAGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
7878
| GAUSS | gauss, gss | |
7979
| GDScript | godot, gdscript | [highlightjs-gdscript](https://github.com/highlightjs/highlightjs-gdscript) |
8080
| Gherkin | gherkin | |
81-
| GN for Ninja | gn, gni | [highlightjs-GN](https://github.com/highlightjs/highlightjs-GN/blob/master/gn.js) |
81+
| GN for Ninja | gn, gni | [highlightjs-GN](https://github.com/highlightjs/highlightjs-GN) |
8282
| Go | go, golang | |
8383
| Grammatical Framework | gf | [highlightjs-gf](https://github.com/johnjcamilleri/highlightjs-gf) |
8484
| Golo | golo, gololang | |

VERSION_10_UPGRADE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ We tried to squeeze in as many as we could this time so that after 10.0 ships we
99

1010
*IE, if there it could possibly break things for anyone, it's typically a breaking change.* The fact is a vast majority of users should upgrade and probably not notice any changes at all.
1111

12-
See [VERSION_10_BREAKING_CHANGES.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_BREAKING_CHANGES.md) for a comprehensive list of breaking changes, but here is a summary... if you use:
12+
See [VERSION_10_BREAKING_CHANGES.md](https://github.com/highlightjs/highlight.js/blob/main/VERSION_10_BREAKING_CHANGES.md) for a comprehensive list of breaking changes, but here is a summary... if you use:
1313

1414
### Core highlight.js lib on the client (with no extra CDN languages)
1515

docs/api.rst

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ Library API
44
Highlight.js exports a few functions as methods of the ``hljs`` object.
55

66

7-
``highlight(languageName, code, ignore_illegals, continuation)``
8-
----------------------------------------------------------------
7+
``highlight(languageName, code, ignoreIllegals, continuation)`` (deprecated with 10.7)
8+
--------------------------------------------------------------------------------------
99

10-
Core highlighting function.
11-
Accepts a language name, or an alias, and a string with the code to highlight.
12-
The ``ignore_illegals`` parameter, when present and evaluates to a true value,
13-
forces highlighting to finish even in case of detecting illegal syntax for the
14-
language instead of throwing an exception.
15-
The ``continuation`` is an optional mode stack representing unfinished parsing.
10+
**This is the old API, please see the new API immediately below.**
11+
12+
``continuation`` is an optional mode stack representing unfinished parsing.
1613
When present, the function will restart parsing from this state instead of
1714
initializing a new one. This is used internally for `sublanguage` support.
1815

@@ -21,6 +18,18 @@ because there is no requirement that a grammar handle linebreaks in any special
2118
way. It's quite possible for a grammar to have a single mode/regex that matches
2219
MANY lines at once. This is not discouraged and entirely up to the grammar.
2320

21+
22+
23+
``highlight(code, {language, ignoreIllegals})``
24+
--------------------------------------------------------------------------------------
25+
26+
Core highlighting function. Accepts the code to highlight (string) and a list of options (object).
27+
The ``language`` parameter must be present and specify the language name or alias
28+
of the grammar to be used for highlighting.
29+
The ``ignoreIllegals`` is an optional parameter than when true forces highlighting
30+
to finish even in case of detecting illegal syntax for the
31+
language instead of throwing an exception.
32+
2433
Returns an object with the following properties:
2534

2635
* ``language``: language name, same as the name passed in ``languageName``, returned for consistency with ``highlightAuto``

0 commit comments

Comments
 (0)