Skip to content

Commit

Permalink
docs: opt-out experimental state of js engine
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Dec 20, 2024
1 parent e5e8814 commit 25695aa
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 11 deletions.
6 changes: 1 addition & 5 deletions docs/guide/regex-engines.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ const shiki = await createShiki({
})
```

## JavaScript RegExp Engine (Experimental)

::: warning Experimental
This feature is experimental and may change without following semver.
:::
## JavaScript RegExp Engine

This engine uses JavaScript's native RegExp. As regular expressions used by TextMate grammars are written for Oniguruma, they might contain syntax that is not supported by JavaScript's RegExp, or expect different behavior for the same syntax. So we use [Oniguruma-To-ES](https://github.com/slevithan/oniguruma-to-es) to transpile Oniguruma patterns to native JavaScript RegExp.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/sync-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const shiki = createHighlighterCoreSync({
const html = shiki.highlight('console.log(1)', { lang: 'js', theme: 'nord' })
```

When doing so, it requires all `themes` and `langs` to be provide as plain objects. Also an explicit `engine` is required to be provided. With the new [experimental JavaScript RegExp engine](/guide/regex-engines#javascript-regexp-engine-experimental) you are able to create an engine instance synchronously as well.
When doing so, it requires all `themes` and `langs` to be provide as plain objects. Also an explicit `engine` is required to be provided. With the new [JavaScript RegExp engine](/guide/regex-engines#javascript-regexp-engine) you are able to create an engine instance synchronously as well.

The [Oniguruma Engine](/guide/regex-engines#oniguruma-engine) can only be created asynchronously, so you need to resolve the engine promise before creating the sync highlighter.

Expand Down
2 changes: 1 addition & 1 deletion docs/references/engine-js-compat.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# JavaScript RegExp Engine Compatibility References

Compatibility reference of all built-in grammars with the [JavaScript RegExp engine](/guide/regex-engines#javascript-regexp-engine-experimental).
Compatibility reference of all built-in grammars with the [JavaScript RegExp engine](/guide/regex-engines#javascript-regexp-engine).

> Generated on Thursday, December 19, 2024
>
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-javascript/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @shikijs/engine-javascript

Engine for Shiki using JavaScript's native RegExp (experimental). Uses [Oniguruma-To-ES](https://github.com/slevithan/oniguruma-to-es) to transpile regex syntax and behavior.
Engine for Shiki using JavaScript's native RegExp. Uses [Oniguruma-To-ES](https://github.com/slevithan/oniguruma-to-es) to transpile regex syntax and behavior.

[Documentation](https://shiki.style/guide/regex-engines)

Expand Down
2 changes: 0 additions & 2 deletions packages/engine-javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ export class JavaScriptScanner implements PatternScanner {
* patterns are not supported. Errors will be thrown when parsing TextMate grammars with
* unsupported patterns, and when the grammar includes patterns that use invalid Oniguruma syntax.
* Set `forgiving` to `true` to ignore these errors and skip any unsupported or invalid patterns.
*
* @experimental
*/
export function createJavaScriptRegexEngine(options: JavaScriptRegexEngineOptions = {}): RegexEngine {
const _options = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/report-engine-js-compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ async function run() {
let markdown = [
'# JavaScript RegExp Engine Compatibility References',
'',
'Compatibility reference of all built-in grammars with the [JavaScript RegExp engine](/guide/regex-engines#javascript-regexp-engine-experimental).',
'Compatibility reference of all built-in grammars with the [JavaScript RegExp engine](/guide/regex-engines#javascript-regexp-engine).',
'',
`> Generated on ${new Date().toLocaleDateString('en-US', { dateStyle: 'full' })} `,
'>',
Expand Down

0 comments on commit 25695aa

Please sign in to comment.