Skip to content

Conversation

@metonym
Copy link
Owner

@metonym metonym commented Oct 21, 2025

Closes #383

Highlight.js already supports the ability to specify a subset of language names. This can improve the performance of using HighlightAuto, along with accuracy.

It uses the LanguageName utility type added in #386 for better type safety. languageNames itself is typed to allow an arbitrary string, while affording autocomplete.

export type HighlightAutoProps = HTMLAttributes<HTMLPreElement> &
  LangtagProps & {
    /**
     * Specify a subset of language names to restrict language auto-detection to.
     * This can improve performance and accuracy.
     * @example ["javascript", "typescript"]
     */
    languageNames?: (LanguageName | (string & {}))[];
  };
Screenshot 2025-10-21 at 3 04 33 PM

@metonym metonym force-pushed the rename-languages-prop branch from d0d024e to 70bad00 Compare October 22, 2025 02:27
@metonym metonym temporarily deployed to rename-languages-prop - svelte-highlight PR #387 October 22, 2025 02:27 — with Render Destroyed
@metonym metonym merged commit bc89055 into master Oct 22, 2025
2 checks passed
@metonym metonym deleted the rename-languages-prop branch October 22, 2025 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limit language set used by HighlightAuto

1 participant