Skip to content

Commit 416dad3

Browse files
committed
(chore) docs for v11
1 parent 56af93a commit 416dad3

File tree

3 files changed

+144
-44
lines changed

3 files changed

+144
-44
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ the browser as well as on the server. It works with pretty much any
2929
markup, doesn’t depend on any framework, and has automatic language
3030
detection.
3131

32-
#### Upgrading to Version 10
32+
#### Upgrading to Version 11
33+
34+
As always our major releases do contain breaking changes which may require action from users. Please read [VERSION_11_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/main/VERSION_11_UPGRADE.md) for a detailed summary of breaking changes and any actions you may need to take.
3335

34-
Version 10 is one of the biggest releases in quite some time. If you're
35-
upgrading from version 9, there are some breaking changes and things you may
36-
want to double check first.
36+
#### Upgrading to Version 10
3737

3838
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

SECURITY.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# Security Policy
22

3-
## Supported Versions
3+
Due to both time and resource constrains the Highlight.js core team fully supports only the current major/minor release of the library. Prior major releases may be supported for a short time after new major releases are issued. Problems with minor releases are often resolved by upgrading to the most recent release.
44

5-
Due to both time and resource constrains the Highlight.js core team only fully supports the current major/minor release of the library. Problems with minor releases are often resolved by upgrading to the most recent release.
5+
### Supported Versions
66

7-
| Version | Supported | Status |
7+
| Version | | Status |
88
| :-----: | :-: | :------ |
9-
| 10.7.1 | :white_check_mark:   :closed_lock_with_key: | The 10.x series recieves regular updates, new features & bug fixes. |
10-
| <= 10.4.0 | :x: | Known vulnerabities. *Please upgrade to a more recent 10.x release.* |
11-
| 9.18.5 | :x: | [EOL](https://github.com/highlightjs/highlight.js/issues/2877). No longer supported. See [VERSION_10_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/main/VERSION_10_UPGRADE.md). |
12-
| <= 9.18.3 | :x: | No longer supported. Known vulnerabities. |
13-
| <= 8.x | :x: | Obsolete. |
9+
| 11.0 | :white_check_mark: | The 11.x series recieves regular updates, new features & security fixes. |
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).|
11+
| <= 10.4.0 | :x: | Known vulnerabities. |
12+
| 9.18.5 | :x: | [EOL](https://github.com/highlightjs/highlight.js/issues/2877). No longer supported. |
13+
| <= 9.18.3 | :x: | Known vulnerabities. |
14+
| <= 8.x | :x: | Obsolete. Known vulnerabities. |
1415

1516

16-
## Reporting a Vulnerability
17+
### Reporting a Vulnerability
1718

18-
Minor vulnerabilities can simply be reported (and tracked) via our [GitHub issues](https://github.com/highlightjs/highlight.js/issues). If you feel your issue is more sensitive than that you can always reach us via email: [[email protected]](mailto:[email protected])
19+
Many vulnerabilities can simply be reported (and tracked) via our [GitHub issues](https://github.com/highlightjs/highlight.js/issues). If you feel your issue is more sensitive than that you can always reach us via email: [[email protected]](mailto:[email protected])
1920

VERSION_11_UPGRADE.md

Lines changed: 129 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,146 @@
1-
# Default Build Changes
1+
- [Overview of Breaking Changes](#overview-of-breaking-changes)
2+
- [Built-in set of "Common" Languages](#built-in-set-of-common-languages)
3+
- [Language Files](#language-files)
4+
- [Language Aliases](#language-aliases)
5+
- [Styles and CSS](#styles-and-css)
6+
- [Behavioral changes](#behavioral-changes)
7+
- [API changes](#api-changes)
8+
- [Changes to Result Data](#changes-to-result-data)
9+
- [Feature Removal](#feature-removal)
10+
- [Small Things](#small-things)
211

3-
- remove apache, http, nginx, properties, coffeescript from :common #2848
412

5-
### Feature Removal
13+
## Overview of Breaking Changes
614

7-
- HTML merging is now no longer included in core. You'll want to use a plugin instead. https://github.com/highlightjs/highlight.js/issues/2889
8-
- fixMarkup is gone now, provide your own replacement #2534
15+
Welcome to version 11.0. This a major release and therefore contains breaking changes. Below is a complete list of those such changes.
916

10-
### Behavior changes
1117

12-
- `initHighlighting` and `initHighlightingOnLoad` call `highlightAll`
13-
- Calling `highlightAll` over and over is not guarded against
18+
### Built-in set of "Common" Languages
1419

15-
### Grammar's removed or renamed
20+
The default `highlight.min.js` build **removes** a few less popular grammars:
1621

17-
- remove the old htmlbars stub, use handlebars
18-
- remove c-like, use c, cpp, or arduino
19-
- removed `sql_more`, use `sql` instead
22+
- apache
23+
- http
24+
- nginx
25+
- properties
26+
- coffeescript
2027

21-
### Visual / Themeing / CSS Changes
28+
If you need any of these, you can always create a custom build.
2229

23-
- Default padding on `.hljs` is now 1em (up from 0.5em)
24-
- schoolbook no longer has a custom lined background, it's solid now
30+
Ref: https://github.com/highlightjs/highlight.js/issues/2848
2531

26-
### Alias Changes
2732

28-
- php3,4,5,6,etc... aliases removed, use php instead
29-
- `zsh` removed, use `sh` instead
30-
- `freepascal`, `lazarus`, `lpr`, `lpm` removed. Use `delphi` or add you own aliases back.
33+
### Language Files
3134

32-
## API's changed
35+
This would matter if you are requiring any of these files directly (via Node.js or CDN).
3336

34-
- rename second_best to secondBest (highlightAuto)
35-
- highlightElement/highlightBlock result now no longer returns `re` key, use `relevance` instead
36-
- `CSS_NUMBER_MODE` has now been moved into the internal `css-shared` library
37-
- `highlight()` result now renames some keys to mark them as private: `_top`, `_emitter`, and `_illegalBy`
37+
- `htmlbars` has been removed. Use `handlebars` instead.
38+
- `c-like` has been removed. Use `c`, `cpp`, or `arduino`.
39+
- `sql_more` has been removed. Use `sql` instead.
3840

39-
### Configuration options removed/changed
4041

41-
- useBR gone, #2559
42-
- tabReplace gone, #2874
42+
### Language Aliases
4343

44-
## Others
44+
This would matter if you are using these aliases.
4545

46-
- `relevance` returned may be a floating point number now
47-
- regex utility `join` renamed to `_eitherRewriteBackreferences` (this was always internal)
46+
- `php3`,`php4`,`php5`, `php6`, `php7`, and `php8` havbe been removed. Use `php` instead.
47+
- `zsh` has been removed. Use `sh` or `bash` instead.
48+
- `freepascal`, `lazarus`, `lpr`, and `lpm` removed. Use `delphi` instead.
49+
50+
You can of course re-register any of these aliases easily if necessary. For example to restore the PHP aliases:
51+
52+
```js
53+
hljs.registerAliases(["php3","php4","php5","php6","php7","php8"],{ languageName: "php" })
54+
```
55+
56+
### Styles and CSS
57+
58+
- The default padding on `.hljs` element has been increased and is now `1em` (it was `0.5em` previously). If your design depends on the smaller spacing you may need to update your CSS to override.
59+
- `schoolbook` no longer has a custom lined background, it is solid color now. The old image and CSS can be found in the [10-stable branch](https://github.com/highlightjs/highlight.js/tree/10-stable/src/styles) if you wish to manually copy it into your project.
60+
- `github` includes significant changes to more properly match modern GitHub syntax highlighting. If you desire the old theme you can manually copy it into your project from the [10-stable branch](https://github.com/highlightjs/highlight.js/tree/10-stable/src/styles).
61+
62+
63+
### Behavioral changes
64+
65+
#### API changes
66+
67+
- The `highlight(language,code, ...args)` API no longer accepts `continuation` as a 4th argument.
68+
- The `highlight(language,code, ...args)` API is deprecated (to be removed in 12.0).
69+
70+
The new call signature is `highlight(code, {options})`. ([see docs](https://highlightjs.readthedocs.io/en/latest/api.html#highlight))
71+
72+
Code using the old API:
73+
74+
```js
75+
// highlight(language, code, ignoreIllegals, continuation)
76+
highlight("javascript", "var a = 5;", true)
77+
```
78+
...would be upgraded to the newer API as follows:
79+
80+
```js
81+
// highlight(code, {language, ignoreIllegals})
82+
highlight("var a = 5;", {language: "javascript", ignoreIllegals: true})
83+
```
84+
85+
The new API purposely does not support `continuation` as this is only intended for internal library usage.
86+
87+
- `initHighlighting()` is deprecated (to be removed in 12.0).
88+
- `initHighlightingOnLoad()` is deprecated (to be removed in 12.0).
89+
90+
**Use `highlightAll()` instead.** ([see docs](https://highlightjs.readthedocs.io/en/latest/api.html#highlight-all)) The old functions are now simply aliases of `highlightAll()`. The new function may be called before or after the DOM is loaded and should do the correct thing in all cases, replacing the need for the previous individual functions.
91+
92+
Note: `highlightAll()` does not guard against calling itself repeatedly as the previous functions did. Your code should be careful to avoid doing this.
93+
94+
- `highlightBlock()` is deprecated (to be removed in 12.0).
95+
96+
**Use `highlightElement()` instead.** ([see docs](https://highlightjs.readthedocs.io/en/latest/api.html#highlight-element)) This is merely a naming change.
97+
98+
Note: The object literal passed to the `before:highlightElement` callback now passes the element in the `el` key vs the `block` key.
99+
100+
##### Changes to Result Data
101+
102+
- `highlightAuto()`'s `second_best` key has been renamed to `secondBest`
103+
- `highlightElement()`'s result now no longer includes a `re` key. Use the `relevance` key now.
104+
- `highlight()` renames some result keys to more clearly mark them as private: `_top`, `_emitter`, and `_illegalBy`. You should not depend on these keys as they are subject to change at any time.
105+
- The `relevance` key returned by `highlight()` is no longer guaranteed to be an even integer.
106+
107+
108+
#### Feature Removal
109+
110+
- HTML auto-passthru is now no longer included in core. Use a plugin instead. For a possible plugin please see [#2889](https://github.com/highlightjs/highlight.js/issues/2889).
111+
112+
An example:
113+
114+
```html
115+
<pre><code class="lang-js">
116+
var a = 4;
117+
<span class="yellow">var a = 4;</span>
118+
</code></pre>
119+
```
120+
121+
Unescaped HTML like this will now be ignored (stripped before highlighting) and a warning will be logged to the console. All HTML to be highlighted should be properly escaped to avoid potential HTML/JS injection attacks.
122+
123+
- `fixMarkup` has been removed.
124+
125+
This function was deprecated in v10.2. It is not our goal to provide random string utilities. You may need to provide your own replacement [Ref: #2534](https://github.com/highlightjs/highlight.js/issues/2634)
126+
127+
- `CSS_NUMBER_MODE` has been removed.
128+
129+
This rule was too broad for bring inclusion in core and has been removed.
130+
131+
- `useBR` configuration has been removed.
132+
133+
This configuration option was deprecated in v10.1. Use a plugin or preferably simply CSS `white-space: pre`. [Ref: #2559](https://github.com/highlightjs/highlight.js/issues/2559)
134+
135+
136+
- `tabReplace` configuration has been removed.
137+
138+
This configuration option was deprecated in v10.5. Use a plugin or pre-render content instead with desired spacing. [Ref: #2874](https://github.com/highlightjs/highlight.js/issues/2874)
139+
140+
141+
142+
143+
144+
### Small Things
145+
146+
- The `regex` utility `join` has been renamed to `_eitherRewriteBackreferences` (this has always been intended for internal use only)

0 commit comments

Comments
 (0)