Skip to content

Commit

Permalink
Merge pull request #427 from NullVoxPopuli/changeset-release/main
Browse files Browse the repository at this point in the history
Release Preview
  • Loading branch information
NullVoxPopuli authored Nov 13, 2023
2 parents 1a2c03b + 319e6ef commit 99f4468
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
36 changes: 0 additions & 36 deletions .changeset/proud-pigs-know.md

This file was deleted.

37 changes: 37 additions & 0 deletions highlightjs-glimmer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# highlightjs-glimmer

## 2.2.0

### Minor Changes

- [#425](https://github.com/NullVoxPopuli/highlightjs-glimmer/pull/425) [`3f3447a`](https://github.com/NullVoxPopuli/highlightjs-glimmer/commit/3f3447a18f7ff965dda95f991f1dd11ecd33fb26) Thanks [@davidtaylorhq](https://github.com/davidtaylorhq)! - Previously, this package enabled glimmer-js support by patching into the official highlightjs javascript grammar. This is problematic if you want to support both gjs and js(/jsx) syntax highlighting alongside each other.

This change refactors things so that glimmer-javascript is defined and exported as a standalone grammar. Instead of patching the standard javascript grammar, it uses the `subLanguage` feature to extend it cleanly. hbs-literal and template-tag support are added via additional 'contains' rules.

To maintain the existing 'override javascript grammar' behavior for existing consumers of this package, the setup APIs will register `javascript`, `js`, `mjs` and `cjs` as aliases of the new `glimmer-javascript` grammar. Consumers who want to take advantage of the standalone grammar can import it and register using the standard `hljs.registerLanguage` technique.

For example:

```js
import hljs from 'highlight.js';
import { glimmerJavascript } from 'highlightjs-glimmer';

// 'javascript' must also be registered prior to running this
hljs.registerLanguage('glimmer-javascript', (hljs) => {
const definition = glimmerJavascript(hljs, 'glimmer-javascript');

return definition;
});
```

The old usage, `setup` and other methods,

```js
import hljs from 'highlight.js';
import { setup } from 'highlightjs-glimmer';

setup(hljs);

hljs.highlightAll();
```

Have been unchanged in this release, but are likely to change in the next major so that the default / recommended APIs don't take away from the possibility of using other languages in the same document.

## 2.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion highlightjs-glimmer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "highlightjs-glimmer",
"version": "2.1.0",
"version": "2.2.0",
"description": "Glimmer syntax highlighting with Highlight.JS",
"main": "dist/glimmer.cjs.cjs",
"browser": "dist/glimmer.esm.min.js",
Expand Down

0 comments on commit 99f4468

Please sign in to comment.