[

CodeMirror

](../../doc/logo.png)

JavaScript mode

JavaScript mode supports several configuration options:

  • json which will set the mode to expect JSON data rather than a JavaScript program.
  • jsonld which will set the mode to expect JSON-LD linked data rather than a JavaScript program (demo).
  • typescript which will activate additional syntax highlighting and some other things for TypeScript code (demo).
  • statementIndent which (given a number) will determine the amount of indentation to use for statements continued on a new line.
  • wordCharacters, a regexp that indicates which characters should be considered part of an identifier. Defaults to /[\w$]/, which does not handle non-ASCII identifiers. Can be set to something more elaborate to improve Unicode support.

MIME types defined: text/javascript, application/json, application/ld+json, text/typescript, application/typescript.