Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defaults langs/themes don't match what the doc says #200

Closed
octref opened this issue Aug 14, 2021 · 0 comments
Closed

Defaults langs/themes don't match what the doc says #200

octref opened this issue Aug 14, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@octref
Copy link
Collaborator

octref commented Aug 14, 2021

export interface HighlighterOptions {
  /**
   * The theme to load upfront.
   */
  theme?: IThemeRegistration

  /**
   * A list of themes to load upfront.
   *
   * Default to: `['dark-plus', 'light-plus']`
   */
  themes?: IThemeRegistration[]

  /**
   * A list of languages to load upfront.
   *
   * Default to `['html', 'css', 'javascript']`
   */
  langs?: (Lang | ILanguageRegistration)[]

  /**
   * Paths for loading themes and langs. Relative to the package's root.
   */
  paths?: IHighlighterPaths
}
function resolveOptions(options: HighlighterOptions) {
  let _languages: ILanguageRegistration[] = BUNDLED_LANGUAGES
  let _themes: IThemeRegistration[] = options.themes || []

  if (options.langs?.length) {
    _languages = options.langs.map(resolveLang)
  }
  if (options.theme) {
    _themes.unshift(options.theme)
  }
  if (!_themes.length) {
    _themes = ['nord']
  }

  return { _languages, _themes }
}
@octref octref added the bug Something isn't working label Aug 14, 2021
muenzpraeger added a commit to muenzpraeger/shiki that referenced this issue Jan 13, 2023
octref pushed a commit to muenzpraeger/shiki that referenced this issue Jan 27, 2023
@octref octref closed this as completed in 6250c72 Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant