Skip to content

Commit

Permalink
Merge branch 'main' into add-missing-csp-directives
Browse files Browse the repository at this point in the history
  • Loading branch information
probil authored Dec 30, 2024
2 parents caf65f3 + 62f8a60 commit d6c4f4e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 28 deletions.
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,20 +370,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.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/highlight.min.js"></script>
<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>
<!-- and it's easy to individually load additional languages -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/languages/go.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/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.0/styles/dark.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/dark.min.css">
<script type="module">
import hljs from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/es/highlight.min.js';
import hljs from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/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.0/es/languages/go.min.js';
import go from 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/es/languages/go.min.js';
hljs.registerLanguage('go', go);
</script>

Expand All @@ -395,20 +395,20 @@ hljs.registerLanguage('go', go);
##### Common JS <!-- omit in toc -->

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected].0/build/styles/default.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected].0/build/highlight.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected].1/build/styles/default.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected].1/build/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages -->
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected].0/build/languages/go.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected].1/build/languages/go.min.js"></script>
```

##### ES6 Modules <!-- omit in toc -->

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected].0/build/styles/default.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected].1/build/styles/default.min.css">
<script type="module">
import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected].0/build/es/highlight.min.js';
import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected].1/build/es/highlight.min.js';
// and it's easy to individually load additional languages
import go from 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected].0/build/es/languages/go.min.js';
import go from 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected].1/build/es/languages/go.min.js';
hljs.registerLanguage('go', go);
</script>
```
Expand All @@ -418,20 +418,20 @@ hljs.registerLanguage('go', go);
##### Common JS <!-- omit in toc -->

```html
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/[email protected].0/styles/default.min.css">
<script src="https://unpkg.com/@highlightjs/[email protected].0/highlight.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/[email protected].1/styles/default.min.css">
<script src="https://unpkg.com/@highlightjs/[email protected].1/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages -->
<script src="https://unpkg.com/@highlightjs/[email protected].0/languages/go.min.js"></script>
<script src="https://unpkg.com/@highlightjs/[email protected].1/languages/go.min.js"></script>
```

##### ES6 Modules <!-- omit in toc -->

```html
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/[email protected].0/styles/default.min.css">
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/[email protected].1/styles/default.min.css">
<script type="module">
import hljs from 'https://unpkg.com/@highlightjs/[email protected].0/es/highlight.min.js';
import hljs from 'https://unpkg.com/@highlightjs/[email protected].1/es/highlight.min.js';
// and it's easy to individually load & register additional languages
import go from 'https://unpkg.com/@highlightjs/[email protected].0/es/languages/go.min.js';
import go from 'https://unpkg.com/@highlightjs/[email protected].1/es/languages/go.min.js';
hljs.registerLanguage('go', go);
</script>
```
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# built documents.

# The full version, including alpha/beta/rc tags.
release = '11.11.0'
release = '11.11.1'
# The short X.Y version.
version = ".".join(release.split(".")[:2])

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"syntax"
],
"homepage": "https://highlightjs.org/",
"version": "11.11.0",
"version": "11.11.1",
"author": "Josh Goebel <[email protected]>",
"contributors": [
"Josh Goebel <[email protected]>",
Expand Down
14 changes: 10 additions & 4 deletions src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,18 @@ const HLJS = function(hljs) {
}
}

// edge case for when illegal matches $ (end of line) which is technically
// edge case for when illegal matches $ (end of line/text) which is technically
// a 0 width match but not a begin/end match so it's not caught by the
// first handler (when ignoreIllegals is true)
// first handler (when `ignoreIllegals` is true)
if (match.type === "illegal" && lexeme === "") {
// advance so we aren't stuck in an infinite loop
modeBuffer += "\n";
if (match.index === codeToHighlight.length) {
// we have matched the end of the text, so we can stop without
// hacking modeBuffer
} else {
// matched literal `\n` (with `$`) so we must manually add the newline
// itself to the modeBuffer so it is not lost when we advance the cursor
modeBuffer += "\n";
}
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/languages/rust.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default function(hljs) {
contains: [
{
scope: "char.escape",
match: /\\(\w|x\w{2}|u\w{4}|U\w{8})/
match: /\\('|\w|x\w{2}|u\w{4}|U\w{8})/
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/detect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function testAutoDetection(language, { detectPath }) {
const dir = await fs.stat(languagePath);
dir.isDirectory().should.be.true();

const filenames = await fs.readdir(languagePath);
const filenames = (await fs.readdir(languagePath))
.filter(fn => fn !== '.DS_Store');
await Promise.all(filenames
.map(async function(example) {
const filename = path.join(languagePath, example);
Expand Down

0 comments on commit d6c4f4e

Please sign in to comment.