Skip to content

Commit f54e96c

Browse files
committed
9.18.5
1 parent c34318b commit f54e96c

File tree

7 files changed

+55
-11
lines changed

7 files changed

+55
-11
lines changed

CHANGES.md

+25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
## Release v9.18.5
2+
3+
**Version 9 has reached end-of-support and will not receive future updates or fixes.**
4+
5+
Please see [VERSION_10_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_UPGRADE.md) and perhaps [SECURITY.md](https://github.com/highlightjs/highlight.js/blob/master/SECURITY.md).
6+
7+
- enh: Post-install script can be disabled with `HLJS_HIDE_UPGRADE_WARNING=yes`
8+
- fix: Deprecation notice logged at library startup a `console.log` vs `console.warn`.
9+
- Notice only shown if actually highlighting code, not just requiring the library.
10+
- Node.js treats `warn` the same as `error` and that was problematic.
11+
- You (or perhaps your indirect dependency) may disable the notice with
12+
the `hideUpgradeWarningAcceptNoSupportOrSecurityUpdates` option
13+
- You can also set `HLJS_HIDE_UPGRADE_WARNING=yes` in your envionment to disable the warning
14+
15+
Example:
16+
17+
```js
18+
hljs.configure({
19+
hideUpgradeWarningAcceptNoSupportOrSecurityUpdates: true
20+
})
21+
```
22+
23+
Reference:
24+
https://github.com/highlightjs/highlight.js/issues/2877
25+
126
## Release v9.18.4
227

328
**Version 9 has reached end-of-support and will not receive future updates or fixes.**

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ it can be added manually:
362362
```html
363363
<script
364364
charset="UTF-8"
365-
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.4/languages/go.min.js"></script>
365+
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.5/languages/go.min.js"></script>
366366
```
367367

368368
**On Almond.** You need to use the optimizer to give the module a name. For

deprecated.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ ${BgRed + FgWhite}
1212
${Reset}${Bright}${FgWhite}
1313
Verion 9 of Highlight.js has reached EOL. It will no longer
1414
be supported or receive security updates in the future.
15-
Please upgrade to version 10.
15+
Please upgrade to version 10 or encourage your indirect
16+
dependencies to do so.
1617
1718
For more info:
1819
${FgBlue}
1920
https://github.com/highlightjs/highlight.js/issues/2877
2021
https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_UPGRADE.md
2122
${BgRed + FgWhite}
2223
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*${Reset}
23-
.`.trim()
24+
`.trim()
2425

25-
console.log(DEPRECATION)
26+
if (!process.env["HLJS_HIDE_UPGRADE_WARNING"]) {
27+
console.log(DEPRECATION)
28+
}

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
# The short X.Y version.
5151
version = '9.18'
5252
# The full version, including alpha/beta/rc tags.
53-
release = '9.18.4'
53+
release = '9.18.5'
5454

5555
# The language for content autogenerated by Sphinx. Refer to documentation
5656
# for a list of supported languages.

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"syntax"
77
],
88
"homepage": "https://highlightjs.org/",
9-
"version": "9.18.4",
9+
"version": "9.18.5",
1010
"author": {
1111
"name": "Ivan Sagalaev",
1212
"email": "[email protected]"

src/highlight.js

+20-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ https://highlightjs.org/
2828
}
2929

3030
}(function(hljs) {
31-
32-
var warn = console.warn || console.log;
33-
warn("Version 9 of Highlight.js has reached EOL and is no longer supported. Please upgrade to version 10.");
34-
31+
var showedUpgradeWarning = false;
3532

3633
// Convenience variables for build-in objects
3734
var ArrayProto = [],
@@ -60,6 +57,7 @@ https://highlightjs.org/
6057
// Global options used when within external APIs. This is modified when
6158
// calling the `hljs.configure` function.
6259
var options = {
60+
hideUpgradeWarningAcceptNoSupportOrSecurityUpdates: false,
6361
classPrefix: 'hljs-',
6462
tabReplace: null,
6563
useBR: false,
@@ -518,6 +516,13 @@ https://highlightjs.org/
518516
compileMode(language);
519517
}
520518

519+
function hideUpgradeWarning() {
520+
if (options.hideUpgradeWarningAcceptNoSupportOrSecurityUpdates)
521+
return true;
522+
523+
if (typeof process === "object" && typeof process.env === "object" && process.env["HLJS_HIDE_UPGRADE_WARNING"])
524+
return true;
525+
}
521526

522527
/**
523528
* Core highlighting function.
@@ -535,6 +540,17 @@ https://highlightjs.org/
535540
* @property {boolean} illegal - indicates whether any illegal matches were found
536541
*/
537542
function highlight(languageName, code, ignore_illegals, continuation) {
543+
if (!hideUpgradeWarning()) {
544+
if (!showedUpgradeWarning) {
545+
showedUpgradeWarning = true;
546+
console.log(
547+
"Version 9 of Highlight.js has reached EOL and is no longer supported.\n" +
548+
"Please upgrade or ask whatever dependency you are using to upgrade.\n" +
549+
"https://github.com/highlightjs/highlight.js/issues/2877"
550+
);
551+
}
552+
}
553+
538554
var codeToHighlight = code;
539555

540556
function escapeRe(value) {

0 commit comments

Comments
 (0)