Class EditorLanguageRegistry

CodeMirror language registry

Hierarchy

  • EditorLanguageRegistry

Implements

Constructors

Properties

_modeList: any

Methods

  • Register a new language for CodeMirror

    Parameters

    Returns void

  • Find a codemirror mode by name or CodeMirror spec.

    Parameters

    • language: string | IEditorLanguage

      The CodeMirror mode

    • Optional fallback: boolean

      Whether to fallback to default mimetype spec or not

    Returns IEditorLanguage

    The mode or null

  • Find a codemirror mode by extension.

    Parameters

    • ext: string | readonly string[]

      The extension name

    Returns IEditorLanguage

    The mode or null

  • Find a codemirror mode by filename.

    Parameters

    • name: string

      File name

    Returns IEditorLanguage

    The mode or null

  • Find a codemirror mode by MIME.

    Parameters

    • mime: string | readonly string[]

      Mime type to look for

    • Optional strict: boolean

      Whether xml and json should be assimilated to the generic mimetype

    Returns IEditorLanguage

    The mode or null

  • Find a codemirror mode by name.

    Parameters

    • name: string

      The mode name

    Returns IEditorLanguage

    The mode or null

  • Ensure a codemirror mode is available by name or Codemirror spec.

    Parameters

    • language: string | IEditorLanguage

      The mode to ensure. If it is a string, uses [findBest] to get the appropriate spec.

    Returns Promise<IEditorLanguage>

    A promise that resolves when the mode is available.

  • Get the raw list of available modes specs.

    Returns IEditorLanguage[]

    The available modes

  • Parse and style a string.

    Parameters

    • code: string

      Code to highlight

    • language: IEditorLanguage

      Code language

    • el: HTMLElement

      HTML element into which the highlighted code will be inserted

    Returns Promise<void>

Generated using TypeDoc