This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
highlightjs-glimmer@2.2.0
Minor Changes
#4253f3447a Thanks @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:
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,
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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
highlightjs-glimmer@2.2.0
Minor Changes
#425
3f3447a
Thanks @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
andcjs
as aliases of the newglimmer-javascript
grammar. Consumers who want to take advantage of the standalone grammar can import it and register using the standardhljs.registerLanguage
technique.For example:
The old usage,
setup
and other methods,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.