├── extra └── .keep ├── docs ├── _build │ └── .gitkeep ├── _static │ └── .gitkeep ├── _templates │ └── .gitkeep ├── readme.md ├── upgrade-11.md ├── supported-languages.md └── requirements.txt ├── test ├── markup │ ├── shell │ │ ├── simple.txt │ │ ├── single.txt │ │ ├── plain-prompt.txt │ │ ├── simple.expect.txt │ │ ├── prompt-with-tilde.txt │ │ ├── plain-prompt.expect.txt │ │ ├── single.expect.txt │ │ ├── prompt-with-tilde.expect.txt │ │ └── command-continuation.txt │ ├── actionscript │ │ ├── method-call.txt │ │ └── method-call.expect.txt │ ├── clojure-repl │ │ ├── prompt.txt │ │ └── prompt.expect.txt │ ├── handlebars │ │ ├── partial-call.txt │ │ ├── simple-expression.txt │ │ ├── triple-mustache.txt │ │ ├── block.txt │ │ ├── raw-block.txt │ │ ├── block-with-param.txt │ │ ├── comments.txt │ │ ├── block-parameters-as.txt │ │ ├── simple-expression.expect.txt │ │ ├── triple-mustache.expect.txt │ │ ├── combinations-with-text.txt │ │ ├── partial-call.expect.txt │ │ ├── if-else.txt │ │ ├── block-expression-variants-in-param.txt │ │ ├── built-ins.txt │ │ ├── block-expression-variants-as-path-segment.txt │ │ ├── literals.txt │ │ ├── hashes.txt │ │ ├── path-expressions.txt │ │ ├── block.expect.txt │ │ ├── block-with-param.expect.txt │ │ ├── else-variants.txt │ │ ├── block-expression-variants-in-helper-name.txt │ │ ├── literals-in-different-places.txt │ │ ├── comments.expect.txt │ │ ├── escaped-mustaches.txt │ │ ├── sub-expressions.txt │ │ └── raw-block.expect.txt │ ├── scala │ │ ├── given.txt │ │ ├── if-then-else.txt │ │ ├── for-do.txt │ │ ├── while-do.txt │ │ ├── quoted-code.txt │ │ ├── export.txt │ │ ├── transparent.txt │ │ ├── symbol.txt │ │ ├── enum.txt │ │ ├── strings.txt │ │ ├── export.expect.txt │ │ ├── case-classes.txt │ │ ├── given.expect.txt │ │ ├── using-directives.txt │ │ ├── strings.expect.txt │ │ ├── using.txt │ │ ├── symbol.expect.txt │ │ ├── for-do.expect.txt │ │ ├── while-do.expect.txt │ │ ├── quoted-code.expect.txt │ │ ├── if-then-else.expect.txt │ │ ├── extension.txt │ │ ├── inline.txt │ │ ├── transparent.expect.txt │ │ └── enum.expect.txt │ ├── bash │ │ ├── variables.txt │ │ ├── not-comments.txt │ │ ├── escaped-apos.txt │ │ ├── escaped-quote.txt │ │ ├── no-numbers.txt │ │ ├── escaped-apos.expect.txt │ │ ├── not-comments.expect.txt │ │ ├── variables.expect.txt │ │ ├── escaped-quote.expect.txt │ │ ├── no-numbers.expect.txt │ │ ├── token-containing-keyword.txt │ │ ├── arithmetic.txt │ │ ├── token-containing-keyword.expect.txt │ │ └── strings.txt │ ├── sql │ │ ├── keywords.txt │ │ ├── numeric-types.txt │ │ ├── set-operator.txt │ │ ├── values-statement.txt │ │ ├── string-types.txt │ │ ├── functions.txt │ │ ├── keywords.expect.txt │ │ ├── numeric-types.expect.txt │ │ ├── string-types.expect.txt │ │ ├── functions.expect.txt │ │ └── set-operator.expect.txt │ ├── clojure │ │ ├── character.txt │ │ ├── comment-macro.txt │ │ ├── symbols-numbers.txt │ │ ├── character.expect.txt │ │ ├── comment-macro.expect.txt │ │ └── symbols-numbers.expect.txt │ ├── csharp │ │ ├── scoped.txt │ │ ├── identifiers.txt │ │ ├── dotted-namespace.txt │ │ ├── floats.txt │ │ ├── try-catch.txt │ │ ├── records.txt │ │ ├── identifiers.expect.txt │ │ ├── dotted-namespace.expect.txt │ │ ├── string-interpolation.txt │ │ ├── functions.txt │ │ ├── scoped.expect.txt │ │ ├── try-catch.expect.txt │ │ ├── generic_modifiers.txt │ │ └── floats.expect.txt │ ├── ebnf │ │ ├── underscore-production.txt │ │ ├── underscore-production.expect.txt │ │ ├── terminators.txt │ │ ├── quote-symbols.txt │ │ └── terminators.expect.txt │ ├── excel │ │ ├── comments.txt │ │ └── comments.expect.txt │ ├── javascript │ │ ├── shebang.txt │ │ ├── template-strings.txt │ │ ├── keyword-as-part-of-method-name.txt │ │ ├── default-parameters.txt │ │ ├── built-in.txt │ │ ├── block-comments.txt │ │ ├── keyword-as-part-of-method-name.expect.txt │ │ ├── regex.txt │ │ ├── method-call.txt │ │ ├── seperated-parameters.txt │ │ ├── shebang.expect.txt │ │ ├── conventions.txt │ │ ├── keyword_as_identifier.txt │ │ ├── jsx-fragment.txt │ │ ├── block-comments.expect.txt │ │ ├── template-strings.expect.txt │ │ ├── default-parameters.expect.txt │ │ ├── comments.txt │ │ ├── modules.txt │ │ ├── object-attr.txt │ │ ├── method-call.expect.txt │ │ ├── seperated-parameters.expect.txt │ │ ├── built-in.expect.txt │ │ ├── regex.expect.txt │ │ ├── jsdoc.txt │ │ └── arrow-function.txt │ ├── pony │ │ ├── lambda.txt │ │ ├── prime.txt │ │ ├── creator.txt │ │ ├── triple-quote.txt │ │ ├── lambda.expect.txt │ │ ├── triple-quote.expect.txt │ │ ├── method.txt │ │ ├── creator.expect.txt │ │ ├── prime.expect.txt │ │ ├── objects.txt │ │ ├── match.txt │ │ ├── iterface-trait.txt │ │ ├── number-literals.txt │ │ ├── method.expect.txt │ │ └── control-flow.txt │ ├── scheme │ │ ├── quoted.txt │ │ ├── quoted.expect.txt │ │ └── lambda.txt │ ├── haskell │ │ ├── nested-comments.txt │ │ ├── infix.txt │ │ ├── nested-comments.expect.txt │ │ ├── infix.expect.txt │ │ └── char.txt │ ├── ini │ │ ├── variable.txt │ │ ├── tables.txt │ │ ├── comments.txt │ │ ├── variable.expect.txt │ │ ├── array.txt │ │ ├── tables.expect.txt │ │ ├── types.txt │ │ ├── comments.expect.txt │ │ └── array.expect.txt │ ├── latex │ │ ├── parameters.txt │ │ ├── chars.txt │ │ ├── comments.txt │ │ ├── parameters.expect.txt │ │ └── chars.expect.txt │ ├── swift │ │ ├── identifiers.txt │ │ ├── operator-declarations.txt │ │ ├── distributed-actor-runtime.txt │ │ ├── identifiers.expect.txt │ │ ├── precedencegroup.txt │ │ ├── parameterpack.txt │ │ ├── availability.txt │ │ ├── swiftui.txt │ │ ├── class-func-var.txt │ │ ├── macro.txt │ │ ├── tuples.txt │ │ ├── distributed-actor-runtime.expect.txt │ │ └── operator-declarations.expect.txt │ ├── twig │ │ ├── filter_with_underscore.txt │ │ ├── filter_with_underscore.expect.txt │ │ └── template_tags.txt │ ├── rust │ │ ├── variables.txt │ │ ├── comments.txt │ │ ├── traits.txt │ │ ├── types.txt │ │ ├── comments.expect.txt │ │ ├── invoked-keywords.txt │ │ ├── numbers.txt │ │ ├── strings.txt │ │ └── variables.expect.txt │ ├── tap │ │ ├── without-numbers.txt │ │ ├── basic.txt │ │ ├── without-numbers.expect.txt │ │ └── basic.expect.txt │ ├── ruby │ │ ├── gemfile.txt │ │ ├── blocks.txt │ │ ├── regexes.txt │ │ ├── gemfile.expect.txt │ │ ├── regexes.expect.txt │ │ └── blocks.expect.txt │ ├── cpp │ │ ├── initializers.txt │ │ ├── truncated-raw-string.txt │ │ ├── pointers-returns.txt │ │ ├── expression-keywords.txt │ │ ├── truncated-raw-string.expect.txt │ │ ├── function-like-keywords.txt │ │ ├── function-params.txt │ │ ├── bugs.txt │ │ ├── bitwise-keywords.txt │ │ ├── comments.txt │ │ ├── function-title.txt │ │ └── expression-keywords.expect.txt │ ├── fsharp │ │ ├── bang-keywords.txt │ │ ├── attributes.txt │ │ ├── bang-keywords.expect.txt │ │ └── attributes.expect.txt │ ├── python │ │ ├── function-header.txt │ │ ├── false_positives.txt │ │ ├── false_positives.expect.txt │ │ ├── class_self.txt │ │ ├── function-header-comments.txt │ │ ├── matrix-multiplication.txt │ │ ├── identifiers.txt │ │ ├── keywords.txt │ │ ├── diacritic_identifiers.txt │ │ ├── function-header.expect.txt │ │ ├── decorators.txt │ │ └── matrix-multiplication.expect.txt │ ├── subunit │ │ ├── subunit-errorline.txt │ │ ├── subunit-skipline.txt │ │ ├── subunit-xfailline.txt │ │ ├── subunit-uxsuccessline.txt │ │ ├── subunit-tagline.txt │ │ ├── subunit-timeline.txt │ │ ├── subunit-failureline.txt │ │ ├── subunit-progressline.txt │ │ ├── subunit-errorline.expect.txt │ │ ├── subunit-skipline.expect.txt │ │ ├── subunit-xfailline.expect.txt │ │ ├── subunit-uxsuccessline.expect.txt │ │ ├── subunit-successline.txt │ │ ├── subunit-failureline.expect.txt │ │ ├── subunit-testline.txt │ │ ├── subunit-tagline.expect.txt │ │ └── subunit-timeline.expect.txt │ ├── dos │ │ ├── comments.txt │ │ └── comments.expect.txt │ ├── ceylon │ │ ├── nested-comments.txt │ │ └── nested-comments.expect.txt │ ├── java │ │ ├── textblock.txt │ │ ├── bugs.txt │ │ ├── functions.txt │ │ ├── gh1031.txt │ │ ├── bugs.expect.txt │ │ ├── textblock.expect.txt │ │ ├── annotations.txt │ │ ├── switch.txt │ │ ├── titles.txt │ │ └── functions.expect.txt │ ├── crystal │ │ ├── toplevel-keywords.txt │ │ ├── defs.txt │ │ ├── macro.txt │ │ ├── regexes.txt │ │ ├── operators.txt │ │ ├── operators.expect.txt │ │ └── toplevel-keywords.expect.txt │ ├── elixir │ │ ├── strings.txt │ │ ├── char-literal.txt │ │ ├── function-not-regex.txt │ │ ├── module-references.txt │ │ ├── function-title.txt │ │ ├── modules.txt │ │ ├── strings.expect.txt │ │ ├── char-literal.expect.txt │ │ ├── uppercase-string-sigil.txt │ │ └── function-not-regex.expect.txt │ ├── dart │ │ ├── string-interpolation.txt │ │ ├── comment-markdown.txt │ │ └── string-interpolation.expect.txt │ ├── typescript │ │ ├── identifiers_that_include_keywords.txt │ │ ├── nested-templates.txt │ │ ├── satisfies-and-as.txt │ │ ├── namespace_as_identifier.txt │ │ ├── numbers-and-dashes.txt │ │ ├── declares.txt │ │ ├── identifiers_that_include_keywords.expect.txt │ │ ├── decorator-factories.txt │ │ ├── module-id.txt │ │ ├── nested-templates.expect.txt │ │ ├── namespace_as_identifier.expect.txt │ │ └── satisfies-and-as.expect.txt │ ├── yaml │ │ ├── inline.txt │ │ ├── string.txt │ │ ├── numbers.txt │ │ ├── tag.txt │ │ └── special_chars.txt │ ├── http │ │ ├── just_headers.txt │ │ ├── default.txt │ │ ├── just_headers.expect.txt │ │ └── http3.txt │ ├── php │ │ ├── case.txt │ │ ├── php80.txt │ │ ├── numbers.txt │ │ ├── namespace.txt │ │ └── comments.txt │ ├── xml │ │ ├── sublanguage_no_relevancy.txt │ │ ├── space-attributes.txt │ │ ├── non-ascii-attribute-names.txt │ │ ├── namespace.txt │ │ ├── unquoted-attributes.txt │ │ ├── processing.txt │ │ ├── non-ascii-element-names.txt │ │ └── sublanguage_no_relevancy.expect.txt │ ├── aspectj │ │ ├── intertype-constructor.txt │ │ ├── intertype-method.txt │ │ └── intertype-constructor.expect.txt │ ├── verilog │ │ ├── directives.txt │ │ ├── numbers.txt │ │ ├── directives.expect.txt │ │ └── numbers.expect.txt │ ├── plaintext │ │ ├── default.txt │ │ └── default.expect.txt │ ├── vim │ │ ├── strings-comments.txt │ │ ├── strings-comments.expect.txt │ │ └── default.txt │ ├── dust │ │ └── default.txt │ ├── protobuf │ │ ├── rpc.txt │ │ ├── message-message.txt │ │ └── rpc.expect.txt │ ├── vbscript-html │ │ └── default.txt │ ├── markdown │ │ ├── list.txt │ │ ├── links.txt │ │ ├── entity.txt │ │ ├── sections.txt │ │ ├── list.expect.txt │ │ ├── links.expect.txt │ │ └── entity.expect.txt │ ├── stata │ │ ├── built_ins.txt │ │ └── built_ins.expect.txt │ ├── node-repl │ │ └── sample.txt │ ├── delphi │ │ ├── compiler-directive.txt │ │ └── character-string.txt │ ├── php-template │ │ └── default.txt │ ├── less │ │ └── selectors.txt │ ├── lisp │ │ ├── mec.txt │ │ └── mec.expect.txt │ ├── taggerscript │ │ ├── functions.txt │ │ ├── noop.txt │ │ ├── noop.expect.txt │ │ └── functions.expect.txt │ ├── coffeescript │ │ ├── division.txt │ │ ├── regex.txt │ │ ├── function.txt │ │ └── division.expect.txt │ ├── go │ │ ├── strings.txt │ │ └── functions.txt │ ├── ldif │ │ ├── ldapmodify.txt │ │ └── ldapmodify.expect.txt │ ├── kotlin │ │ ├── string.txt │ │ ├── class.txt │ │ ├── nested_comment.txt │ │ ├── function.txt │ │ └── nested_comment.expect.txt │ ├── powershell │ │ ├── flags.txt │ │ ├── apos-herestring.txt │ │ ├── quote-herestring.txt │ │ ├── apos-herestring.expect.txt │ │ └── quote-herestring.expect.txt │ ├── x86asm │ │ ├── labels-directives.txt │ │ └── labels-directives.expect.txt │ ├── erlang │ │ ├── maybe.txt │ │ ├── doc_attribute.txt │ │ ├── maybe.expect.txt │ │ └── numbers.txt │ ├── nestedtext │ │ └── lists_of.txt │ ├── css │ │ ├── pseudo.txt │ │ ├── variables.txt │ │ ├── hex-colors.txt │ │ └── pseudo-selector.txt │ ├── cos │ │ ├── embedded.txt │ │ └── basic.txt │ ├── llvm │ │ ├── string.txt │ │ ├── numbers.txt │ │ └── simple.txt │ ├── groovy │ │ ├── oneoffs.txt │ │ └── oneoffs.expect.txt │ ├── gauss │ │ ├── function_refs.txt │ │ ├── keywords.txt │ │ └── function_defs.txt │ ├── fortran │ │ ├── dot_keywords.txt │ │ ├── comments.txt │ │ └── numbers.txt │ ├── reasonml │ │ ├── comments.txt │ │ └── modules.txt │ ├── objectivec │ │ ├── string-literals.txt │ │ └── preprocessor.txt │ ├── lsl │ │ └── default.txt │ ├── lasso │ │ └── delimiters.txt │ ├── makefile │ │ └── default.txt │ ├── perl │ │ ├── class.txt │ │ └── number.txt │ ├── golo │ │ └── default.txt │ ├── nsis │ │ └── variables.txt │ ├── vbnet │ │ ├── comments.txt │ │ └── literals.txt │ ├── xquery │ │ ├── function_body.txt │ │ ├── computed_inbuilt.txt │ │ └── direct_method.txt │ ├── python-repl │ │ └── sample.txt │ ├── erb │ │ └── default.txt │ ├── openscad │ │ └── default.txt │ ├── prolog │ │ └── default.txt │ ├── wren │ │ └── attributes.txt │ ├── maxima │ │ ├── numbers.txt │ │ └── symbols.txt │ ├── applescript │ │ └── default.txt │ ├── scilab │ │ └── default.txt │ ├── leaf │ │ └── default.txt │ ├── pgsql │ │ └── dollar_strings.txt │ ├── profile │ │ └── default.txt │ ├── django │ │ └── default.txt │ ├── diff │ │ └── comments.txt │ ├── haml │ │ └── default.txt │ ├── ocaml │ │ └── types.txt │ ├── processing │ │ └── default.txt │ ├── hsp │ │ └── default.txt │ ├── autoit │ │ └── default.txt │ ├── erlang-repl │ │ └── default.txt │ ├── tcl │ │ └── variables.txt │ ├── json │ │ └── comments.txt │ ├── ada │ │ └── default.txt │ ├── properties │ │ └── syntax.txt │ ├── dockerfile │ │ └── default.txt │ ├── r │ │ ├── numbers.txt │ │ └── strings.txt │ ├── n1ql │ │ └── default.txt │ ├── q │ │ └── default.txt │ ├── rsl │ │ └── default.txt │ └── brainfuck │ │ └── default.txt ├── detect │ ├── xml │ │ ├── js.txt │ │ ├── groovy-julia.txt │ │ └── default.txt │ ├── excel │ │ └── default.txt │ ├── ruby │ │ ├── double-colon.txt │ │ └── default.txt │ ├── node-repl │ │ └── default.txt │ ├── plaintext │ │ └── default.txt │ ├── dust │ │ └── default.txt │ ├── vbscript-html │ │ └── default.txt │ ├── clojure-repl │ │ └── default.txt │ ├── php-template │ │ └── default.txt │ ├── handlebars │ │ └── default.txt │ ├── javascript │ │ └── short-plain.txt │ ├── accesslog │ │ └── default.txt │ ├── ini │ │ └── default.txt │ ├── shell │ │ └── default.txt │ ├── lsl │ │ └── default.txt │ ├── properties │ │ └── default.txt │ ├── ceylon │ │ └── default.txt │ ├── makefile │ │ └── default.txt │ ├── go │ │ ├── default.txt │ │ └── swift-like.txt │ ├── golo │ │ └── default.txt │ ├── python-repl │ │ └── default.txt │ ├── objectivec │ │ └── default.txt │ ├── json │ │ └── default.txt │ ├── erb │ │ └── default.txt │ ├── openscad │ │ └── default.txt │ ├── prolog │ │ └── default.txt │ ├── http │ │ └── default.txt │ ├── bash │ │ └── default.txt │ ├── clojure │ │ └── default.txt │ ├── applescript │ │ └── default.txt │ ├── python │ │ └── default.txt │ ├── wasm │ │ └── default.txt │ ├── scilab │ │ └── default.txt │ ├── coffeescript │ │ └── default.txt │ ├── leaf │ │ └── default.txt │ ├── cpp │ │ └── default.txt │ ├── profile │ │ └── default.txt │ ├── django │ │ └── default.txt │ ├── sql │ │ └── default.txt │ ├── css │ │ └── default.txt │ ├── typescript │ │ └── default.txt │ ├── haml │ │ └── default.txt │ ├── pgsql │ │ └── default.txt │ ├── processing │ │ └── default.txt │ ├── hsp │ │ └── default.txt │ ├── java │ │ └── default.txt │ ├── vim │ │ └── default.txt │ ├── autoit │ │ └── default.txt │ ├── erlang-repl │ │ └── default.txt │ ├── pony │ │ └── default.txt │ ├── powershell │ │ └── default.txt │ ├── ada │ │ └── default.txt │ ├── csharp │ │ └── default.txt │ ├── markdown │ │ └── default.txt │ ├── n1ql │ │ └── default.txt │ ├── q │ │ └── default.txt │ ├── rsl │ │ └── default.txt │ ├── brainfuck │ │ └── default.txt │ └── twig │ │ └── default.txt ├── mocha.opts ├── browser │ ├── index.js │ └── plain.js ├── fixtures │ ├── expect │ │ ├── languagealias.txt │ │ ├── explicit2.txt │ │ ├── explicit1.txt │ │ ├── endsWithParentVariants.txt │ │ └── useBr.txt │ └── nested.js ├── parser │ └── index.js ├── builds │ ├── rollup_import_via_commonjs.mjs │ ├── rollup_import_cdn_build_esm.mjs │ ├── rollup_import_node_build_esm.mjs │ └── package.js └── api │ └── index.js ├── .mocharc.json ├── src ├── core.d.ts ├── styles │ ├── pojoaque.jpg │ └── brown-papersq.png ├── lib │ └── html_injection_error.js └── languages │ └── plaintext.js ├── .tokeignore ├── .git-blame-ignore-revs ├── .editorconfig ├── .github ├── dependabot.yml └── pull_request_template.md ├── .dockerignore ├── .gitattributes ├── demo └── readme.md ├── .gitignore └── .eslintrc.lang.js /extra/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_build/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_templates/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/readme.md: -------------------------------------------------------------------------------- 1 | ../README.md -------------------------------------------------------------------------------- /docs/upgrade-11.md: -------------------------------------------------------------------------------- 1 | ../VERSION_11_UPGRADE.md -------------------------------------------------------------------------------- /test/markup/shell/simple.txt: -------------------------------------------------------------------------------- 1 | > /bin/sh 2 | -------------------------------------------------------------------------------- /.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": "should" 3 | } 4 | -------------------------------------------------------------------------------- /docs/supported-languages.md: -------------------------------------------------------------------------------- 1 | ../SUPPORTED_LANGUAGES.md -------------------------------------------------------------------------------- /test/detect/xml/js.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/markup/shell/single.txt: -------------------------------------------------------------------------------- 1 | $ echo "$HOME" -n 2 | -------------------------------------------------------------------------------- /test/markup/actionscript/method-call.txt: -------------------------------------------------------------------------------- 1 | x.get(0); 2 | -------------------------------------------------------------------------------- /test/markup/clojure-repl/prompt.txt: -------------------------------------------------------------------------------- 1 | user=> 2 | => 3 | -------------------------------------------------------------------------------- /test/markup/handlebars/partial-call.txt: -------------------------------------------------------------------------------- 1 | {{> partial}} 2 | -------------------------------------------------------------------------------- /test/markup/handlebars/simple-expression.txt: -------------------------------------------------------------------------------- 1 | {{abc}} 2 | -------------------------------------------------------------------------------- /test/markup/handlebars/triple-mustache.txt: -------------------------------------------------------------------------------- 1 | {{{raw}}} 2 | -------------------------------------------------------------------------------- /test/markup/shell/plain-prompt.txt: -------------------------------------------------------------------------------- 1 | > foo 2 | > /bin/sh 3 | -------------------------------------------------------------------------------- /test/markup/scala/given.txt: -------------------------------------------------------------------------------- 1 | given T = ??? 2 | given x: T = ??? 3 | -------------------------------------------------------------------------------- /test/markup/scala/if-then-else.txt: -------------------------------------------------------------------------------- 1 | def f = if true then 1 else 2 2 | -------------------------------------------------------------------------------- /test/markup/bash/variables.txt: -------------------------------------------------------------------------------- 1 | $A 2 | ${B} 3 | ${WURST:-${CARNE}} 4 | -------------------------------------------------------------------------------- /test/markup/handlebars/block.txt: -------------------------------------------------------------------------------- 1 | {{#block}}block content{{/block}} 2 | -------------------------------------------------------------------------------- /test/markup/scala/for-do.txt: -------------------------------------------------------------------------------- 1 | def f = for x <- Nil do println("hello") 2 | -------------------------------------------------------------------------------- /test/markup/scala/while-do.txt: -------------------------------------------------------------------------------- 1 | def f = while true do println("hello") 2 | -------------------------------------------------------------------------------- /test/markup/sql/keywords.txt: -------------------------------------------------------------------------------- 1 | select * from t where t.select is null; 2 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | myst-parser == 0.15.0 2 | sphinx-rtd-theme == 0.5.2 3 | -------------------------------------------------------------------------------- /test/detect/excel/default.txt: -------------------------------------------------------------------------------- 1 | =IF(C10 <= 275.5, "Unprofitable", "Profitable") -------------------------------------------------------------------------------- /test/markup/clojure/character.txt: -------------------------------------------------------------------------------- 1 | \A 2 | \a 3 | \formfeed 4 | \u00DF 5 | \o303 -------------------------------------------------------------------------------- /test/markup/csharp/scoped.txt: -------------------------------------------------------------------------------- 1 | public static ref T AsRef(scoped in T source); -------------------------------------------------------------------------------- /test/markup/ebnf/underscore-production.txt: -------------------------------------------------------------------------------- 1 | a_production = nonterminal ; 2 | -------------------------------------------------------------------------------- /test/markup/excel/comments.txt: -------------------------------------------------------------------------------- 1 | =(N4 + N5)*0.055 + N("This is a comment.") 2 | -------------------------------------------------------------------------------- /test/markup/javascript/shebang.txt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var a = 1; 4 | -------------------------------------------------------------------------------- /test/markup/pony/lambda.txt: -------------------------------------------------------------------------------- 1 | {(foo: I32)(bar): String => (foo + bar).string()} -------------------------------------------------------------------------------- /test/markup/scheme/quoted.txt: -------------------------------------------------------------------------------- 1 | (scheme 'a '(a quoted (list)) `(quoted)) 2 | -------------------------------------------------------------------------------- /src/core.d.ts: -------------------------------------------------------------------------------- 1 | import hljs from "highlight.js"; 2 | export default hljs; 3 | 4 | -------------------------------------------------------------------------------- /test/markup/haskell/nested-comments.txt: -------------------------------------------------------------------------------- 1 | {- this is a {- nested -} comment -} 2 | -------------------------------------------------------------------------------- /test/markup/ini/variable.txt: -------------------------------------------------------------------------------- 1 | memory_limit = ${PHP_MEMORY_LIMIT} 2 | key = $VAR1 3 | -------------------------------------------------------------------------------- /test/markup/latex/parameters.txt: -------------------------------------------------------------------------------- 1 | #7 2 | #789 3 | ##1 4 | #######2 5 | #{foo} 6 | -------------------------------------------------------------------------------- /test/markup/swift/identifiers.txt: -------------------------------------------------------------------------------- 1 | `func` 2 | { $0 + 1 } 3 | value.$wrappedValue 4 | -------------------------------------------------------------------------------- /test/markup/twig/filter_with_underscore.txt: -------------------------------------------------------------------------------- 1 | {{ "string with spaces"|url_encode }} -------------------------------------------------------------------------------- /.tokeignore: -------------------------------------------------------------------------------- 1 | test/* 2 | src/styles/* 3 | *.md 4 | *.json 5 | tools 6 | docs 7 | types 8 | -------------------------------------------------------------------------------- /test/detect/ruby/double-colon.txt: -------------------------------------------------------------------------------- 1 | def f(a = self.attr) 2 | A::B.new(a) 3 | end 4 | -------------------------------------------------------------------------------- /test/markup/haskell/infix.txt: -------------------------------------------------------------------------------- 1 | infix 3 `foo` 2 | infixl 6 `bar` 3 | infixr 9 `baz` 4 | -------------------------------------------------------------------------------- /test/markup/javascript/template-strings.txt: -------------------------------------------------------------------------------- 1 | `string ${foo + `str${undefined}ing`}`; 2 | -------------------------------------------------------------------------------- /test/markup/pony/prime.txt: -------------------------------------------------------------------------------- 1 | new create(name': String) => 2 | name = name' + 'a' 3 | -------------------------------------------------------------------------------- /test/markup/rust/variables.txt: -------------------------------------------------------------------------------- 1 | let foo; 2 | let mut bar; 3 | let _foo_bar; 4 | let r#foo; -------------------------------------------------------------------------------- /test/markup/scala/quoted-code.txt: -------------------------------------------------------------------------------- 1 | def f(using Quotes) = '{ val x = 1; ${g('x)} } 2 | -------------------------------------------------------------------------------- /test/markup/tap/without-numbers.txt: -------------------------------------------------------------------------------- 1 | 1..6 2 | not ok 3 | ok 4 | not ok 5 | ok 6 | ok 7 | -------------------------------------------------------------------------------- /test/detect/node-repl/default.txt: -------------------------------------------------------------------------------- 1 | > a = "1" 2 | '1' 3 | > function b(){ 4 | ... return 1+2; -------------------------------------------------------------------------------- /test/markup/bash/not-comments.txt: -------------------------------------------------------------------------------- 1 | echo asdf#qwert yuiop 2 | 3 | echo asdf #qwert yuiop 4 | -------------------------------------------------------------------------------- /test/markup/javascript/keyword-as-part-of-method-name.txt: -------------------------------------------------------------------------------- 1 | setTimeout(); 2 | setInterval(); -------------------------------------------------------------------------------- /test/markup/ruby/gemfile.txt: -------------------------------------------------------------------------------- 1 | gem "gem_name1", ">= 4.1" 2 | 3 | gem "gem_name2", "~> 4.1" 4 | -------------------------------------------------------------------------------- /test/markup/rust/comments.txt: -------------------------------------------------------------------------------- 1 | /* rust has 2 | /* nested /* block */ */ 3 | */ comments 4 | -------------------------------------------------------------------------------- /test/markup/scala/export.txt: -------------------------------------------------------------------------------- 1 | export scanUnit.scan 2 | export printUnit.{status => _, *} 3 | -------------------------------------------------------------------------------- /test/markup/scala/transparent.txt: -------------------------------------------------------------------------------- 1 | transparent inline def f() = 42 2 | transparent trait S 3 | -------------------------------------------------------------------------------- /test/markup/sql/numeric-types.txt: -------------------------------------------------------------------------------- 1 | SELECT CAST(32768 AS TINYINT) FROM VALUES('dummy'); 2 | -------------------------------------------------------------------------------- /test/markup/sql/set-operator.txt: -------------------------------------------------------------------------------- 1 | SELECT * FROM VALUES 1, 2 ,3 UNION ALL VALUES 1, 2, 3; 2 | -------------------------------------------------------------------------------- /test/markup/actionscript/method-call.expect.txt: -------------------------------------------------------------------------------- 1 | x.get(0); 2 | -------------------------------------------------------------------------------- /test/markup/cpp/initializers.txt: -------------------------------------------------------------------------------- 1 | string a("hello"), b("world"); 2 | vector u(1), v(2); 3 | -------------------------------------------------------------------------------- /test/markup/fsharp/bang-keywords.txt: -------------------------------------------------------------------------------- 1 | let! (result2 : byte[]) = stream.AsyncRead(bufferSize) 2 | -------------------------------------------------------------------------------- /test/markup/handlebars/raw-block.txt: -------------------------------------------------------------------------------- 1 | {{{{#raw}}}} {{verbatim}} content {{{{/raw}}}} {{var}} 2 | -------------------------------------------------------------------------------- /test/markup/python/function-header.txt: -------------------------------------------------------------------------------- 1 | def f(x: int, *, y: bool = True) -> None: 2 | pass 3 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-errorline.txt: -------------------------------------------------------------------------------- 1 | error: test simplename 2 | error: test simple name 3 | -------------------------------------------------------------------------------- /test/markup/dos/comments.txt: -------------------------------------------------------------------------------- 1 | rem comment 2 | rem comment 3 | copy a.txt b.txt > rem not_a_comment 4 | -------------------------------------------------------------------------------- /test/markup/ini/tables.txt: -------------------------------------------------------------------------------- 1 | [table] 2 | [[array]] 3 | [dotted.table.name] 4 | [target.'cfg(unix)'] 5 | -------------------------------------------------------------------------------- /test/markup/pony/creator.txt: -------------------------------------------------------------------------------- 1 | new create(env: Env, name: String) => 2 | _env = env 3 | _name = name -------------------------------------------------------------------------------- /test/markup/python/false_positives.txt: -------------------------------------------------------------------------------- 1 | foo = _undef 2 | bar 3 | 4 | booger = _unclass 5 | burger 6 | -------------------------------------------------------------------------------- /src/styles/pojoaque.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highlightjs/highlight.js/HEAD/src/styles/pojoaque.jpg -------------------------------------------------------------------------------- /test/markup/ceylon/nested-comments.txt: -------------------------------------------------------------------------------- 1 | /* 2 | /* 3 | Ceylon has nested comments. 4 | */ 5 | */ 6 | -------------------------------------------------------------------------------- /test/markup/handlebars/block-with-param.txt: -------------------------------------------------------------------------------- 1 | {{#blockHelper param1 param2}}block content{{/blockHelper}} 2 | -------------------------------------------------------------------------------- /test/markup/javascript/default-parameters.txt: -------------------------------------------------------------------------------- 1 | function visibleTodoFilter(state = 'watch', action) {} 2 | -------------------------------------------------------------------------------- /test/markup/python/false_positives.expect.txt: -------------------------------------------------------------------------------- 1 | foo = _undef 2 | bar 3 | 4 | booger = _unclass 5 | burger 6 | -------------------------------------------------------------------------------- /test/markup/scala/symbol.txt: -------------------------------------------------------------------------------- 1 | def f(s: Symbol) = { 2 | s match { 3 | case 'foo => 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # eslint --fix src/languages 2 | d64f68e8aabc67820eec2459bff9a7a0fcc06b95 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/markup/bash/escaped-apos.txt: -------------------------------------------------------------------------------- 1 | # Escaped apostrophe is not a string 2 | echo \'not-a-highlighted-string\' 3 | -------------------------------------------------------------------------------- /test/markup/cpp/truncated-raw-string.txt: -------------------------------------------------------------------------------- 1 | R"foo( 2 | Truncated raw string 3 | )nope" 4 | Still not completed. 5 | -------------------------------------------------------------------------------- /test/markup/csharp/identifiers.txt: -------------------------------------------------------------------------------- 1 | var @class = new MyClass(); 2 | doSomething(@var, @foo); 3 | var a; 4 | 5 | -------------------------------------------------------------------------------- /test/markup/java/textblock.txt: -------------------------------------------------------------------------------- 1 | String json = """ 2 | { 3 | "key": "value" 4 | } 5 | """; 6 | -------------------------------------------------------------------------------- /src/styles/brown-papersq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/highlightjs/highlight.js/HEAD/src/styles/brown-papersq.png -------------------------------------------------------------------------------- /test/markup/crystal/toplevel-keywords.txt: -------------------------------------------------------------------------------- 1 | class Foo; end 2 | struct Bar; end 3 | 4 | annotation JSON::Field; end 5 | -------------------------------------------------------------------------------- /test/markup/ebnf/underscore-production.expect.txt: -------------------------------------------------------------------------------- 1 | a_production = nonterminal ; 2 | -------------------------------------------------------------------------------- /test/markup/elixir/strings.txt: -------------------------------------------------------------------------------- 1 | a = """ 2 | test 3 | """ 4 | b = ''' 5 | test 6 | ''' 7 | c = "test" 8 | d = 'test' 9 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-skipline.txt: -------------------------------------------------------------------------------- 1 | skip test simplename 2 | skip: test simple name 3 | skip test simple name 4 | -------------------------------------------------------------------------------- /test/mocha.opts: -------------------------------------------------------------------------------- 1 | --require should 2 | --reporter spec 3 | --ui bdd 4 | --bail 5 | --check-leaks 6 | --inline-diffs 7 | -------------------------------------------------------------------------------- /test/markup/bash/escaped-quote.txt: -------------------------------------------------------------------------------- 1 | # Escaped double-quote is not a string 2 | echo '"quoted"' | tr -d \" > text.txt 3 | -------------------------------------------------------------------------------- /test/markup/dart/string-interpolation.txt: -------------------------------------------------------------------------------- 1 | '1234$identifier $true'; 2 | // comment 3 | '1234${1234 + true + 'foo'}'; 4 | -------------------------------------------------------------------------------- /test/markup/elixir/char-literal.txt: -------------------------------------------------------------------------------- 1 | defguardp apostrophe?(c) when c == ?' 2 | defguardp upper?(c) when (c >= ?A and c <= ?Z) -------------------------------------------------------------------------------- /test/markup/handlebars/comments.txt: -------------------------------------------------------------------------------- 1 | {{!-- a comment {{expression}} --}} {{expression}} 2 | 3 | {{! a simple comment }} 4 | -------------------------------------------------------------------------------- /test/markup/pony/triple-quote.txt: -------------------------------------------------------------------------------- 1 | """ 2 | A triple quoted string 3 | * Goes several lines 4 | * Keeps formatting 5 | """ -------------------------------------------------------------------------------- /test/markup/scala/enum.txt: -------------------------------------------------------------------------------- 1 | enum Color: 2 | case Red, Green, Blue 3 | 4 | enum State: 5 | case On 6 | case Off 7 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-xfailline.txt: -------------------------------------------------------------------------------- 1 | xfail test simplename 2 | xfail: test simple name 3 | xfail test simple name 4 | -------------------------------------------------------------------------------- /test/markup/typescript/identifiers_that_include_keywords.txt: -------------------------------------------------------------------------------- 1 | const $class = () => true; 2 | const result = $class(); 3 | -------------------------------------------------------------------------------- /test/markup/yaml/inline.txt: -------------------------------------------------------------------------------- 1 | foo: [bar, bar2, [1, 2], 3] 2 | foo: {bar: [1, 2], baz: {inside: 3}} 3 | foo: ba{}r,ba[]z 4 | -------------------------------------------------------------------------------- /test/markup/csharp/dotted-namespace.txt: -------------------------------------------------------------------------------- 1 | namespace Dotted.Namespace 2 | { 3 | class MyClass 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/markup/http/just_headers.txt: -------------------------------------------------------------------------------- 1 | Host: example.org 2 | Content-Type: application/json; charset=utf-8 3 | Content-Length: 19 4 | -------------------------------------------------------------------------------- /test/markup/javascript/built-in.txt: -------------------------------------------------------------------------------- 1 | let bi = BigInt('1'); 2 | let inf = Infinity 3 | Number(undefined) 4 | let today = new Date() -------------------------------------------------------------------------------- /test/markup/php/case.txt: -------------------------------------------------------------------------------- 1 | $test = true 2 | $test = TRUE 3 | 4 | $a = false 5 | $a = FALSE 6 | 7 | $b = null 8 | $b = NULL 9 | -------------------------------------------------------------------------------- /test/markup/scala/strings.txt: -------------------------------------------------------------------------------- 1 | val s = """ this is a string "this is still a string" another quote: " after the quote """ 2 | -------------------------------------------------------------------------------- /test/markup/shell/simple.expect.txt: -------------------------------------------------------------------------------- 1 | > /bin/sh 2 | -------------------------------------------------------------------------------- /test/markup/typescript/nested-templates.txt: -------------------------------------------------------------------------------- 1 | let foo = true; 2 | `hello ${foo ? `Mr ${name}` : 'there'}`; 3 | foo = false; 4 | -------------------------------------------------------------------------------- /test/markup/typescript/satisfies-and-as.txt: -------------------------------------------------------------------------------- 1 | const test3 = 'test3' as ValidName 2 | const test4 = 'test4' satisfies ValidName 3 | -------------------------------------------------------------------------------- /test/markup/xml/sublanguage_no_relevancy.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/markup/aspectj/intertype-constructor.txt: -------------------------------------------------------------------------------- 1 | public MyClass.new() throws Exception{ 2 | // intertype constructor body 3 | } 4 | -------------------------------------------------------------------------------- /test/markup/cpp/pointers-returns.txt: -------------------------------------------------------------------------------- 1 | // These will all work: 2 | char** foo_bar(); 3 | char ** foo_bar(); 4 | char **foo_bar(); 5 | -------------------------------------------------------------------------------- /test/markup/verilog/directives.txt: -------------------------------------------------------------------------------- 1 | `define CONSTANT value // this is a comment 2 | wire result = `CONSTANT + variable; // comment 3 | -------------------------------------------------------------------------------- /test/markup/xml/space-attributes.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/browser/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./plain'); 4 | require('./worker'); 5 | require('./highlight_block_callbacks'); 6 | -------------------------------------------------------------------------------- /test/detect/plaintext/default.txt: -------------------------------------------------------------------------------- 1 | id | description 2 | ----+------------- 3 | 1 | one 4 | 2 | two 5 | 3 | three 6 | (3 rows) 7 | -------------------------------------------------------------------------------- /test/markup/handlebars/block-parameters-as.txt: -------------------------------------------------------------------------------- 1 | {{#each filter as | value index|}} {{/each}} 2 | 3 | {{#with as as | as |}} {{/with}} 4 | -------------------------------------------------------------------------------- /test/markup/plaintext/default.txt: -------------------------------------------------------------------------------- 1 | id | description 2 | ----+------------- 3 | 1 | one 4 | 2 | two 5 | 3 | three 6 | (3 rows) 7 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-uxsuccessline.txt: -------------------------------------------------------------------------------- 1 | uxsuccess test simplename 2 | uxsuccess: test simple name 3 | uxsuccess test simple name 4 | -------------------------------------------------------------------------------- /test/markup/swift/operator-declarations.txt: -------------------------------------------------------------------------------- 1 | prefix operator +++ 2 | postfix operator +++ 3 | infix operator +-: AdditionPrecedence 4 | -------------------------------------------------------------------------------- /test/markup/vim/strings-comments.txt: -------------------------------------------------------------------------------- 1 | " comment 2 | let one = "string" " comment 3 | let two = "crazy 4 | \ string with a \" quote" 5 | -------------------------------------------------------------------------------- /test/detect/dust/default.txt: -------------------------------------------------------------------------------- 1 |

Hours

2 | 3 | 8 | -------------------------------------------------------------------------------- /test/detect/vbscript-html/default.txt: -------------------------------------------------------------------------------- 1 | 2 | <% 3 | If i < 10 Then 4 | response.write("Good morning!") 5 | End If 6 | %> 7 | 8 | -------------------------------------------------------------------------------- /test/markup/dust/default.txt: -------------------------------------------------------------------------------- 1 |

Hours

2 | 3 | 8 | -------------------------------------------------------------------------------- /test/markup/ebnf/terminators.txt: -------------------------------------------------------------------------------- 1 | full-stop = "." . 2 | semicolon = ";" ; 3 | end-test = "end" ; (* ending production to test semicolon *) 4 | -------------------------------------------------------------------------------- /test/markup/elixir/function-not-regex.txt: -------------------------------------------------------------------------------- 1 | import Kernel, except: [ 2 | spawn: 1, 3 | +: 2, 4 | /: 2, 5 | unless: 2 6 | ] 7 | -------------------------------------------------------------------------------- /test/markup/plaintext/default.expect.txt: -------------------------------------------------------------------------------- 1 | id | description 2 | ----+------------- 3 | 1 | one 4 | 2 | two 5 | 3 | three 6 | (3 rows) 7 | -------------------------------------------------------------------------------- /test/markup/protobuf/rpc.txt: -------------------------------------------------------------------------------- 1 | service Greeter { 2 | // Sends a greeting 3 | rpc SayHello (HelloRequest) returns (HelloReply) {} 4 | } 5 | -------------------------------------------------------------------------------- /test/markup/ruby/blocks.txt: -------------------------------------------------------------------------------- 1 | [1, 2, 3].each do |num| 2 | puts num 3 | end 4 | 5 | names |= users.map do |user| 6 | user.name 7 | end 8 | -------------------------------------------------------------------------------- /test/markup/vbscript-html/default.txt: -------------------------------------------------------------------------------- 1 | 2 | <% 3 | If i < 10 Then 4 | response.write("Good morning!") 5 | End If 6 | %> 7 | 8 | -------------------------------------------------------------------------------- /test/detect/clojure-repl/default.txt: -------------------------------------------------------------------------------- 1 | user=> (defn f [x y] 2 | #_=> (+ x y)) 3 | #'user/f 4 | user=> (f 5 7) 5 | 12 6 | user=> nil 7 | nil 8 | -------------------------------------------------------------------------------- /test/markup/csharp/floats.txt: -------------------------------------------------------------------------------- 1 | float test = 1.0f; 2 | float test2 = 1.f; 3 | float test3 = 1.0; 4 | float test4 = 1; 5 | float test5 = 1_000; 6 | -------------------------------------------------------------------------------- /test/markup/javascript/block-comments.txt: -------------------------------------------------------------------------------- 1 | /* Block-Comment */ 2 | 3 | /* Can 4 | Be 5 | Multi- 6 | Line 7 | */ 8 | 9 | /**/ 10 | -------------------------------------------------------------------------------- /test/markup/markdown/list.txt: -------------------------------------------------------------------------------- 1 | - this is a list 2 | - this is another 3 | - nested list 4 | - another nested 5 | * nested alternative 6 | -------------------------------------------------------------------------------- /test/markup/pony/lambda.expect.txt: -------------------------------------------------------------------------------- 1 | {(foo: I32)(bar): String => (foo + bar).string()} -------------------------------------------------------------------------------- /test/markup/fsharp/attributes.txt: -------------------------------------------------------------------------------- 1 | // Strings and numbers are highlighted inside the attribute 2 | [] 3 | [] 4 | let x () = () -------------------------------------------------------------------------------- /test/markup/java/bugs.txt: -------------------------------------------------------------------------------- 1 | 2 | // `else x =` should not be detected as a variable creation 3 | if ( O == l ) 4 | l = O1; 5 | else 6 | a = 01; 7 | -------------------------------------------------------------------------------- /test/markup/markdown/links.txt: -------------------------------------------------------------------------------- 1 | ![](https://example.com) 2 | [](https://example.com) 3 | ![alt](https://example.com) 4 | [text](https://example.com) 5 | -------------------------------------------------------------------------------- /test/markup/python/class_self.txt: -------------------------------------------------------------------------------- 1 | class SelfTest: 2 | def __init__(self): 3 | self.text = True 4 | 5 | def method(self): 6 | pass -------------------------------------------------------------------------------- /test/markup/rust/traits.txt: -------------------------------------------------------------------------------- 1 | fn sqr(i: i32) { i * i } 2 | trait Minimum : Copy {} 3 | pub trait Builder where Self: Sized + Iterator {} 4 | -------------------------------------------------------------------------------- /test/markup/stata/built_ins.txt: -------------------------------------------------------------------------------- 1 | local b1 = ln(`or') 2 | generate logit1 = log( pgty1 / ( 1 - pgty1)) 3 | generate logit2 = log( pgty2 / ( 1 - pgty2)) 4 | -------------------------------------------------------------------------------- /test/markup/cpp/expression-keywords.txt: -------------------------------------------------------------------------------- 1 | double x = exp(log(2)); // recognize built-ins 2 | return 0; // recognize keyword that started the expression 3 | -------------------------------------------------------------------------------- /test/markup/haskell/nested-comments.expect.txt: -------------------------------------------------------------------------------- 1 | {- this is a {- nested -} comment -} 2 | -------------------------------------------------------------------------------- /test/markup/markdown/entity.txt: -------------------------------------------------------------------------------- 1 | - named entities: &, ¾, Æ 2 | - decimal entities: A ¤ 3 | - hexadecimal entities: � H. -------------------------------------------------------------------------------- /test/markup/node-repl/sample.txt: -------------------------------------------------------------------------------- 1 | > for(let i=0;i<5;i++){ 2 | ... console.log(i); 3 | ... } 4 | 0 5 | 1 6 | 2 7 | 3 8 | 4 9 | undefined 10 | > 11 | -------------------------------------------------------------------------------- /test/markup/ruby/regexes.txt: -------------------------------------------------------------------------------- 1 | str =~ /^(?:foo)$/ 2 | str =~ %r{foo|bar|buz$} 3 | str =~ %r!foo|bar$! 4 | str =~ %r[foo|bar$] 5 | str =~ %r(\(foo|bar\)$) 6 | -------------------------------------------------------------------------------- /test/markup/scheme/quoted.expect.txt: -------------------------------------------------------------------------------- 1 | (scheme 'a '(a quoted (list)) `(quoted)) 2 | -------------------------------------------------------------------------------- /test/markup/shell/prompt-with-tilde.txt: -------------------------------------------------------------------------------- 1 | ~/docs> cat readme.adoc 2 | = Highlight.js 3 | 4 | Highlight.js is a syntax highlighter written in JavaScript. 5 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-tagline.txt: -------------------------------------------------------------------------------- 1 | tags: fuzz unit beta functional 2 | tags: -functional basic -beta 3 | tags: -unit 4 | tags: unit 5 | tags: ddd 6 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-timeline.txt: -------------------------------------------------------------------------------- 1 | time: 2016-03-13 18:12:37.231080Z 2 | time: 1917-10-25 09:05:37.231080Z 3 | time: 1984-03-24 07:02:09.231080Z 4 | -------------------------------------------------------------------------------- /test/markup/swift/distributed-actor-runtime.txt: -------------------------------------------------------------------------------- 1 | distributed actor Foobar { 2 | distributed func baz() { 3 | } 4 | 5 | func qux() { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | end_of_line = lf 3 | insert_final_newline = true 4 | 5 | [*.{js,css}] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | -------------------------------------------------------------------------------- /test/markup/cpp/truncated-raw-string.expect.txt: -------------------------------------------------------------------------------- 1 | R"foo( 2 | Truncated raw string 3 | )nope" 4 | Still not completed. 5 | -------------------------------------------------------------------------------- /test/markup/delphi/compiler-directive.txt: -------------------------------------------------------------------------------- 1 | { Compiler directives } 2 | {$I} (*$I*) 3 | procedure A(x: {$IFDEF Debug}Integer{$ELSE}Word{$ENDIF}); 4 | begin end; 5 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-failureline.txt: -------------------------------------------------------------------------------- 1 | failure: test simplename1 2 | failure test simplename1 3 | failure: test simple name1 4 | failure test simple name1 5 | -------------------------------------------------------------------------------- /test/markup/typescript/namespace_as_identifier.txt: -------------------------------------------------------------------------------- 1 | const message = 'foo'; 2 | const namespace = 'bar'; 3 | function baz() {} -------------------------------------------------------------------------------- /test/markup/verilog/numbers.txt: -------------------------------------------------------------------------------- 1 | a = 'hff; 2 | A = 'HFF; 3 | b = 8'h33; 4 | B = 8'H33; 5 | c = 12; 6 | d = 'o755; 7 | e = 8'b1001_0001; 8 | f = 8'b1111zzzx; 9 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /test/detect/php-template/default.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /test/markup/javascript/keyword-as-part-of-method-name.expect.txt: -------------------------------------------------------------------------------- 1 | setTimeout(); 2 | setInterval(); -------------------------------------------------------------------------------- /test/markup/php-template/default.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-progressline.txt: -------------------------------------------------------------------------------- 1 | progress: +5 2 | progress: +12 3 | progress: 29 4 | progress: -3 5 | progress: -91 6 | progress: push 7 | progress: pop 8 | -------------------------------------------------------------------------------- /test/markup/handlebars/simple-expression.expect.txt: -------------------------------------------------------------------------------- 1 | {{abc}} 2 | -------------------------------------------------------------------------------- /test/markup/handlebars/triple-mustache.expect.txt: -------------------------------------------------------------------------------- 1 | {{{raw}}} 2 | -------------------------------------------------------------------------------- /test/markup/ini/comments.txt: -------------------------------------------------------------------------------- 1 | # Comment 2 | ; ini-style comment 3 | x = "abc" # Comment on same line 4 | y = 123 ; Comment on same line 5 | [table] ; Comment on same line 6 | -------------------------------------------------------------------------------- /test/markup/less/selectors.txt: -------------------------------------------------------------------------------- 1 | #foo { 2 | div #bar {} 3 | > #bar {} 4 | #bar {} 5 | &#bar {} 6 | &:hover {} 7 | height: ~"@{height}px"; 8 | } 9 | -------------------------------------------------------------------------------- /test/markup/scala/export.expect.txt: -------------------------------------------------------------------------------- 1 | export scanUnit.scan 2 | export printUnit.{status => _, *} 3 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-errorline.expect.txt: -------------------------------------------------------------------------------- 1 | error: test simplename 2 | error: test simple name 3 | -------------------------------------------------------------------------------- /test/markup/bash/no-numbers.txt: -------------------------------------------------------------------------------- 1 | # numbers aren't highlighted in bash as their semantics is 2 | # not strictly defined for command line parameters 3 | $ tail -10 access.log 4 | -------------------------------------------------------------------------------- /test/markup/csharp/try-catch.txt: -------------------------------------------------------------------------------- 1 | try 2 | { 3 | throw new InvalidCastException(); 4 | } 5 | catch (InvalidCastException e) when (e.Data != null) 6 | { 7 | throw; 8 | } 9 | -------------------------------------------------------------------------------- /test/markup/javascript/regex.txt: -------------------------------------------------------------------------------- 1 | // examples that have proven problematic in the past 2 | `Bad ${foo / 1000}` 3 | foo = 2 / 2 + 2 / 2; 4 | foo = / 2 + 2 /; 5 | b = a++ / 2; 6 | -------------------------------------------------------------------------------- /test/markup/lisp/mec.txt: -------------------------------------------------------------------------------- 1 | ; MEC: Multiple Escape Characters. See https://github.com/highlightjs/highlight.js/issues/615 2 | (|spaces and 3 | newlines| x) 4 | (x '|quoted|) 5 | -------------------------------------------------------------------------------- /test/markup/sql/values-statement.txt: -------------------------------------------------------------------------------- 1 | VALUES 1, 2 , 3; 2 | 3 | VALUES 4 | (1, 'Spock'), 5 | (2,'Kirk') , 6 | (3, 'McCoy'), 7 | (4,'Scotty'); 8 | -------------------------------------------------------------------------------- /test/markup/taggerscript/functions.txt: -------------------------------------------------------------------------------- 1 | text$func( 2 | par1$noop(comment),\), 3 | $func(%abc%,xyz), 4 | $noopnot(not a comment$noop(proper\( comment)) 5 | )text 6 | -------------------------------------------------------------------------------- /test/markup/taggerscript/noop.txt: -------------------------------------------------------------------------------- 1 | $noop(\))text 2 | $noop(\()text 3 | $noop(\($noop(abc$func(\))\)xyz))text 4 | $noop(Multiline \(comment 5 | $func($noop(test)) 6 | )text 7 | -------------------------------------------------------------------------------- /test/markup/ceylon/nested-comments.expect.txt: -------------------------------------------------------------------------------- 1 | /* 2 | /* 3 | Ceylon has nested comments. 4 | */ 5 | */ 6 | -------------------------------------------------------------------------------- /test/markup/coffeescript/division.txt: -------------------------------------------------------------------------------- 1 | # Divisions 2 | x = 6/foo/i 3 | x = 6 /foo 4 | x = 6 / foo 5 | x = 6 /foo * 2/gm 6 | x = f /foo 7 | x = f / foo / gm 8 | x = f /foo * 2/6 9 | -------------------------------------------------------------------------------- /test/markup/go/strings.txt: -------------------------------------------------------------------------------- 1 | func main() { 2 | str := "Hello, 世界\nHello \"world\"\nHello 'world'" 3 | char := 'a' 4 | char2 := '"' 5 | char3 := '\\' 6 | char3 := '\'' 7 | } 8 | -------------------------------------------------------------------------------- /test/markup/javascript/method-call.txt: -------------------------------------------------------------------------------- 1 | x.continue(0); 2 | 3 | x = [ 4 | hljs.COMMENT(/\{%\s*comment\s*%}/, /\{%\s*endcomment\s*%}/), 5 | hljs.COMMENT(/\{#/, /#}/), 6 | ] 7 | 8 | -------------------------------------------------------------------------------- /test/markup/javascript/seperated-parameters.txt: -------------------------------------------------------------------------------- 1 | function visibleTodoFilter (state = 'watch', action) {} 2 | 3 | function visibleTodoFilter (state, action) { 4 | // ... 5 | } 6 | -------------------------------------------------------------------------------- /test/markup/javascript/shebang.expect.txt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var a = 1; 4 | -------------------------------------------------------------------------------- /test/markup/ldif/ldapmodify.txt: -------------------------------------------------------------------------------- 1 | dn: uid=user.0,ou=People,dc=example,dc=com 2 | changeType: modify 3 | add: cn 4 | cn: Morris Day 5 | - 6 | add: mobile 7 | mobile: (408) 555-7844 8 | -------------------------------------------------------------------------------- /test/markup/rust/types.txt: -------------------------------------------------------------------------------- 1 | type A: Trait; 2 | type A; 3 | type A = B; 4 | type R = m::R 5 | 6 | let vec: Vec = Vec::new(); 7 | if 100 > i32::MAX {} 8 | -------------------------------------------------------------------------------- /test/markup/scala/case-classes.txt: -------------------------------------------------------------------------------- 1 | abstract class Vertical extends CaseJeu 2 | case class Haut(name: String) extends Vertical 3 | case class Bas(name: String) extends Vertical 4 | -------------------------------------------------------------------------------- /test/detect/xml/groovy-julia.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/markup/clojure/comment-macro.txt: -------------------------------------------------------------------------------- 1 | (comment "comment is a macro that emits no code. It can contain clojure code in itself.") 2 | (comment-and-something "This is a valid function name") -------------------------------------------------------------------------------- /test/markup/crystal/defs.txt: -------------------------------------------------------------------------------- 1 | def foo 2 | end 3 | 4 | def *(other) 5 | end 6 | 7 | def **(other) 8 | end 9 | 10 | def =~(other) 11 | end 12 | 13 | def !~(other) 14 | end 15 | -------------------------------------------------------------------------------- /test/markup/kotlin/string.txt: -------------------------------------------------------------------------------- 1 | "astring" 2 | expression 3 | "a ${ "string" } ${'c'} b" 4 | "a ${ "string $var ${subs}" } b" 5 | """ ${ 6 | ${subst} 7 | } """ 8 | """f="true"""" 9 | -------------------------------------------------------------------------------- /test/markup/powershell/flags.txt: -------------------------------------------------------------------------------- 1 | "Good Dog" --match-lower-case "Dog" 2 | 2 --equality-check 2 3 | "abc" --format-drive-fully "def" 4 | format /dev/devices/driveA --format-drive-fully -yes -------------------------------------------------------------------------------- /test/markup/sql/string-types.txt: -------------------------------------------------------------------------------- 1 | SELECT '\'; 2 | 3 | -- this is not a string in SQL, it's an identifier 4 | SELECT "name" from users; 5 | 6 | -- not in the SQL spec 7 | SELECT `\`; 8 | -------------------------------------------------------------------------------- /test/detect/handlebars/default.txt: -------------------------------------------------------------------------------- 1 |
2 | {{!-- only show if author exists --}} 3 | {{#if author}} 4 |

{{firstName}} {{lastName}}

5 | {{/if}} 6 |
7 | -------------------------------------------------------------------------------- /test/markup/java/functions.txt: -------------------------------------------------------------------------------- 1 | public static Tuple fun(Future> future) throws Exceptions { 2 | } 3 | 4 | static Optional> parseAll(String s) { 5 | } 6 | -------------------------------------------------------------------------------- /test/markup/pony/triple-quote.expect.txt: -------------------------------------------------------------------------------- 1 | """ 2 | A triple quoted string 3 | * Goes several lines 4 | * Keeps formatting 5 | """ -------------------------------------------------------------------------------- /test/markup/x86asm/labels-directives.txt: -------------------------------------------------------------------------------- 1 | .cfi_startproc 2 | _ZN3lib13is_whitespace17h28afa23272bf056bE: 3 | .align 16, 0x90 4 | ja .Lfunc_end0 5 | .Lfunc_end0: 6 | ret 7 | -------------------------------------------------------------------------------- /test/markup/bash/escaped-apos.expect.txt: -------------------------------------------------------------------------------- 1 | # Escaped apostrophe is not a string 2 | echo \'not-a-highlighted-string\' 3 | -------------------------------------------------------------------------------- /test/markup/csharp/records.txt: -------------------------------------------------------------------------------- 1 | public record MyRecord 2 | { 3 | public string SomeMember { get; init; } 4 | } 5 | 6 | public record Person(string FirstName, string? MiddleName, string LastName); -------------------------------------------------------------------------------- /test/markup/erlang/maybe.txt: -------------------------------------------------------------------------------- 1 | maybe 2 | {ok, A} ?= a(), 3 | true = A >= 0, 4 | {ok, B} ?= b(), 5 | A + B 6 | else 7 | error -> error; 8 | wrong -> error 9 | end 10 | -------------------------------------------------------------------------------- /test/markup/handlebars/combinations-with-text.txt: -------------------------------------------------------------------------------- 1 | some text 2 | 3 | {{#custom (nested (helper 'a{{bc' 1)) key=value as | blockParam |}} some {{blockParam}} text {{/custom}} 4 | 5 | some text 6 | -------------------------------------------------------------------------------- /test/markup/http/default.txt: -------------------------------------------------------------------------------- 1 | POST /task?id=1 HTTP/1.1 2 | Host: example.org 3 | Content-Type: application/json; charset=utf-8 4 | Content-Length: 19 5 | 6 | {"status": "ok", "extended": true} 7 | -------------------------------------------------------------------------------- /test/markup/javascript/conventions.txt: -------------------------------------------------------------------------------- 1 | const KEY_KPASTERISK = 55; 2 | const KEY_KP7 = 71; 3 | const KEY_KP8 = 72; 4 | 5 | if (key == KEY_KP8) { 6 | // do stuff 7 | } 8 | -------------------------------------------------------------------------------- /test/markup/nestedtext/lists_of.txt: -------------------------------------------------------------------------------- 1 | list_of_dictionaries: 2 | - 3 | hello: world 4 | key: value 5 | 6 | list_of_lists: 7 | - 8 | - green 9 | - blue 10 | - red 11 | -------------------------------------------------------------------------------- /test/markup/pony/method.txt: -------------------------------------------------------------------------------- 1 | fun foo(bar: String): String => 2 | bar + "baz" 3 | 4 | new create(hunger: I32) => 5 | _hunger = hunger 6 | 7 | be feed(food: I32) => 8 | _hunger = _hunger - food -------------------------------------------------------------------------------- /test/markup/sql/functions.txt: -------------------------------------------------------------------------------- 1 | select CURRENT_CATALOG, 2 | CURRENT_USER, 3 | CURRENT_TIME, 4 | CURRENT_TIME(), 5 | CURRENT_TIMESTAMP, 6 | CURRENT_TIMESTAMP() 7 | FROM sys; 8 | -------------------------------------------------------------------------------- /test/fixtures/expect/languagealias.txt: -------------------------------------------------------------------------------- 1 | var x = '<p>this should <b>not</b> be highlighted as <em>HTML</em>'; -------------------------------------------------------------------------------- /test/markup/bash/not-comments.expect.txt: -------------------------------------------------------------------------------- 1 | echo asdf#qwert yuiop 2 | 3 | echo asdf #qwert yuiop 4 | -------------------------------------------------------------------------------- /test/markup/clojure/symbols-numbers.txt: -------------------------------------------------------------------------------- 1 | (def +x [(a 1) +2 -3.0 y-5]) 2 | (System/getProperty "java.vm.version") 3 | (.getEnclosingClass java.util.Map$Entry) 4 | (java.util.Map$Entry. .getEnclosingClass) -------------------------------------------------------------------------------- /test/markup/crystal/macro.txt: -------------------------------------------------------------------------------- 1 | puts {{ "hello world" }} 2 | 3 | {% verbatim %}{{ "bla".id }}{% end %} 4 | 5 | macro foo 6 | {% verbatim %} 7 | {{ "bla".id }} 8 | {% end %} 9 | end 10 | -------------------------------------------------------------------------------- /test/markup/css/pseudo.txt: -------------------------------------------------------------------------------- 1 | .test:before, 2 | .test:after { 3 | color: pink; 4 | color: red; 5 | } 6 | 7 | .test::before, 8 | .test::after { 9 | color: pink; 10 | color: red; 11 | } 12 | -------------------------------------------------------------------------------- /test/markup/go/functions.txt: -------------------------------------------------------------------------------- 1 | func name() 2 | 3 | func name(int32, *somePointer)(string) 4 | 5 | map[string]func(int32, string) 6 | 7 | func name (x int32) int32 { 8 | return x; 9 | } 10 | -------------------------------------------------------------------------------- /test/markup/rust/comments.expect.txt: -------------------------------------------------------------------------------- 1 | /* rust has 2 | /* nested /* block */ */ 3 | */ comments 4 | -------------------------------------------------------------------------------- /test/markup/scala/given.expect.txt: -------------------------------------------------------------------------------- 1 | given T = ??? 2 | given x: T = ??? 3 | -------------------------------------------------------------------------------- /test/markup/crystal/regexes.txt: -------------------------------------------------------------------------------- 1 | if /foo/ 2 | unless /foo/ 3 | case /foo/ 4 | select /foo/ 5 | when /foo/ 6 | while /foo/ 7 | until /foo/ 8 | +/foo/ 9 | 10 | # NG 11 | xif /foo/ 12 | ifx /foo/ 13 | -------------------------------------------------------------------------------- /test/markup/javascript/keyword_as_identifier.txt: -------------------------------------------------------------------------------- 1 | const set = new Set([1, 2]); 2 | for (const e of set) 3 | 4 | class A { 5 | set value(x) { 6 | } 7 | get valid() { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/markup/pony/creator.expect.txt: -------------------------------------------------------------------------------- 1 | new create(env: Env, name: String) => 2 | _env = env 3 | _name = name -------------------------------------------------------------------------------- /test/markup/tap/basic.txt: -------------------------------------------------------------------------------- 1 | 1..4 2 | ok 1 - Input file opened 3 | not ok 2 - First line of the input valid 4 | ok 3 - Read the rest of the file 5 | not ok 4 - Summarized correctly # TODO Not written yet 6 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build 3 | docs/_build 4 | __pycache__ 5 | *.swp 6 | node_modules 7 | .project 8 | 9 | # editors 10 | .idea/ 11 | .vscode/ 12 | .Rproj.user 13 | 14 | # misc 15 | /work 16 | -------------------------------------------------------------------------------- /test/markup/aspectj/intertype-method.txt: -------------------------------------------------------------------------------- 1 | public void MyClass.doSomething() throws Exception{ 2 | // intertype method body 3 | } 4 | public void A.doSomething(int param1){ 5 | // intertype method body 6 | } 7 | -------------------------------------------------------------------------------- /test/markup/cos/embedded.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Multiline comment 3 | */ 4 | &sql(SELECT * FROM Cinema.Film WHERE Length > 2) 5 | &js 6 | -------------------------------------------------------------------------------- /test/markup/cpp/function-like-keywords.txt: -------------------------------------------------------------------------------- 1 | 2 | if (ch) {} 3 | 4 | switch (ch) {} 5 | 6 | while (ch) {} 7 | 8 | for (;;) {} 9 | 10 | void f() = delete("reason"); 11 | 12 | static_assert(true); 13 | -------------------------------------------------------------------------------- /test/markup/handlebars/partial-call.expect.txt: -------------------------------------------------------------------------------- 1 | {{> partial}} 2 | -------------------------------------------------------------------------------- /test/markup/llvm/string.txt: -------------------------------------------------------------------------------- 1 | ; Backslashes do not escape quotes, this is a legal string 2 | define void @"C:\"() { 3 | ret void 4 | } 5 | 6 | define void @"escape_code_\0123\04end"() { 7 | ret void 8 | } 9 | -------------------------------------------------------------------------------- /test/markup/pony/prime.expect.txt: -------------------------------------------------------------------------------- 1 | new create(name': String) => 2 | name = name' + 'a' 3 | -------------------------------------------------------------------------------- /test/markup/scheme/lambda.txt: -------------------------------------------------------------------------------- 1 | (lambda (x y z) (+ y z)) 2 | 3 | (define add-point 4 | (lambda [p1 p2] 5 | (make-point 6 | (+ (point-x p1) (point-x p2)) 7 | (+ (point-y p1) (point-y p2))))) 8 | -------------------------------------------------------------------------------- /test/markup/xml/non-ascii-attribute-names.txt: -------------------------------------------------------------------------------- 1 | 2 | sofá 3 | 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # The build script and some tests use `\n` as markers, so we need to make sure 2 | # that all javascript files are checked out using UNIX line endings (not `\r\n`) 3 | *.js eol=lf 4 | *.txt eol=lf -------------------------------------------------------------------------------- /test/markup/bash/variables.expect.txt: -------------------------------------------------------------------------------- 1 | $A 2 | ${B} 3 | ${WURST:-${CARNE}} 4 | -------------------------------------------------------------------------------- /test/markup/pony/objects.txt: -------------------------------------------------------------------------------- 1 | primitive I32 is SignedInteger 2 | 3 | actor Main 4 | 5 | class ref List[A: A] is Seq[A] ref 6 | 7 | object is Hashable 8 | 9 | object iso 10 | 11 | primitive Foo is Bar iso -------------------------------------------------------------------------------- /test/markup/python/function-header-comments.txt: -------------------------------------------------------------------------------- 1 | def foo( 2 | bar, # commment 3 | ): 4 | pass 5 | 6 | 7 | class Foo(collections.namedtuple('Test'), ( 8 | 'name', # comment 9 | )): 10 | pass 11 | -------------------------------------------------------------------------------- /test/markup/python/matrix-multiplication.txt: -------------------------------------------------------------------------------- 1 | @meta 2 | class C: 3 | 4 | @decorator 5 | def f(self, H, V, beta, r): 6 | S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r) 7 | return S 8 | -------------------------------------------------------------------------------- /test/markup/scala/using-directives.txt: -------------------------------------------------------------------------------- 1 | //> using scala 3.3.0 2 | //> using options -source:future -Xfatal-warnings 3 | //> using test.resourceDir ./resources 4 | // using foo bar <-- this should not be highlighted 5 | -------------------------------------------------------------------------------- /test/markup/clojure-repl/prompt.expect.txt: -------------------------------------------------------------------------------- 1 | user=> 2 | => 3 | -------------------------------------------------------------------------------- /test/markup/cpp/function-params.txt: -------------------------------------------------------------------------------- 1 | int f( 2 | int a = 1, 3 | char* b = "2", // Line comment 4 | double c = 3.0, /* Block comment */ 5 | ARRAY(int, 5) d, 6 | void* e __attribute__((unused)) 7 | ); 8 | -------------------------------------------------------------------------------- /test/markup/csharp/identifiers.expect.txt: -------------------------------------------------------------------------------- 1 | var @class = new MyClass(); 2 | doSomething(@var, @foo); 3 | var a; 4 | 5 | -------------------------------------------------------------------------------- /test/markup/erlang/doc_attribute.txt: -------------------------------------------------------------------------------- 1 | -module(arith). 2 | -moduledoc """ 3 | A module for basic arithmetic. 4 | """. 5 | 6 | -export([add/2]). 7 | 8 | -doc "Adds two numbers.". 9 | add(One, Two) -> One + Two. 10 | -------------------------------------------------------------------------------- /test/markup/ini/variable.expect.txt: -------------------------------------------------------------------------------- 1 | memory_limit = ${PHP_MEMORY_LIMIT} 2 | key = $VAR1 3 | -------------------------------------------------------------------------------- /test/markup/shell/plain-prompt.expect.txt: -------------------------------------------------------------------------------- 1 | > foo 2 | > /bin/sh 3 | -------------------------------------------------------------------------------- /test/markup/typescript/numbers-and-dashes.txt: -------------------------------------------------------------------------------- 1 | let num = -3; 2 | 3 | let diff = 5 - 3; 4 | let diff = 5-3; 5 | 6 | // Who writes JS like that?? 7 | let num = - 3; 8 | let diff = 5 -3; 9 | let diff = 5- 3; 10 | -------------------------------------------------------------------------------- /test/markup/xml/namespace.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/fixtures/expect/explicit2.txt: -------------------------------------------------------------------------------- 1 | @import "compass/reset"; 2 | $colorGreenDark: #393; 3 | -------------------------------------------------------------------------------- /test/markup/groovy/oneoffs.txt: -------------------------------------------------------------------------------- 1 | // ternary can include quotes 2 | def formattingMsg = label < 0 ? ('The following files need formatting:\n ' + 3 | codeStyleFiles.join('\n ')) : 'All files are correctly formatted' 4 | -------------------------------------------------------------------------------- /test/markup/handlebars/if-else.txt: -------------------------------------------------------------------------------- 1 | {{#if this.userData.isLoaded}} 2 | {{this.userData.value.userName}} 3 | {{else if this.userData.isError}} 4 | Whoops, something went wrong! 5 | {{else}} 6 | Something else! 7 | {{/if}} -------------------------------------------------------------------------------- /test/markup/subunit/subunit-skipline.expect.txt: -------------------------------------------------------------------------------- 1 | skip test simplename 2 | skip: test simple name 3 | skip test simple name 4 | -------------------------------------------------------------------------------- /test/markup/swift/identifiers.expect.txt: -------------------------------------------------------------------------------- 1 | `func` 2 | { $0 + 1 } 3 | value.$wrappedValue 4 | -------------------------------------------------------------------------------- /src/lib/html_injection_error.js: -------------------------------------------------------------------------------- 1 | export default class HTMLInjectionError extends Error { 2 | constructor(reason, html) { 3 | super(reason); 4 | this.name = "HTMLInjectionError"; 5 | this.html = html; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/markup/dart/comment-markdown.txt: -------------------------------------------------------------------------------- 1 | /// Comment. 2 | 3 | /// Comment 2. 4 | /// ```dart 5 | /// code; 6 | /// ``` 7 | /// text. 8 | /// * bullet 9 | /// * sub-bullet 10 | 11 | /// 12 | code; 13 | 14 | /**/code; 15 | -------------------------------------------------------------------------------- /test/markup/handlebars/block-expression-variants-in-param.txt: -------------------------------------------------------------------------------- 1 | text {{#abc "lite]'ral}}segment" }}a{{/abc}} 2 | 3 | text {{#abc 'lite]"ral}}segment' }}a{{/abc}} 4 | 5 | text {{#abc [lite"'ral}}segment] }}a{{/abc}} 6 | 7 | text 8 | -------------------------------------------------------------------------------- /test/markup/handlebars/built-ins.txt: -------------------------------------------------------------------------------- 1 | {{#if test}}yes{{/if}} 2 | 3 | {{#unless test}}no{{/unless}} 4 | 5 | {{#with test}}abc{{/with}} 6 | 7 | {{#each test}}abc{{/each}} 8 | 9 | {{lookup abc}} 10 | 11 | {{log test}} 12 | -------------------------------------------------------------------------------- /test/markup/ini/array.txt: -------------------------------------------------------------------------------- 1 | 2 | moo=["foo"] 3 | 4 | KNOWN_PEERS = [ 5 | "finland.some-host.com:11625", 6 | "germany.some-host.com:11625", 7 | "hongkong.some-host.com:11625", 8 | 32, 9 | true 10 | ] 11 | -------------------------------------------------------------------------------- /test/markup/markdown/sections.txt: -------------------------------------------------------------------------------- 1 | # hello world 2 | 3 | ## hello world 4 | 5 | hello world 6 | =========== 7 | 8 | *hello world* or [google](link) 9 | =========== 10 | 11 | # *hello world* or [google](link) 12 | 13 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-xfailline.expect.txt: -------------------------------------------------------------------------------- 1 | xfail test simplename 2 | xfail: test simple name 3 | xfail test simple name 4 | -------------------------------------------------------------------------------- /test/fixtures/expect/explicit1.txt: -------------------------------------------------------------------------------- 1 | for x in [1, 2, 3]: 2 | count(x) -------------------------------------------------------------------------------- /test/markup/fsharp/bang-keywords.expect.txt: -------------------------------------------------------------------------------- 1 | let! (result2 : byte[]) = stream.AsyncRead(bufferSize) 2 | -------------------------------------------------------------------------------- /test/markup/gauss/function_refs.txt: -------------------------------------------------------------------------------- 1 | k = colsf(fin); 2 | nr = floor(minc(maxbytes/(k*8*3.5)|maxvec/(k+1))); 3 | call random_user_function_2(-10.0, "hey", /* blah */ x[0x2F]); 4 | ols("", csvReadM("test.csv")); 5 | if myfn(10) == 20; 6 | -------------------------------------------------------------------------------- /test/markup/javascript/jsx-fragment.txt: -------------------------------------------------------------------------------- 1 | class Columns extends React.Component { 2 | render() { 3 | return ( 4 | <> 5 | Hello 6 | World 7 | 8 | ); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/markup/latex/chars.txt: -------------------------------------------------------------------------------- 1 | {}$&^_~"[]()<> 2 | 3 | +-0123456789 pt 4 | 5 | ^^3abc 6 | ^^3ABC 7 | ^^xyz 8 | ^^#3 9 | ^^°! 10 | ^^{ 11 | ^^} 12 | ^^$ 13 | ^^& 14 | ^^%asdf 15 | ^^^ 16 | ^^_ 17 | ^^^^3bf2a3 18 | ^^^^g12345 19 | -------------------------------------------------------------------------------- /test/markup/llvm/numbers.txt: -------------------------------------------------------------------------------- 1 | define i32 @signed_int() { 2 | ret i32 s0x12a 3 | } 4 | 5 | define float @signed_float() { 6 | ret float +1.0 7 | } 8 | 9 | define float @float_format() { 10 | ret float 0xK12a 11 | } 12 | -------------------------------------------------------------------------------- /test/markup/pony/match.txt: -------------------------------------------------------------------------------- 1 | match foo 2 | | true => "it's true" 3 | | "bar" => "it's bar" 4 | | let x: I32 if x > 3 => "it's greater than 3" 5 | | let x: I32 => "it's less than or equal to 3" 6 | else 7 | "I don't know what it is" 8 | end -------------------------------------------------------------------------------- /test/markup/rust/invoked-keywords.txt: -------------------------------------------------------------------------------- 1 | if (true) {} 2 | if true {} 3 | else if (true) {} 4 | while (true) {} 5 | while true {} 6 | for (a, b) in (0..10).enumerate() {} 7 | for a in 0..10 {} 8 | match str {} 9 | match (str) {} 10 | -------------------------------------------------------------------------------- /demo/readme.md: -------------------------------------------------------------------------------- 1 | To view this demo in browser, please follow the [build instructions](http://highlightjs.readthedocs.io/en/latest/building-testing.html#building) with browser as the target, and then open the generated build/demo/index.html. 2 | -------------------------------------------------------------------------------- /test/detect/javascript/short-plain.txt: -------------------------------------------------------------------------------- 1 | const cluster = require('cluster'); 2 | const numCPUs = require('os').cpus().length; 3 | 4 | if (cluster.isMaster) { 5 | for (var i = 0; i < numCPUs; i++) { 6 | cluster.fork(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/markup/fortran/dot_keywords.txt: -------------------------------------------------------------------------------- 1 | logical :: A=.true., B=.false., C=.true., D=.false. 2 | logical :: E 3 | 4 | E = 3 < 4 .and. B 5 | E = 'ij' <= 'ijk' .and. C 6 | E = B .or. A .and. D 7 | E = (B .or. A) .and. C 8 | E = A .and. .not.B 9 | -------------------------------------------------------------------------------- /test/markup/pony/iterface-trait.txt: -------------------------------------------------------------------------------- 1 | interface Iterator[A: A] 2 | fun has_next(): Bool 3 | fun next(): T? 4 | 5 | trait UnitTest 6 | fun name(): String 7 | fun ref set_up(h: TestHelper) ? => 8 | None 9 | fun apply(h: TestHelper) ? -------------------------------------------------------------------------------- /test/markup/rust/numbers.txt: -------------------------------------------------------------------------------- 1 | 123; 2 | 123usize; 3 | 123_usize; 4 | 0xff00; 5 | 0xff_u8; 6 | 0b1111111110010000; 7 | 0b1111_1111_1001_0000_i32; 8 | 0o764317; 9 | 0o764317_u16; 10 | 123.0; 11 | 0.1; 12 | 0.1f32; 13 | 12E+99_f64; 14 | -------------------------------------------------------------------------------- /test/markup/scala/strings.expect.txt: -------------------------------------------------------------------------------- 1 | val s = """ this is a string "this is still a string" another quote: " after the quote """ 2 | -------------------------------------------------------------------------------- /test/markup/fortran/comments.txt: -------------------------------------------------------------------------------- 1 | !=============================== 2 | ! This is a test subroutine 3 | !=============================== 4 | 5 | ! another comment 6 | 7 | C=2 8 | C = 2 !correct 9 | C ='boo' 10 | 11 | contains 12 | -------------------------------------------------------------------------------- /test/markup/kotlin/class.txt: -------------------------------------------------------------------------------- 1 | class A { 2 | } 3 | 4 | class B() 5 | 6 | class C() {} 7 | 8 | public class D 9 | 10 | class E1 11 | class E2 12 | class E3 13 | 14 | class F1 : A 15 | class F2 : A, B 16 | class F3 : A -------------------------------------------------------------------------------- /test/markup/shell/single.expect.txt: -------------------------------------------------------------------------------- 1 | $ echo "$HOME" -n 2 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-uxsuccessline.expect.txt: -------------------------------------------------------------------------------- 1 | uxsuccess test simplename 2 | uxsuccess: test simple name 3 | uxsuccess test simple name 4 | -------------------------------------------------------------------------------- /test/markup/twig/filter_with_underscore.expect.txt: -------------------------------------------------------------------------------- 1 | {{ "string with spaces"|url_encode }} -------------------------------------------------------------------------------- /test/markup/xml/unquoted-attributes.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/detect/accesslog/default.txt: -------------------------------------------------------------------------------- 1 | 20.164.151.111 - - [20/Aug/2015:22:20:18 -0400] "GET /mywebpage/index.php HTTP/1.1" 403 772 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1" 2 | -------------------------------------------------------------------------------- /test/fixtures/expect/endsWithParentVariants.txt: -------------------------------------------------------------------------------- 1 | ( [ ( ) ] ) 2 | -------------------------------------------------------------------------------- /test/markup/dos/comments.expect.txt: -------------------------------------------------------------------------------- 1 | rem comment 2 | rem comment 3 | copy a.txt b.txt > rem not_a_comment 4 | -------------------------------------------------------------------------------- /test/markup/latex/comments.txt: -------------------------------------------------------------------------------- 1 | % foo ^^bar \baz 2 | foo% 3 | % !TeX program = pdflatex 4 | %% !TeX encoding = utf8 5 | %!TEX spellcheck = en-US 6 | % !TeX foo 7 | % !tex foo 8 | % !tEx foo 9 | % !BIB foo 10 | %!bib foo 11 | % !Bib foo 12 | -------------------------------------------------------------------------------- /test/markup/latex/parameters.expect.txt: -------------------------------------------------------------------------------- 1 | #7 2 | #789 3 | ##1 4 | #######2 5 | #{foo} 6 | -------------------------------------------------------------------------------- /test/markup/reasonml/comments.txt: -------------------------------------------------------------------------------- 1 | let t = 2; // Line comment 2 | 3 | /* Regular comment */ 4 | let t = 2; 5 | 6 | type t = 7 | | A(string) 8 | | B(int); 9 | /* A("foo") -> { TAG: 0, _0: "Foo" } */ 10 | /* B(2) -> { TAG: 1, _0: 2 } */ 11 | -------------------------------------------------------------------------------- /test/markup/scala/using.txt: -------------------------------------------------------------------------------- 1 | def f(using x: Int) = 1 2 | def g(using Int) = 1 3 | given (using ev: Ev): Foo = ??? 4 | 5 | def expressions = 6 | f(using 2) 7 | 8 | // not `using` keyword 9 | (using) 10 | (using ) 11 | ( using ) 12 | -------------------------------------------------------------------------------- /test/detect/ini/default.txt: -------------------------------------------------------------------------------- 1 | ; boilerplate 2 | [package] 3 | name = "some_name" 4 | authors = ["Author"] 5 | description = "This is \ 6 | a description" 7 | 8 | [[lib]] 9 | name = ${NAME} 10 | default = True 11 | auto = no 12 | counter = 1_000 13 | -------------------------------------------------------------------------------- /test/markup/gauss/keywords.txt: -------------------------------------------------------------------------------- 1 | for i(start, stop, bar(5)); 2 | if (i-1 % 5 == 0 .and some_flag); 3 | elseif i % 2 .eqv 0; 4 | external string _olsrnam; 5 | external proc indices2,indexcat; 6 | myPlot.axes.and.for.if.endif.text = "hey"; 7 | local f:proc; 8 | -------------------------------------------------------------------------------- /test/markup/ini/tables.expect.txt: -------------------------------------------------------------------------------- 1 | [table] 2 | [[array]] 3 | [dotted.table.name] 4 | [target.'cfg(unix)'] 5 | -------------------------------------------------------------------------------- /test/markup/javascript/block-comments.expect.txt: -------------------------------------------------------------------------------- 1 | /* Block-Comment */ 2 | 3 | /* Can 4 | Be 5 | Multi- 6 | Line 7 | */ 8 | 9 | /**/ 10 | -------------------------------------------------------------------------------- /test/markup/javascript/template-strings.expect.txt: -------------------------------------------------------------------------------- 1 | `string ${foo + `str${undefined}ing`}`; 2 | -------------------------------------------------------------------------------- /test/markup/objectivec/string-literals.txt: -------------------------------------------------------------------------------- 1 | const char *str = "Regular \"quoted\" string\n"; 2 | NSString *nsstr = @"Obj-C \"quoted\" string\n"; 3 | char c = 'c'; 4 | char c2 = '"'; 5 | char c3 = '\''; 6 | char c4 = '\n'; 7 | int multibyte_char = 'abcd'; 8 | -------------------------------------------------------------------------------- /test/detect/shell/default.txt: -------------------------------------------------------------------------------- 1 | $ echo $EDITOR 2 | vim 3 | $ git checkout main 4 | Switched to branch 'main' 5 | Your branch is up-to-date with 'origin/main'. 6 | $ git push 7 | Everything up-to-date 8 | $ echo 'All 9 | > done!' 10 | All 11 | done! 12 | -------------------------------------------------------------------------------- /test/markup/csharp/dotted-namespace.expect.txt: -------------------------------------------------------------------------------- 1 | namespace Dotted.Namespace 2 | { 3 | class MyClass 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/markup/excel/comments.expect.txt: -------------------------------------------------------------------------------- 1 | =(N4 + N5)*0.055 + N("This is a comment.") 2 | -------------------------------------------------------------------------------- /test/markup/handlebars/block-expression-variants-as-path-segment.txt: -------------------------------------------------------------------------------- 1 | text {{#abc abcd.[lite"'ral}}segment] }}a{{/abc}} 2 | 3 | text {{#abc abcd."lite]'ral}}segment" }}a{{/abc}} 4 | 5 | text {{#abc abcd.'lite]"ral}}segment' }}a{{/abc}} 6 | 7 | text 8 | 9 | -------------------------------------------------------------------------------- /test/markup/javascript/default-parameters.expect.txt: -------------------------------------------------------------------------------- 1 | function visibleTodoFilter(state = 'watch', action) {} 2 | -------------------------------------------------------------------------------- /test/markup/swift/precedencegroup.txt: -------------------------------------------------------------------------------- 1 | precedencegroup MyGroup { 2 | higherThan: OtherGroup, AnotherGroup 3 | lowerThan: OtherGroup, AnotherGroup 4 | assignment: true 5 | associativity: left 6 | associativity: right 7 | associativity: none 8 | } 9 | -------------------------------------------------------------------------------- /test/markup/clojure/character.expect.txt: -------------------------------------------------------------------------------- 1 | \A 2 | \a 3 | \formfeed 4 | \u00DF 5 | \o303 -------------------------------------------------------------------------------- /test/markup/cpp/bugs.txt: -------------------------------------------------------------------------------- 1 | //4. 对角矩阵 2 | //4.1 构造对角矩阵 3 | Eigen::VectorXd vector(5); //构建5维向量 4 | vector<<1,2,3,4,5; //向量赋值 5 | Eigen::MatrixXd C(vector.asDiagonal()); //使用向量生成对角阵 6 | std::cout << "\nC= \n" << C << std::endl; 7 | -------------------------------------------------------------------------------- /test/detect/lsl/default.txt: -------------------------------------------------------------------------------- 1 | default 2 | { 3 | state_entry() 4 | { 5 | llSay(PUBLIC_CHANNEL, "Hello, Avatar!"); 6 | } 7 | 8 | touch_start(integer num_detected) 9 | { 10 | llSay(PUBLIC_CHANNEL, "Touched."); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/detect/ruby/default.txt: -------------------------------------------------------------------------------- 1 | # The Greeter class 2 | class Greeter 3 | def initialize(name) 4 | @name = name.capitalize 5 | end 6 | 7 | def salute 8 | puts "Hello #{@name}!" 9 | end 10 | end 11 | 12 | g = Greeter.new("world") 13 | g.salute 14 | -------------------------------------------------------------------------------- /test/markup/cpp/bitwise-keywords.txt: -------------------------------------------------------------------------------- 1 | unsigned char a = 0xFA; 2 | unsigned char b = 0x4C; 3 | 4 | a = compl b; 5 | a = not b; 6 | a and b; 7 | a bitor b; 8 | a or b; 9 | a xor b; 10 | a bitand b; 11 | a and_eq b; 12 | a or_eq b; 13 | a xor_eq b; 14 | a not_eq b; -------------------------------------------------------------------------------- /test/markup/csharp/string-interpolation.txt: -------------------------------------------------------------------------------- 1 | var istr = $"{{Hello}},\n{$"\"{nested}\"" + @" and " + $@"""{nested}""" /*comments*/ }"; 2 | var ivstr = $@"{{Hello}}, 3 | { 4 | $"\"{nested}\"" + @" 5 | and 6 | " + $@" 7 | ""{nested}"" 8 | " 9 | /*comments*/ }"; 10 | -------------------------------------------------------------------------------- /test/markup/gauss/function_defs.txt: -------------------------------------------------------------------------------- 1 | proc (1) = foo(if, endif, 10); 2 | proc foo; 3 | proc (1) = calc(local__row, fin, ...); 4 | fn /* inline */ twopi=pi*2; 5 | fn _n_pi(n /* inline comment */) = pi*n; 6 | keyword add(str, struct plotControl myPlot); 7 | keyword sub; 8 | -------------------------------------------------------------------------------- /test/markup/handlebars/literals.txt: -------------------------------------------------------------------------------- 1 | {{helper true false}} 2 | 3 | {{helper 1234}} 4 | 5 | {{helper null}} 6 | 7 | {{helper undefined}} 8 | 9 | {{helper 'string'}} 10 | 11 | {{helper "string"}} 12 | 13 | {{helper [not a string literal but a variable]}} 14 | -------------------------------------------------------------------------------- /test/markup/lsl/default.txt: -------------------------------------------------------------------------------- 1 | default 2 | { 3 | state_entry() 4 | { 5 | llSay(PUBLIC_CHANNEL, "Hello, Avatar!"); 6 | } 7 | 8 | touch_start(integer num_detected) 9 | { 10 | llSay(PUBLIC_CHANNEL, "Touched."); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/markup/yaml/string.txt: -------------------------------------------------------------------------------- 1 | key: value 2 | key: 'some value' 3 | key: "some value" 4 | key: | 5 | multi-string 6 | value 7 | key: true 8 | 9 | key: '\' 10 | key: "\\" 11 | key: "\" 12 | key: value" 13 | key: value 14 | key: '''' 15 | key: 'some''value' 16 | -------------------------------------------------------------------------------- /test/markup/cpp/comments.txt: -------------------------------------------------------------------------------- 1 | // line comment 2 | 3 | /* block comment */ 4 | 5 | /* block comment 6 | across lines 7 | */ 8 | 9 | #include // line comment 10 | #include /* block comment */ 11 | 12 | /* 13 | Truncated block comment 14 | -------------------------------------------------------------------------------- /test/markup/handlebars/hashes.txt: -------------------------------------------------------------------------------- 1 | {{helper key=value}} 2 | 3 | {{{helper key=value}}} 4 | 5 | {{>partial key=value}} 6 | 7 | {{#helper key=value}} {{/helper}} 8 | 9 | {{{{#helper key=value}}}} {{{{/helper}}}} 10 | 11 | {{helper (subExpression key=value)}} 12 | -------------------------------------------------------------------------------- /test/markup/handlebars/path-expressions.txt: -------------------------------------------------------------------------------- 1 | {{path.expression}} 2 | 3 | {{{path.expression}}} 4 | 5 | {{#path.expression}} {{/path.expression}} 6 | 7 | {{{{#path.expression}}}} {{{{/path.expression}}}} 8 | 9 | {{with.in.a.path.expression}} is not a built-in 10 | -------------------------------------------------------------------------------- /test/markup/java/gh1031.txt: -------------------------------------------------------------------------------- 1 | public class DefaultDataDaoImpl { 2 | private List cmrDataProcessors; 3 | } 4 | 5 | public class DefaultDataDaoImpl { 6 | private List cmrDataProcessors; 7 | } 8 | -------------------------------------------------------------------------------- /test/markup/ruby/gemfile.expect.txt: -------------------------------------------------------------------------------- 1 | gem "gem_name1", ">= 4.1" 2 | 3 | gem "gem_name2", "~> 4.1" 4 | -------------------------------------------------------------------------------- /test/markup/shell/prompt-with-tilde.expect.txt: -------------------------------------------------------------------------------- 1 | ~/docs> cat readme.adoc 2 | = Highlight.js 3 | 4 | Highlight.js is a syntax highlighter written in JavaScript. 5 | -------------------------------------------------------------------------------- /test/markup/typescript/declares.txt: -------------------------------------------------------------------------------- 1 | export declare class CommandHandler extends EventEmitter { 2 | 3 | constructor(config: CommandHandlerConfig); 4 | /** 5 | * Install the handler onto Discord.js 6 | * @param client - Client to handle 7 | */ 8 | } 9 | -------------------------------------------------------------------------------- /test/detect/properties/default.txt: -------------------------------------------------------------------------------- 1 | # .properties 2 | ! Exclamation mark = comments, too 3 | 4 | key1 = value1 5 | key2 : value2 6 | key3 value3 7 | key\ spaces multiline\ 8 | value4 9 | empty_key 10 | ! Key can contain escaped chars 11 | \:\= = value5 12 | -------------------------------------------------------------------------------- /test/markup/cos/basic.txt: -------------------------------------------------------------------------------- 1 | SET test = 1 2 | set ^global = 2 3 | Write "Current date """, $ztimestamp, """, result: ", test + ^global = 3 4 | if (^global = 2) { 5 | do ##class(Cinema.Utils).AddShow("test") // line comment 6 | } 7 | d:(^global = 2) ..thisClassMethod(1, 2, "test") 8 | -------------------------------------------------------------------------------- /test/markup/css/variables.txt: -------------------------------------------------------------------------------- 1 | body { 2 | --text-color: red; 3 | color: var(--text-color); 4 | } 5 | 6 | body { 7 | --textBlue: blue; 8 | color: var(--textBlue); 9 | } 10 | 11 | body { 12 | --_margin-top: 1rem; 13 | margin-top: var(--_margin-top); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /test/markup/lisp/mec.expect.txt: -------------------------------------------------------------------------------- 1 | ; MEC: Multiple Escape Characters. See https://github.com/highlightjs/highlight.js/issues/615 2 | (|spaces and 3 | newlines| x) 4 | (x '|quoted|) 5 | -------------------------------------------------------------------------------- /test/markup/php/php80.txt: -------------------------------------------------------------------------------- 1 | 'Integer 1', 5 | '1' => 'String 1', 6 | true => 'Bool true', 7 | [] => 'Empty array', 8 | [1] => 'Array [1]', 9 | }; 10 | 11 | enum Foo: string { 12 | case Test = 'test'; 13 | } 14 | -------------------------------------------------------------------------------- /test/detect/ceylon/default.txt: -------------------------------------------------------------------------------- 1 | shared void run() { 2 | print("Hello, `` process.arguments.first else "World" ``!"); 3 | } 4 | class Counter(count=0) { 5 | variable Integer count; 6 | shared Integer currentValue => count; 7 | shared void increment() => count++; 8 | } 9 | -------------------------------------------------------------------------------- /test/detect/makefile/default.txt: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | BUILDDIR = _build 4 | EXTRAS ?= $(BUILDDIR)/extras 5 | 6 | .PHONY: main clean 7 | 8 | main: 9 | @echo "Building main facility..." 10 | build_main $(BUILDDIR) 11 | 12 | clean: 13 | rm -rf $(BUILDDIR)/* 14 | -------------------------------------------------------------------------------- /test/markup/handlebars/block.expect.txt: -------------------------------------------------------------------------------- 1 | {{#block}}block content{{/block}} 2 | -------------------------------------------------------------------------------- /test/markup/lasso/delimiters.txt: -------------------------------------------------------------------------------- 1 |
2 | [local(y::decimal = .57721)] 3 | [noprocess] [until] [/noprocess] 4 | [no_square_brackets] skip subsequent [square brackets] 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /test/markup/makefile/default.txt: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | BUILDDIR = _build 4 | EXTRAS ?= $(BUILDDIR)/extras 5 | 6 | .PHONY: main clean 7 | 8 | main: 9 | @echo "Building main facility..." 10 | build_main $(BUILDDIR) 11 | 12 | clean: 13 | rm -rf $(BUILDDIR)/* 14 | -------------------------------------------------------------------------------- /test/markup/perl/class.txt: -------------------------------------------------------------------------------- 1 | use v5.38; 2 | 3 | class Example::Subclass :isa(Example::Base 2.345) { 4 | field $_config :param :param :param; 5 | field $_name : param = 'Test'; 6 | 7 | method test() { 8 | $_name == 'Test' ? 'y' : 'n'; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/markup/sql/keywords.expect.txt: -------------------------------------------------------------------------------- 1 | select * from t where t.select is null; 2 | -------------------------------------------------------------------------------- /test/markup/swift/parameterpack.txt: -------------------------------------------------------------------------------- 1 | func expand(value: (repeat each T), other: each U, another: repeat each T) -> (repeat (each T)?) { 2 | return (repeat each value, each value) 3 | } 4 | 5 | let x: (repeat each T) -> Bool = { } 6 | 7 | (each U, repeat each T) -------------------------------------------------------------------------------- /test/markup/bash/escaped-quote.expect.txt: -------------------------------------------------------------------------------- 1 | # Escaped double-quote is not a string 2 | echo '"quoted"' | tr -d \" > text.txt 3 | -------------------------------------------------------------------------------- /test/markup/bash/no-numbers.expect.txt: -------------------------------------------------------------------------------- 1 | # numbers aren't highlighted in bash as their semantics is 2 | # not strictly defined for command line parameters 3 | $ tail -10 access.log 4 | -------------------------------------------------------------------------------- /test/markup/cpp/function-title.txt: -------------------------------------------------------------------------------- 1 | int main(int argc, char** argv) { 2 | auto a = std::make_unique(); 3 | B *b = new B(); 4 | int c = c * sum(1, 2); 5 | if (a->check1()) 6 | return 3; 7 | else if (a->check2()) 8 | return 4; 9 | return a->result(); 10 | } 11 | -------------------------------------------------------------------------------- /test/markup/fortran/numbers.txt: -------------------------------------------------------------------------------- 1 | 1.d0 2 | -1.d0 3 | 1.d-5 4 | -1.D5 5 | 342.e+12 6 | 12. 7 | 12 8 | .23 9 | -.23 10 | 1.E4 11 | 1E4 12 | 1D-4 13 | var1 14 | va1r 15 | mo_tot_8 = 1./(0.4*log(float(elec_num_tot_8+0.4))) 16 | 17 | 6_ikind 18 | 1_c_short 19 | 6.666666666666666_DBL 20 | -------------------------------------------------------------------------------- /test/markup/haskell/infix.expect.txt: -------------------------------------------------------------------------------- 1 | infix 3 `foo` 2 | infixl 6 `bar` 3 | infixr 9 `baz` 4 | -------------------------------------------------------------------------------- /test/markup/java/bugs.expect.txt: -------------------------------------------------------------------------------- 1 | 2 | // `else x =` should not be detected as a variable creation 3 | if ( O == l ) 4 | l = O1; 5 | else 6 | a = 01; 7 | -------------------------------------------------------------------------------- /test/markup/php/numbers.txt: -------------------------------------------------------------------------------- 1 | 1..6 2 | not ok 3 | ok 4 | not ok 5 | ok 6 | ok 7 | -------------------------------------------------------------------------------- /test/markup/twig/template_tags.txt: -------------------------------------------------------------------------------- 1 | {% if posts|length %} 2 | {% for article in articles %} 3 | <div> 4 | {{ article.title|upper() }} 5 | 6 | {# outputs 'WELCOME' #} 7 | </div> 8 | {% endfor %} 9 | {% endif %} 10 | 11 | {% set user = json_encode(user) %} 12 | -------------------------------------------------------------------------------- /test/markup/crystal/operators.txt: -------------------------------------------------------------------------------- 1 | + 2 | - 3 | * 4 | % 5 | & 6 | | 7 | ^ 8 | ** 9 | << 10 | >> 11 | == 12 | != 13 | < 14 | <= 15 | > 16 | >= 17 | <=> 18 | === 19 | // 20 | //= 21 | &+ 22 | &- 23 | &* 24 | &** 25 | &+= 26 | &-= 27 | &*= 28 | ! 29 | ~ 30 | [] 31 | []? 32 | []= 33 | / 34 | -------------------------------------------------------------------------------- /test/markup/elixir/module-references.txt: -------------------------------------------------------------------------------- 1 | hello |> IO.inspect() 2 | 3 | AnAtom 4 | 5 | My.Other.Atom 6 | 7 | My.Other.Atom.foo() 8 | 9 | NonStandard_Atom 10 | 11 | not_matched 12 | 13 | :not_matched.thing() 14 | 15 | :NotMatched? 16 | 17 | %MyStruct{a: 1} 18 | 19 | noModuleMatch -------------------------------------------------------------------------------- /test/markup/protobuf/message-message.txt: -------------------------------------------------------------------------------- 1 | // A Container message 2 | message Container { 3 | message Message { 4 | required int64 id = 1; 5 | } 6 | repeated Message messages = 1; 7 | optional int32 number = 2; 8 | } 9 | 10 | /* 11 | test multiline 12 | comment 13 | */ 14 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-successline.txt: -------------------------------------------------------------------------------- 1 | success test simplename1 2 | success: test simplename2 3 | successful test simplename3 4 | successful: test simplename4 5 | success test simple name1 6 | success: test simple name2 7 | successful test simple name3 8 | successful: test simple name4 9 | -------------------------------------------------------------------------------- /test/detect/go/default.txt: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | ch := make(chan float64) 7 | ch <- 1.0e10 // magic number 8 | x, ok := <- ch 9 | defer fmt.Println(`exitting now\`) 10 | go println(len("hello world!")) 11 | return 12 | } 13 | -------------------------------------------------------------------------------- /test/markup/bash/token-containing-keyword.txt: -------------------------------------------------------------------------------- 1 | # a keyword as part of an option 2 | mycmd --disable-foo 3 | 4 | # a keyword as part of a parameter 5 | some-cmd set-some-setting 6 | some-cmd set_some_setting 7 | 8 | # a keyword as part of command 9 | check-case foo 10 | check_case foo 11 | -------------------------------------------------------------------------------- /test/markup/golo/default.txt: -------------------------------------------------------------------------------- 1 | module hello 2 | 3 | function dyno = -> DynamicObject() 4 | 5 | struct human = { name } 6 | 7 | @annotated 8 | function main = |args| { 9 | let a = 1 10 | var b = 2 11 | 12 | println("hello") 13 | 14 | let john = human("John Doe") 15 | } 16 | -------------------------------------------------------------------------------- /test/markup/java/textblock.expect.txt: -------------------------------------------------------------------------------- 1 | String json = """ 2 | { 3 | "key": "value" 4 | } 5 | """; 6 | -------------------------------------------------------------------------------- /test/markup/nsis/variables.txt: -------------------------------------------------------------------------------- 1 | Var CustomVariable 2 | StrCpy $CustomVariable "Hello World" 3 | MessageBox MB_OK "$$CustomVariable is: $CustomVariable" 4 | 5 | Var Variable.With.Dots 6 | StrCpy $Variable.With.Dots "Hello World" 7 | MessageBox MB_OK "$$Variable.With.Dots is: $Variable.With.Dots" 8 | -------------------------------------------------------------------------------- /test/markup/yaml/numbers.txt: -------------------------------------------------------------------------------- 1 | key: 1234 2 | not_hex: 999fff 3 | hex: 0x999fff 4 | numkey999: 1234 5 | exp: -2.3e-5 6 | canonical: 2001-12-15T02:59:43.1Z 7 | iso8601: 2001-12-14t21:59:43.10-05:00 8 | space: 2001-12-14 21:59:43.10 -5 9 | nozone: 2001-12-15 2:59:43.10 10 | date: 2002-12-14 11 | -------------------------------------------------------------------------------- /test/detect/golo/default.txt: -------------------------------------------------------------------------------- 1 | module hello 2 | 3 | function dyno = -> DynamicObject() 4 | 5 | struct human = { name } 6 | 7 | @annotated 8 | function main = |args| { 9 | let a = 1 10 | var b = 2 11 | 12 | println("hello") 13 | 14 | let john = human("John Doe") 15 | } 16 | -------------------------------------------------------------------------------- /test/detect/python-repl/default.txt: -------------------------------------------------------------------------------- 1 | >>> v = "foo = 42" 2 | >>> v 3 | "foo = 42" 4 | >>> print(v) 5 | foo = 42 6 | >>> print(repr(v).rstrip('"')) 7 | "foo = 42 8 | >>> print(repr(v).lstrip('"')) 9 | foo = 42" 10 | 11 | >>> """ 12 | ... abc 13 | ... """ 14 | >>> def test(): 15 | ... pass 16 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-failureline.expect.txt: -------------------------------------------------------------------------------- 1 | failure: test simplename1 2 | failure test simplename1 3 | failure: test simple name1 4 | failure test simple name1 5 | -------------------------------------------------------------------------------- /test/markup/swift/availability.txt: -------------------------------------------------------------------------------- 1 | #available() 2 | #available(iOS 15.0, *) 3 | @available() 4 | @available(iOS 15.0, *) 5 | @available(iOS 14, deprecated: "reason", *) 6 | 7 | #unavailable() 8 | #unavailable(iOS 15.0, *) 9 | // not a keyword 10 | @unavailable() 11 | @unavailable(iOS 15.0, *) 12 | -------------------------------------------------------------------------------- /test/markup/typescript/identifiers_that_include_keywords.expect.txt: -------------------------------------------------------------------------------- 1 | const $class = () => true; 2 | const result = $class(); 3 | -------------------------------------------------------------------------------- /test/markup/vbnet/comments.txt: -------------------------------------------------------------------------------- 1 | ' Comment1 2 | 'Comment2 3 | REM Comment3 4 | 5 | Dim somREM = "no comment" 6 | Dim REM2 = "no comment" 7 | Dim a = 1 ' inline comment 8 | Dim b = 2 REM inline comment 9 | 10 | ''' Doc-comments 11 | 12 | ' Not a doc-comment, but html: 13 | -------------------------------------------------------------------------------- /test/markup/verilog/directives.expect.txt: -------------------------------------------------------------------------------- 1 | `define CONSTANT value // this is a comment 2 | wire result = `CONSTANT + variable; // comment 3 | -------------------------------------------------------------------------------- /test/markup/java/annotations.txt: -------------------------------------------------------------------------------- 1 | @SpringBootTest 2 | @AutoConfigureMockMvc 3 | @Transactional 4 | @Slf4j 5 | @RunWith(SpringRunner.class) 6 | @Something(1+(3+4)) 7 | public class BoardControllerTest { 8 | } 9 | 10 | class Example { 11 | void foo(@SuppressWarnings("unused") int bar) { } 12 | } 13 | -------------------------------------------------------------------------------- /test/markup/python/keywords.txt: -------------------------------------------------------------------------------- 1 | class Shorty(dict): 2 | def len(self): 3 | return NotImplemented 4 | 5 | x = Shorty() 6 | len(x) 7 | 8 | if __debug__: 9 | sys = __import__('sys') 10 | 11 | for _ in sys.path: 12 | print(_) 13 | 14 | exec(123) 15 | 16 | print(1if 0==0else"b") 17 | -------------------------------------------------------------------------------- /test/markup/css/hex-colors.txt: -------------------------------------------------------------------------------- 1 | .test-short { 2 | color: #abc; 3 | } 4 | 5 | .test-short-alpha { 6 | color: #abcd; 7 | } 8 | 9 | .test-long { 10 | color: #aabbcc; 11 | } 12 | 13 | .test-long-alpha { 14 | color: #aabbccdd; 15 | } 16 | 17 | .test-invalid { 18 | color: #aabbccd; 19 | } -------------------------------------------------------------------------------- /test/markup/java/switch.txt: -------------------------------------------------------------------------------- 1 | switch(a) { 2 | case null -> yield "n"; 3 | case String s -> yield "s"; 4 | case Object o -> yield "o"; 5 | default: yield "d", 6 | } 7 | 8 | switch(a) { 9 | case null: return "n"; 10 | case "s": return "s"; 11 | case "o": return "o"; 12 | default: return "d"; 13 | } 14 | -------------------------------------------------------------------------------- /test/markup/markdown/list.expect.txt: -------------------------------------------------------------------------------- 1 | - this is a list 2 | - this is another 3 | - nested list 4 | - another nested 5 | * nested alternative 6 | -------------------------------------------------------------------------------- /test/markup/xquery/function_body.txt: -------------------------------------------------------------------------------- 1 | declare function local:test ($node as node()) as element(div) { 2 | for $n in $node 3 | return 4 | element div { switch($n) 5 | case 'abc' return 'OK' 6 | default return 2 7 | } 8 | }; 9 | for $x in 1 to 3 10 | return 11 | local:test(abc) 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build 3 | docs/_build 4 | __pycache__ 5 | *.swp 6 | node_modules 7 | .project 8 | yarn.lock 9 | extra/ 10 | 11 | # play stuff 12 | quick* 13 | test*.* 14 | extra* 15 | 16 | # editors 17 | .idea/ 18 | .nova/ 19 | .vscode/ 20 | .Rproj.user 21 | 22 | # misc 23 | /work 24 | /website 25 | -------------------------------------------------------------------------------- /test/detect/objectivec/default.txt: -------------------------------------------------------------------------------- 1 | #import 2 | #import "Dependency.h" 3 | 4 | @protocol WorldDataSource 5 | @optional 6 | - (NSString*)worldName; 7 | @required 8 | - (BOOL)allowsToLive; 9 | @end 10 | 11 | @property (nonatomic, readonly) NSString *title; 12 | - (IBAction) show; 13 | @end 14 | -------------------------------------------------------------------------------- /test/markup/handlebars/block-with-param.expect.txt: -------------------------------------------------------------------------------- 1 | {{#blockHelper param1 param2}}block content{{/blockHelper}} 2 | -------------------------------------------------------------------------------- /test/markup/kotlin/nested_comment.txt: -------------------------------------------------------------------------------- 1 | /* begin comment at LEVEL 0 2 | /* 3 | multiline nested comment LEVEL 1 4 | */ 5 | println("on kotlin this is a commented code in comment LEVEL 0") 6 | /* 7 | another multiline nested comment LEVEL 1 8 | */ 9 | end comment at LEVEL 0 */ 10 | -------------------------------------------------------------------------------- /test/markup/python-repl/sample.txt: -------------------------------------------------------------------------------- 1 | >>> v = "foo = 42" 2 | >>> v 3 | "foo = 42" 4 | >>> print(v) 5 | foo = 42 6 | >>> print(repr(v).rstrip('"')) 7 | "foo = 42 8 | >>> print(repr(v).lstrip('"')) 9 | foo = 42" 10 | 11 | >>> """ 12 | ... abc 13 | ... """ 14 | >>> def test(): 15 | ... pass 16 | >>> 17 | >>> 18 | -------------------------------------------------------------------------------- /test/markup/scala/symbol.expect.txt: -------------------------------------------------------------------------------- 1 | def f(s: Symbol) = { 2 | s match { 3 | case 'foo => 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-testline.txt: -------------------------------------------------------------------------------- 1 | test: test basicsuite1 2 | testing: test basicsuite1 3 | test test basicsuite1 4 | testing test basicsuite1 5 | test: test basic suite1 6 | testing: test basic suite1 7 | test test basic suite1 8 | testing test basic suite1 9 | testing test basic 10 | test test 222 11 | -------------------------------------------------------------------------------- /test/markup/swift/swiftui.txt: -------------------------------------------------------------------------------- 1 | @main 2 | struct MyApp: App { 3 | var body: some Scene { 4 | WindowGroup { 5 | #if os(iOS) 6 | Text("Hello, world from iOS!") 7 | #else 8 | Text("Hello, world!") 9 | #endif 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/markup/taggerscript/noop.expect.txt: -------------------------------------------------------------------------------- 1 | $noop(\))text 2 | $noop(\()text 3 | $noop(\($noop(abc$func(\))\)xyz))text 4 | $noop(Multiline \(comment 5 | $func($noop(test)) 6 | )text 7 | -------------------------------------------------------------------------------- /test/detect/json/default.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "title": "apples", 4 | "count": [12000, 20000], 5 | "description": {"text": "...", "sensitive": false} 6 | }, 7 | { 8 | "title": "oranges", 9 | "count": [17500, null], 10 | "description": {"text": "...", "sensitive": false} 11 | } 12 | ] 13 | -------------------------------------------------------------------------------- /test/markup/javascript/comments.txt: -------------------------------------------------------------------------------- 1 | f = ( // f is a recursive function taking: 2 | [c, // c = next digit character 3 | ...a], // a[] = array of remaining digits 4 | o = b, // o = output string 5 | S = s // S = set of solutions 6 | ) => {} 7 | -------------------------------------------------------------------------------- /test/markup/ruby/regexes.expect.txt: -------------------------------------------------------------------------------- 1 | str =~ /^(?:foo)$/ 2 | str =~ %r{foo|bar|buz$} 3 | str =~ %r!foo|bar$! 4 | str =~ %r[foo|bar$] 5 | str =~ %r(\(foo|bar\)$) 6 | -------------------------------------------------------------------------------- /test/markup/scala/for-do.expect.txt: -------------------------------------------------------------------------------- 1 | def f = for x <- Nil do println("hello") 2 | -------------------------------------------------------------------------------- /test/markup/scala/while-do.expect.txt: -------------------------------------------------------------------------------- 1 | def f = while true do println("hello") 2 | -------------------------------------------------------------------------------- /test/markup/xquery/computed_inbuilt.txt: -------------------------------------------------------------------------------- 1 | xquery version "3.1"; 2 | let $root := element {fn:node-name($e)} 3 | {$e/@*, 2 * fn:data($e)} 4 | 5 | for $node in root($root) 6 | return 7 | element root { root ($node)/text(), attribute root {'root'}, 8 | element not-root{attribute type{"root"}, root($root)} 9 | } 10 | -------------------------------------------------------------------------------- /test/detect/erb/default.txt: -------------------------------------------------------------------------------- 1 | <%# this is a comment %> 2 | 3 | <% @posts.each do |post| %> 4 |

<%= link_to post.title, post %>

5 | <% end %> 6 | 7 | <%- available_things = things.select(&:available?) -%> 8 | <%%- x = 1 + 2 -%%> 9 | <%% value = 'real string #{@value}' %%> 10 | <%%= available_things.inspect %%> 11 | -------------------------------------------------------------------------------- /test/markup/elixir/function-title.txt: -------------------------------------------------------------------------------- 1 | def f do 2 | :ok 3 | end 4 | 5 | def f(list) do 6 | :ok 7 | end 8 | 9 | def f :clear, list do 10 | :ok 11 | end 12 | 13 | def f!, do: IO.puts "hello world" 14 | 15 | defp f?, do: true 16 | 17 | defmacro foo, do: :ok 18 | 19 | defmacrop do_foo, do: :ok 20 | 21 | x = 5 22 | -------------------------------------------------------------------------------- /test/markup/elixir/modules.txt: -------------------------------------------------------------------------------- 1 | defmodule User do 2 | defstruct [:name, :email, age: 18] 3 | end 4 | 5 | defprotocol Size do 6 | @doc "Calculates the size (and not the length!) of a data structure" 7 | def size(data) 8 | end 9 | 10 | defimpl Size, for: Map do 11 | def size(map), do: map_size(map) 12 | end 13 | -------------------------------------------------------------------------------- /test/markup/erb/default.txt: -------------------------------------------------------------------------------- 1 | <%# this is a comment %> 2 | 3 | <% @posts.each do |post| %> 4 |

<%= link_to post.title, post %>

5 | <% end %> 6 | 7 | <%- available_things = things.select(&:available?) -%> 8 | <%%- x = 1 + 2 -%%> 9 | <%% value = 'real string #{@value}' %%> 10 | <%%= available_things.inspect %%> 11 | -------------------------------------------------------------------------------- /test/markup/handlebars/else-variants.txt: -------------------------------------------------------------------------------- 1 | {{#helper}}{{else}}else-block{{/helper}} 2 | 3 | {{#helper}}block{{else}}else-block{{/helper}} 4 | 5 | {{[else]}} in brackets is a helper, not a keyword 6 | 7 | {{#else}} as block helper name is not a keyword {{/else}} 8 | 9 | \{{else}} is not a keyword if escaped 10 | 11 | -------------------------------------------------------------------------------- /test/markup/python/diacritic_identifiers.txt: -------------------------------------------------------------------------------- 1 | def fóö(): 2 | pass 3 | 4 | def bär(): 5 | pass 6 | 7 | def FOÖ(): 8 | pass 9 | 10 | def ÿay(): 11 | pass 12 | 13 | class fóö(): 14 | pass 15 | 16 | class bär(): 17 | pass 18 | 19 | class FOÖ(): 20 | pass 21 | 22 | class ÿay(): 23 | pass -------------------------------------------------------------------------------- /test/markup/subunit/subunit-tagline.expect.txt: -------------------------------------------------------------------------------- 1 | tags: fuzz unit beta functional 2 | tags: -functional basic -beta 3 | tags: -unit 4 | tags: unit 5 | tags: ddd 6 | -------------------------------------------------------------------------------- /test/markup/xml/processing.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Some green text. 6 | 7 | -------------------------------------------------------------------------------- /test/detect/openscad/default.txt: -------------------------------------------------------------------------------- 1 | use 2 | include <../common/base.scad> 3 | 4 | //draw a foobar 5 | module foobar(){ 6 | translate([0,-10,0]) 7 | difference(){ 8 | cube([5,10.04,15]); 9 | sphere(r=10,$fn=100); 10 | } 11 | } 12 | 13 | foobar(); 14 | #cube ([5,5,5]); 15 | echo("done"); -------------------------------------------------------------------------------- /test/detect/prolog/default.txt: -------------------------------------------------------------------------------- 1 | mergesort([],[]). % special case 2 | mergesort([A],[A]). 3 | mergesort([A,B|R],S) :- 4 | split([A,B|R],L1,L2), 5 | mergesort(L1,S1), 6 | mergesort(L2,S2), 7 | merge(S1,S2,S). 8 | 9 | split([],[],[]). 10 | split([A],[A],[]). 11 | split([A,B|R],[A|Ra],[B|Rb]) :- split(R,Ra,Rb). 12 | -------------------------------------------------------------------------------- /test/markup/elixir/strings.expect.txt: -------------------------------------------------------------------------------- 1 | a = """ 2 | test 3 | """ 4 | b = ''' 5 | test 6 | ''' 7 | c = "test" 8 | d = 'test' 9 | -------------------------------------------------------------------------------- /test/markup/handlebars/block-expression-variants-in-helper-name.txt: -------------------------------------------------------------------------------- 1 | text {{#[ab}}c] param }}a{{/[ab}}c]}} 2 | 3 | text {{#'ab}}c' param}}a{{/'ab}}c'}} 4 | 5 | text {{#"ab}}c" param}}a{{/"ab}}c"}} 6 | 7 | text {{#"" param}}a{{/""}} 8 | 9 | text {{#'' param}}a{{/''}} 10 | 11 | text {{#[] param}}a{{/[]}} 12 | 13 | text 14 | -------------------------------------------------------------------------------- /test/markup/openscad/default.txt: -------------------------------------------------------------------------------- 1 | use 2 | include <../common/base.scad> 3 | 4 | //draw a foobar 5 | module foobar(){ 6 | translate([0,-10,0]) 7 | difference(){ 8 | cube([5,10.04,15]); 9 | sphere(r=10,$fn=100); 10 | } 11 | } 12 | 13 | foobar(); 14 | #cube ([5,5,5]); 15 | echo("done"); -------------------------------------------------------------------------------- /test/markup/php/namespace.txt: -------------------------------------------------------------------------------- 1 | namespace Location\Web; 2 | namespace foo; 3 | use My\Full\Classname as Another; 4 | use My\Full\NSname; 5 | use ArrayObject; 6 | use function My\Full\functionName; 7 | use function My\Full\functionName as func; 8 | use const My\Full\CONSTANT; 9 | use Example\{ClassA, ClassB, ClassC as C}; 10 | -------------------------------------------------------------------------------- /test/markup/prolog/default.txt: -------------------------------------------------------------------------------- 1 | mergesort([],[]). % special case 2 | mergesort([A],[A]). 3 | mergesort([A,B|R],S) :- 4 | split([A,B|R],L1,L2), 5 | mergesort(L1,S1), 6 | mergesort(L2,S2), 7 | merge(S1,S2,S). 8 | 9 | split([],[],[]). 10 | split([A],[A],[]). 11 | split([A,B|R],[A|Ra],[B|Rb]) :- split(R,Ra,Rb). 12 | -------------------------------------------------------------------------------- /test/markup/scala/quoted-code.expect.txt: -------------------------------------------------------------------------------- 1 | def f(using Quotes) = '{ val x = 1; ${g('x)} } 2 | -------------------------------------------------------------------------------- /test/markup/swift/class-func-var.txt: -------------------------------------------------------------------------------- 1 | class func f1() -> Void { } 2 | 3 | class func f2() -> T { } 4 | 5 | class func f3( 6 | _ p1: Int, 7 | p2: String 8 | ) async throws -> [T] { } 9 | 10 | class var v1: Int { get set } 11 | 12 | class var v2: String { 13 | get { return "test" } 14 | set { } 15 | } -------------------------------------------------------------------------------- /test/detect/http/default.txt: -------------------------------------------------------------------------------- 1 | POST /task?id=1 HTTP/1.1 2 | Host: example.org 3 | Content-Type: application/json; charset=utf-8 4 | Content-Length: 137 5 | 6 | { 7 | "status": "ok", 8 | "extended": true, 9 | "results": [ 10 | {"value": 0, "type": "int64"}, 11 | {"value": 1.0e+3, "type": "decimal"} 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /test/markup/aspectj/intertype-constructor.expect.txt: -------------------------------------------------------------------------------- 1 | public MyClass.new() throws Exception{ 2 | // intertype constructor body 3 | } 4 | -------------------------------------------------------------------------------- /test/markup/clojure/comment-macro.expect.txt: -------------------------------------------------------------------------------- 1 | (comment "comment is a macro that emits no code. It can contain clojure code in itself.") 2 | (comment-and-something "This is a valid function name") -------------------------------------------------------------------------------- /test/markup/ebnf/quote-symbols.txt: -------------------------------------------------------------------------------- 1 | first_quote_symbol = "'" . 2 | second_quote_symbol = '"' . 3 | 4 | (* escaped_quote_symbol tests backticks, which does not interfere 5 | * with backslashes. It has precedent in some language 6 | * specifications. 7 | *) 8 | escaped_quote_symbol = `\` ( first_quote_symbol | second_quote_symbol ) . 9 | -------------------------------------------------------------------------------- /test/markup/handlebars/literals-in-different-places.txt: -------------------------------------------------------------------------------- 1 | {{helper true false a=true b=false}} 2 | 3 | {{{helper true false}}} 4 | 5 | {{#helper true false}} {{/helper}} 6 | 7 | {{{{#helper true false}}}} {{{{/helper}}}} 8 | 9 | {{>partial true}} 10 | 11 | {{helper (helper true false)}} 12 | 13 | {{helper a=true b=false}} 14 | -------------------------------------------------------------------------------- /test/markup/rust/strings.txt: -------------------------------------------------------------------------------- 1 | 'a'; 2 | '\n'; 3 | '\x1A'; 4 | '\u12AS'; 5 | '\U1234ASDF'; 6 | '😭'; 7 | b'a'; 8 | 9 | "hello"; 10 | b"hello"; 11 | 12 | r"hello"; 13 | r###"world"###; 14 | r##" "### 15 | "# "##; 16 | "😭😭😭😭"; 17 | 18 | br" "; 19 | br#"hello"#; 20 | br##"foo"##; 21 | 22 | #[error("\" appears in a string")] 23 | -------------------------------------------------------------------------------- /test/markup/sql/numeric-types.expect.txt: -------------------------------------------------------------------------------- 1 | SELECT CAST(32768 AS TINYINT) FROM VALUES('dummy'); 2 | -------------------------------------------------------------------------------- /test/markup/markdown/links.expect.txt: -------------------------------------------------------------------------------- 1 | ![](https://example.com) 2 | [](https://example.com) 3 | ![alt](https://example.com) 4 | [text](https://example.com) 5 | -------------------------------------------------------------------------------- /test/markup/wren/attributes.txt: -------------------------------------------------------------------------------- 1 | #key 2 | #key = value 3 | #group( 4 | multiple, 5 | lines = true, 6 | lines = 0 7 | ) 8 | class Example { 9 | #test(skip = true, iterations = 32) 10 | doStuff() {} 11 | 12 | #doc = "not runtime data" 13 | #!runtimeAccess = true 14 | #!maxIterations = 16 15 | anotherFn() {} 16 | } 17 | -------------------------------------------------------------------------------- /test/markup/elixir/char-literal.expect.txt: -------------------------------------------------------------------------------- 1 | defguardp apostrophe?(c) when c == ?' 2 | defguardp upper?(c) when (c >= ?A and c <= ?Z) 3 | -------------------------------------------------------------------------------- /test/detect/xml/default.txt: -------------------------------------------------------------------------------- 1 | 2 | Title 3 | 4 | 5 | 6 | 9 | 10 | 11 |

Title

12 | 13 | 14 | -------------------------------------------------------------------------------- /test/markup/haskell/char.txt: -------------------------------------------------------------------------------- 1 | -- simple string 2 | t1 = "starscout" 3 | 4 | -- simple char 5 | t2 = 'm' 6 | 7 | -- char and string 8 | t3 = 'm' : "oonbow" 9 | 10 | -- escaping 11 | t4 = '\"' : 'x' : "y" 12 | t5 = '\'' : 'x' : "y" 13 | 14 | -- should not parse as chars or strings 15 | t6 = '' 16 | t7 = 'a 17 | t8 = ''a 18 | t9 = a' 19 | t10 = a'' -------------------------------------------------------------------------------- /test/markup/http/just_headers.expect.txt: -------------------------------------------------------------------------------- 1 | Host: example.org 2 | Content-Type: application/json; charset=utf-8 3 | Content-Length: 19 4 | -------------------------------------------------------------------------------- /test/markup/maxima/numbers.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0. 3 | 12345. 4 | 12345 5 | 0.0 6 | 123.45 7 | 0e0 8 | 0b0 9 | 12345e0 10 | 12345e123 11 | 12345e-123 12 | 12345e+123 13 | 12345b0 14 | 12345b123 15 | 12345b-123 16 | 12345b+123 17 | 1.2345e0 18 | 1.2345e123 19 | 1.2345e-123 20 | 1.2345e+123 21 | 1.2345b0 22 | 1.2345b123 23 | 1.2345b-123 24 | 1.2345b+123 25 | -------------------------------------------------------------------------------- /test/markup/protobuf/rpc.expect.txt: -------------------------------------------------------------------------------- 1 | service Greeter { 2 | // Sends a greeting 3 | rpc SayHello (HelloRequest) returns (HelloReply) {} 4 | } 5 | -------------------------------------------------------------------------------- /test/markup/yaml/tag.txt: -------------------------------------------------------------------------------- 1 | key: !!builtintagname test 2 | key: !localtagname test 3 | key: "!notatag" 4 | key: '!!notatageither' 5 | key: !!python/dict test 6 | key: !!python/name:module.name test 7 | key: !foo2.bar test 8 | key: !(foo.bar?):tag test 9 | key: !named!tag test 10 | 11 | --- ! 12 | invoice: 34843 13 | -------------------------------------------------------------------------------- /test/markup/subunit/subunit-timeline.expect.txt: -------------------------------------------------------------------------------- 1 | time: 2016-03-13 18:12:37.231080Z 2 | time: 1917-10-25 09:05:37.231080Z 3 | time: 1984-03-24 07:02:09.231080Z 4 | -------------------------------------------------------------------------------- /test/detect/bash/default.txt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ###### CONFIG 4 | ACCEPTED_HOSTS="/root/.hag_accepted.conf" 5 | BE_VERBOSE=false 6 | 7 | if [ "$UID" -ne 0 ] 8 | then 9 | echo "Superuser rights required" 10 | exit 2 11 | fi 12 | 13 | genApacheConf(){ 14 | echo -e "# Host ${HOME_DIR}$1/$2 :" 15 | } 16 | 17 | echo '"quoted"' | tr -d \" > text.txt 18 | -------------------------------------------------------------------------------- /test/markup/kotlin/function.txt: -------------------------------------------------------------------------------- 1 | fun a() = 1 2 | fun /* b1 */ b(/*b2*/ a : Int /*b3*/) /*b4*/ = a // b5 3 | 4 | 5 | fun c() : String = "1" 6 | inline fun d() { return } 7 | 8 | 9 | fun e( 10 | a : Int, /*a*/ 11 | b : String //b 12 | ) 13 | {} 14 | 15 | 16 | fun handle(lambda: (IN) /* parenthesized type */ -> OUT) {} 17 | -------------------------------------------------------------------------------- /test/detect/clojure/default.txt: -------------------------------------------------------------------------------- 1 | (def ^:dynamic chunk-size 17) 2 | 3 | (defn next-chunk [rdr] 4 | (let [buf (char-array chunk-size) 5 | s (.read rdr buf)] 6 | (when (pos? s) 7 | (java.nio.CharBuffer/wrap buf 0 s)))) 8 | 9 | (defn chunk-seq [rdr] 10 | (when-let [chunk (next-chunk rdr)] 11 | (cons chunk (lazy-seq (chunk-seq rdr))))) 12 | -------------------------------------------------------------------------------- /test/markup/coffeescript/regex.txt: -------------------------------------------------------------------------------- 1 | # Regexps 2 | x = // 3 | x = (//) 4 | x = (/test/) 5 | x = //mig 6 | x = //gim 7 | x = /something/gim 8 | x = /\// 9 | x = /\n/ 10 | x = /ab\/ ab/ 11 | x = f /6 * 2/ - 3 12 | x = f /foo * 2/gm 13 | x = if true then /\n/ else /[.,]+/ 14 | x = ///^key-#{key}-\d+/// 15 | 16 | # not a Regexp 17 | x = //test 18 | x = /boo/test 19 | -------------------------------------------------------------------------------- /test/markup/php/comments.txt: -------------------------------------------------------------------------------- 1 | param2: # interesting 5 | print 'Gre\'ater' 6 | return (param2 - param1 + 1 + 0b10l) or None 7 | 8 | class SomeClass: 9 | pass 10 | 11 | >>> message = '''interpreter 12 | ... prompt''' 13 | -------------------------------------------------------------------------------- /test/detect/wasm/default.txt: -------------------------------------------------------------------------------- 1 | (module 2 | (import "js" "memory" (memory 1)) 3 | (import "js" "table" (table 1 funcref)) 4 | (type $void_to_i32 (func (result i32))) 5 | (func (export "doIt") (result i32) 6 | i32.const 0 7 | i32.const 42 8 | i32.store ;; store 42 at address 0 9 | i32.const 0 10 | call_indirect (type $void_to_i32)) 11 | ) 12 | -------------------------------------------------------------------------------- /test/markup/applescript/default.txt: -------------------------------------------------------------------------------- 1 | repeat 5 times 2 | if foo is greater than bar then 3 | display dialog "Hello there" 4 | else 5 | beep 6 | end if 7 | end repeat 8 | 9 | (* comment (*nested comment*) *) 10 | on do_something(s, y) 11 | return {s + pi, y mod 4} 12 | end do_something 13 | 14 | do shell script "/bin/echo 'hello'" 15 | -------------------------------------------------------------------------------- /test/markup/coffeescript/function.txt: -------------------------------------------------------------------------------- 1 | returnNull = -> null 2 | returnTrue = () -> true 3 | square = (x) -> x * x 4 | 5 | npmWishlist.sha256 = (str) -> 6 | throw new Error() 7 | 8 | str.split(" ").map((m) -> m.charCodeAt(0)) 9 | 10 | fs.readFile("package.json", "utf-8", (err, content) -> 11 | data = JSON.parse(content) 12 | 13 | data.version 14 | ) 15 | -------------------------------------------------------------------------------- /test/markup/handlebars/comments.expect.txt: -------------------------------------------------------------------------------- 1 | {{!-- a comment {{expression}} --}} {{expression}} 2 | 3 | {{! a simple comment }} 4 | -------------------------------------------------------------------------------- /test/markup/powershell/apos-herestring.txt: -------------------------------------------------------------------------------- 1 | @' The wild cat jumped over the $height-tall fence. 2 | He did so with grace. 3 | '@ 4 | 5 | This SHOULDNT be a part of the above strings span. 6 | 7 | @' The wild cat jumped over the $height-tall fence. 8 | He did so with grace. 9 | break-end-of-string'@ 10 | 11 | This SHOULD be a part of the above strings span. -------------------------------------------------------------------------------- /test/markup/powershell/quote-herestring.txt: -------------------------------------------------------------------------------- 1 | @" The wild cat jumped over the $height-tall fence. 2 | He did so with grace. 3 | "@ 4 | 5 | This SHOULDNT be a part of the above strings span. 6 | 7 | @" The wild cat jumped over the $height-tall fence. 8 | He did so with grace. 9 | break-end-of-string"@ 10 | 11 | This SHOULD be a part of the above strings span. -------------------------------------------------------------------------------- /test/markup/scala/if-then-else.expect.txt: -------------------------------------------------------------------------------- 1 | def f = if true then 1 else 2 2 | -------------------------------------------------------------------------------- /test/markup/typescript/decorator-factories.txt: -------------------------------------------------------------------------------- 1 | @foo('foo') 2 | export class MyClass { 3 | @baz(123) 4 | private myAttribute: string; 5 | 6 | constructor(@bar(true) private x, 7 | @bar(qux(quux(true))) private y) { } 8 | 9 | @bar() 10 | private myMethod(@bar() z) { 11 | console.log('Hello world.'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/markup/typescript/module-id.txt: -------------------------------------------------------------------------------- 1 | @Component({ 2 | selector: 'my-example', 3 | directives: [SomeDirective], 4 | templateUrl: './my-example.component.html', 5 | moduleId: module.id, 6 | styles: [` 7 | .my-example { 8 | padding: 5px; 9 | } 10 | `] 11 | }) 12 | export class MyExampleComponent { 13 | someProp: string = "blah"; 14 | } 15 | -------------------------------------------------------------------------------- /test/markup/vim/strings-comments.expect.txt: -------------------------------------------------------------------------------- 1 | " comment 2 | let one = "string" " comment 3 | let two = "crazy 4 | \ string with a \" quote" 5 | -------------------------------------------------------------------------------- /test/parser/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const should = require('should'); 4 | 5 | describe('hljs', function() { 6 | require('./look-ahead-end-matchers'); 7 | require('./resume-scan'); 8 | require('./reuse-endsWithParent'); 9 | require('./should-not-destroyData'); 10 | require('./compiler-extensions'); 11 | require('./max_keyword_hits'); 12 | }); 13 | -------------------------------------------------------------------------------- /test/detect/scilab/default.txt: -------------------------------------------------------------------------------- 1 | // A comment 2 | function I = foo(dims, varargin) 3 | d=[1; matrix(dims(1:$-1),-1,1)] 4 | for i=1:size(varargin) 5 | if varargin(i)==[] then 6 | I=[], 7 | return; 8 | end 9 | end 10 | endfunction 11 | 12 | b = cos(a) + cosh(a); 13 | bar_matrix = [ "Hello", "world" ]; 14 | foo_matrix = [1, 2, 3; 4, 5, 6]; 15 | -------------------------------------------------------------------------------- /test/markup/csharp/functions.txt: -------------------------------------------------------------------------------- 1 | public void ExampleFunction1() { 2 | } 3 | 4 | public void ExampleFunction2() 5 | { 6 | } 7 | 8 | void ExampleFunctionDeclaration1(); 9 | 10 | void ExampleFunctionDeclaration2() 11 | ; 12 | 13 | public string ExampleExpressionBodiedFunction1() => "dummy"; 14 | 15 | public string ExampleExpressionBodiedFunction2() 16 | => "dummy"; -------------------------------------------------------------------------------- /test/markup/erlang/maybe.expect.txt: -------------------------------------------------------------------------------- 1 | maybe 2 | {ok, A} ?= a(), 3 | true = A >= 0, 4 | {ok, B} ?= b(), 5 | A + B 6 | else 7 | error -> error; 8 | wrong -> error 9 | end 10 | -------------------------------------------------------------------------------- /test/markup/scala/extension.txt: -------------------------------------------------------------------------------- 1 | extension (x: Int) def plus(y: Int) = x + y 2 | 3 | extension [T](x: T) def f = () 4 | 5 | extension (x: Int) 6 | def f = 1 7 | def f = 2 8 | 9 | object Foo { 10 | extension (x: Int) 11 | def f = 1 12 | def f = 2 13 | } 14 | 15 | def extension(file: File) = 16 | file.extension 17 | 18 | file 19 | .extension 20 | -------------------------------------------------------------------------------- /test/markup/scilab/default.txt: -------------------------------------------------------------------------------- 1 | // A comment 2 | function I = foo(dims, varargin) 3 | d=[1; matrix(dims(1:$-1),-1,1)] 4 | for i=1:size(varargin) 5 | if varargin(i)==[] then 6 | I=[], 7 | return; 8 | end 9 | end 10 | endfunction 11 | 12 | b = cos(a) + cosh(a); 13 | bar_matrix = [ "Hello", "world" ]; 14 | foo_matrix = [1, 2, 3; 4, 5, 6]; 15 | -------------------------------------------------------------------------------- /.eslintrc.lang.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es6: true, 5 | node: true 6 | }, 7 | parserOptions: { 8 | ecmaVersion: 2015, 9 | sourceType: "module" 10 | }, 11 | // no rules, this file exists only to lint the grammars and check 12 | // that no ES2018 or newer syntax has crept in by accident 13 | rules: {} 14 | }; 15 | -------------------------------------------------------------------------------- /test/markup/python/function-header.expect.txt: -------------------------------------------------------------------------------- 1 | def f(x: int, *, y: bool = True) -> None: 2 | pass 3 | -------------------------------------------------------------------------------- /test/markup/scala/inline.txt: -------------------------------------------------------------------------------- 1 | inline def pow(inline x: Int, inline n: Int) = ??? 2 | transparent inline def f: Int = ??? 3 | inline val a: Int = 9 4 | inline given Int = 9 5 | 6 | notinline given Int = 9 7 | 8 | def expressions = 9 | inline if true then () else () 10 | inline x match ... 11 | 12 | x.inline 13 | x.inline(y) 14 | x.inline[T] 15 | `inline` + 1 16 | -------------------------------------------------------------------------------- /test/detect/coffeescript/default.txt: -------------------------------------------------------------------------------- 1 | grade = (student, period=(if b? then 7 else 6)) -> 2 | if student.excellentWork 3 | "A+" 4 | else if student.okayStuff 5 | if student.triedHard then "B" else "B-" 6 | else 7 | "C" 8 | 9 | class Animal extends Being 10 | constructor: (@name) -> 11 | 12 | move: (meters) -> 13 | alert @name + " moved #{meters}m." 14 | -------------------------------------------------------------------------------- /test/detect/leaf/default.txt: -------------------------------------------------------------------------------- 1 | #(variable) 2 | #extend("template"): I'm added to a base template! #endextend 3 | #import("body") 4 | #count(friends) 5 | 6 | #for(friend in friends):
  • #(friend.name)
  • #endfor 7 | 8 | #if(count(visit) == 1): 9 | Hello new user! 10 | #elseif(title == "Welcome back!"): 11 | Hello old user 12 | #else: 13 | Unexpected page! 14 | #endif -------------------------------------------------------------------------------- /test/markup/csharp/scoped.expect.txt: -------------------------------------------------------------------------------- 1 | public static ref T AsRef<T>(scoped in T source); -------------------------------------------------------------------------------- /test/markup/leaf/default.txt: -------------------------------------------------------------------------------- 1 | #(variable) 2 | #extend("template"): I'm added to a base template! #endextend 3 | #import("body") 4 | #count(friends) 5 | 6 | #for(friend in friends):
  • #(friend.name)
  • #endfor 7 | 8 | #if(count(visit) == 1): 9 | Hello new user! 10 | #elseif(title == "Welcome back!"): 11 | Hello old user 12 | #else: 13 | Unexpected page! 14 | #endif -------------------------------------------------------------------------------- /test/detect/cpp/default.txt: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) { 4 | 5 | /* An annoying "Hello World" example */ 6 | for (auto i = 0; i < 0xFFFF; i++) 7 | cout << "Hello, World!" << endl; 8 | 9 | char c = '\n'; 10 | unordered_map > m; 11 | m["key"] = "\\\\"; // this is an error 12 | 13 | return -2e3 + 12l; 14 | } 15 | -------------------------------------------------------------------------------- /test/detect/profile/default.txt: -------------------------------------------------------------------------------- 1 | 261917242 function calls in 686.251 CPU seconds 2 | 3 | ncalls tottime filename:lineno(function) 4 | 152824 513.894 {method 'sort' of 'list' objects} 5 | 129590630 83.894 rrule.py:842(__cmp__) 6 | 129590630 82.439 {cmp} 7 | 153900 1.296 rrule.py:399(_iter) 8 | 304393/151570 0.963 rrule.py:102(_iter_cached) 9 | -------------------------------------------------------------------------------- /test/markup/bash/arithmetic.txt: -------------------------------------------------------------------------------- 1 | echo $(( 16#deadbeef / 1003 )) 2 | 3 | yumi=deadbeef 4 | echo $(( 16#$yumi / 1003 )) 5 | 6 | B=20 7 | yumi=deadbeef 8 | echo $(( $B#$yumi / 1003 )) 9 | 10 | # test that << within an expression doesn't false positively as a heredoc... 11 | (( 19 << 42 )) 12 | printf 'Line 1\n' 13 | printf 'Line 2\n' 14 | 15 | fubar=42 16 | (( x = 19 * fubar / 2 )) 17 | -------------------------------------------------------------------------------- /test/markup/elixir/uppercase-string-sigil.txt: -------------------------------------------------------------------------------- 1 | defmodule Long.Module.Name do 2 | @doc ~S''' 3 | No #{interpolation} of any kind. 4 | \000 \x{ff} 5 | 6 | \n #{\x{ff}} 7 | ''' 8 | def func(a, b \\ []), do: :ok 9 | 10 | @doc ~S""" 11 | No #{interpolation} of any kind. 12 | \000 \x{ff} 13 | 14 | \n #{\x{ff}} 15 | """ 16 | def func(a, b \\ []), do: :ok 17 | end 18 | -------------------------------------------------------------------------------- /test/markup/handlebars/escaped-mustaches.txt: -------------------------------------------------------------------------------- 1 | \{{no-expression}} 2 | 3 | \{{{no-expression}}} 4 | 5 | \{{#no}} block \{{/no}} 6 | 7 | \{{\{{no}}}} block \{{\{{/no}}}} 8 | 9 | \{{!-- no comment --}} 10 | 11 | \{{! no comment }} 12 | 13 | 14 | 15 | \\{{expression}} 16 | 17 | \\\{{expression}} 18 | 19 | \\\\{{expression}} 20 | 21 | \\\{{! comment }} 22 | -------------------------------------------------------------------------------- /test/markup/javascript/modules.txt: -------------------------------------------------------------------------------- 1 | //------ underscore.js ------ 2 | export default function (obj) {}; 3 | export function each(obj, iterator, context) {}; 4 | export { each as forEach }; 5 | export function something() {}; 6 | 7 | //------ main.js ------ 8 | import _, { each, something as otherthing } from 'underscore'; 9 | 10 | const file = import("https://file.io/file.js") 11 | -------------------------------------------------------------------------------- /test/markup/pgsql/dollar_strings.txt: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION hello_world(param_your_name text) 2 | RETURNS text AS 3 | $$ 4 | SELECT 'Hello world. My name is ' || param_your_name || '.'; 5 | $$ 6 | language sql STRICT; 7 | 8 | SELECT sql_expression($sql$SELECT hello_world($phrase$Regina's elephant's dog$phrase$) 9 | || $phrase$ I made a cat's meow today.$phrase$ $sql$); 10 | -------------------------------------------------------------------------------- /test/markup/profile/default.txt: -------------------------------------------------------------------------------- 1 | 261917242 function calls in 686.251 CPU seconds 2 | 3 | ncalls tottime filename:lineno(function) 4 | 152824 513.894 {method 'sort' of 'list' objects} 5 | 129590630 83.894 rrule.py:842(__cmp__) 6 | 129590630 82.439 {cmp} 7 | 153900 1.296 rrule.py:399(_iter) 8 | 304393/151570 0.963 rrule.py:102(_iter_cached) 9 | -------------------------------------------------------------------------------- /test/markup/yaml/special_chars.txt: -------------------------------------------------------------------------------- 1 | # quoted keys 2 | "*": 3 | - "**/.env" 4 | 5 | # unquoted keys 6 | *: 7 | - "**/.env" 8 | 9 | # special chars in keys: 10 | git@github.com:*/copilot: 11 | - "/__tests__/**" 12 | 13 | # leading special chars in a key 14 | */copilot: 15 | - "/__tests__/**" 16 | 17 | @gitlab.com:gitlab-org/gitlab-runner.git: 18 | - "/__tests__/**" 19 | -------------------------------------------------------------------------------- /src/languages/plaintext.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Plain text 3 | Author: Egor Rogov (e.rogov@postgrespro.ru) 4 | Description: Plain text without any highlighting. 5 | Category: common 6 | */ 7 | 8 | export default function(hljs) { 9 | return { 10 | name: 'Plain text', 11 | aliases: [ 12 | 'text', 13 | 'txt' 14 | ], 15 | disableAutodetect: true 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /test/detect/django/default.txt: -------------------------------------------------------------------------------- 1 | {% if articles|length %} 2 | {% for article in articles %} 3 | 4 | {% custom %} 5 | 6 | {# Striped table #} 7 | 8 | {{ article|default:"Hi... " }} 9 | 10 | Published on {{ article.date }} 11 | 12 | 13 | 14 | {% endfor %} 15 | {% endif %} 16 | -------------------------------------------------------------------------------- /test/detect/sql/default.txt: -------------------------------------------------------------------------------- 1 | CREATE TABLE "topic" ( 2 | "id" integer NOT NULL PRIMARY KEY, 3 | "forum_id" integer NOT NULL, 4 | "subject" varchar(255) NOT NULL 5 | ); 6 | ALTER TABLE "topic" 7 | ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id") 8 | REFERENCES "forum" ("id"); 9 | 10 | -- Initials 11 | insert into "topic" ("forum_id", "subject") 12 | values (2, 'D''artagnian'); 13 | -------------------------------------------------------------------------------- /test/markup/django/default.txt: -------------------------------------------------------------------------------- 1 | {% if articles|length %} 2 | {% for article in articles %} 3 | 4 | {% custom %} 5 | 6 | {# Striped table #} 7 | 8 | {{ article|default:"Hi... " }} 9 | 10 | Published on {{ article.date }} 11 | 12 | 13 | 14 | {% endfor %} 15 | {% endif %} 16 | -------------------------------------------------------------------------------- /test/markup/handlebars/sub-expressions.txt: -------------------------------------------------------------------------------- 1 | {{helper (subExpression 1 2)}} 2 | 3 | {{{helper (subExpression 1 2)}}} 4 | 5 | {{{{#helper (subExpression 1 2)}}}} {{{{/helper}}}} 6 | 7 | {{#helper (subExpression 1 2)}} {{/helper}} 8 | 9 | {{>partial (subExpression 1 2)}} 10 | 11 | {{helper key=(subExpression 1 2)}} 12 | 13 | {{helper (subExpression (canBeNested 1 2) anotherParam)}} 14 | -------------------------------------------------------------------------------- /test/markup/ini/types.txt: -------------------------------------------------------------------------------- 1 | i = 1_234 2 | f = 1.23 3 | f = 7e+12 4 | f = 2e3 5 | f = -1.234e-12 6 | basic = "string" 7 | multi_basic = """multiple 8 | lines""" 9 | literal = 'string' 10 | multi_literal = '''multiple 11 | lines''' 12 | b = true 13 | b = false 14 | b = on 15 | b = off 16 | b = yes 17 | b = no 18 | dotted.key = 1 19 | array = [1, 2, 3] 20 | inline = {name = "foo", id = 123} 21 | -------------------------------------------------------------------------------- /test/detect/css/default.txt: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: Chunkfive; src: url('Chunkfive.otf'); 3 | } 4 | 5 | body, .usertext { 6 | color: #F0F0F0; background: #600; 7 | font-family: Chunkfive, sans; 8 | --heading-1: 30px/32px Helvetica, sans-serif; 9 | } 10 | 11 | @import url(print.css); 12 | @media print { 13 | a[href^=http]::after { 14 | content: attr(href) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/markup/bash/token-containing-keyword.expect.txt: -------------------------------------------------------------------------------- 1 | # a keyword as part of an option 2 | mycmd --disable-foo 3 | 4 | # a keyword as part of a parameter 5 | some-cmd set-some-setting 6 | some-cmd set_some_setting 7 | 8 | # a keyword as part of command 9 | check-case foo 10 | check_case foo 11 | -------------------------------------------------------------------------------- /test/markup/css/pseudo-selector.txt: -------------------------------------------------------------------------------- 1 | li:not(.red){} 2 | li:not(.red):not(.green){} 3 | 4 | :first-child { 5 | padding: 0; 6 | } 7 | 8 | :first-of-type { 9 | padding: 0; 10 | } 11 | 12 | :last-child { 13 | padding: 0; 14 | } 15 | 16 | :last-of-type { 17 | padding: 0; 18 | } 19 | 20 | p::first-letter { 21 | font-size: 1.5rem; 22 | font-weight: bold; 23 | color: brown; 24 | } 25 | -------------------------------------------------------------------------------- /test/markup/rust/variables.expect.txt: -------------------------------------------------------------------------------- 1 | let foo; 2 | let mut bar; 3 | let _foo_bar; 4 | let r#foo; -------------------------------------------------------------------------------- /test/markup/stata/built_ins.expect.txt: -------------------------------------------------------------------------------- 1 | local b1 = ln(`or') 2 | generate logit1 = log( pgty1 / ( 1 - pgty1)) 3 | generate logit2 = log( pgty2 / ( 1 - pgty2)) 4 | -------------------------------------------------------------------------------- /test/markup/typescript/nested-templates.expect.txt: -------------------------------------------------------------------------------- 1 | let foo = true; 2 | `hello ${foo ? `Mr ${name}` : 'there'}`; 3 | foo = false; 4 | -------------------------------------------------------------------------------- /test/detect/typescript/default.txt: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | public static myValue: string; 3 | constructor(init: string) { 4 | this.myValue = init; 5 | } 6 | } 7 | import fs = require("fs"); 8 | module MyModule { 9 | export interface MyInterface extends Other { 10 | myProperty: any; 11 | } 12 | } 13 | declare magicNumber number; 14 | myArray.forEach(() => { }); // fat arrow syntax 15 | -------------------------------------------------------------------------------- /test/markup/erlang/numbers.txt: -------------------------------------------------------------------------------- 1 | Integer = 1234 2 | BigInteger = 1_234_000 3 | NegInteger = -20_000 4 | Float = 2.34 5 | BigFloat = 3_333.14159_26535_89793 6 | SciFloat = 2.4e23 7 | PlusSciFloat = 2.4e+23 8 | SmallSciFloat = 2.4e-23 9 | Binary = 2#1010 10 | StrangeBinary = 2#1010_1010_1010 11 | Octal = 8#777 12 | StrangeOctal = 8#777_666_555 13 | Hex = 16#1ABEF 14 | StrangeHex = 16#1234_FACE_987D 15 | -------------------------------------------------------------------------------- /test/markup/swift/macro.txt: -------------------------------------------------------------------------------- 1 | macro warning(_ message: String) = #externalMacro(module: "MyMacros", type: "WarningMacro") 2 | 3 | @freestanding(declaration) 4 | macro error(_ message: String) = #externalMacro(module: "MyMacros", type: "ErrorMacro") 5 | 6 | @attached(member) 7 | macro OptionSetMembers() 8 | 9 | @attached(peer, names: overloaded) 10 | macro OptionSetMembers() 11 | 12 | #myMacro() 13 | -------------------------------------------------------------------------------- /test/markup/vbnet/literals.txt: -------------------------------------------------------------------------------- 1 | Dim c1 = "1"c 2 | Dim c2 = "1"C 3 | Dim c3 = """"C 4 | 5 | Dim s1 = "123" 6 | Dim s2 = """1""" 7 | 8 | Dim d1 = #2020-11-11# 9 | Dim d1 = #2020-1-1# 10 | Dim d2 = #5/5/2005# 11 | Dim d3 = #13:13:13# 12 | Dim d4 = #13:13# 13 | Dim d5 = #1:13:13 AM# 14 | Dim d6 = #1:13 AM# 15 | Dim d7 = #1 AM# 16 | Dim d10 = #2020-11-11 13:13:13# 17 | Dim d11 = #5/5/2005 1:13:13 AM# 18 | -------------------------------------------------------------------------------- /test/detect/haml/default.txt: -------------------------------------------------------------------------------- 1 | !!! XML 2 | %html 3 | %body 4 | %h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js 5 | /html comment 6 | -# ignore this line 7 | %ul(style='margin: 0') 8 | -items.each do |i| 9 | %i= i 10 | = variable 11 | =variable2 12 | ~ variable3 13 | ~variable4 14 | The current year is #{DataTime.now.year}. 15 | -------------------------------------------------------------------------------- /test/detect/pgsql/default.txt: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | SELECT sum(salary) OVER w, avg(salary) OVER w 3 | FROM empsalary 4 | WINDOW w AS (PARTITION BY depname ORDER BY salary DESC); 5 | END; 6 | 7 | CREATE FUNCTION days_of_week() RETURNS SETOF text AS $$ 8 | BEGIN 9 | FOR i IN 7 .. 13 LOOP 10 | RETURN NEXT to_char(to_date(i::text,'J'),'TMDy'); 11 | END LOOP; 12 | END; 13 | $$ STABLE LANGUAGE plpgsql; 14 | -------------------------------------------------------------------------------- /test/markup/diff/comments.txt: -------------------------------------------------------------------------------- 1 | Index: languages/demo.js 2 | =================================================================== 3 | diff --git a/file.txt b/file.txt 4 | --- languages/demo.js (revision 199) 5 | +++ languages/demo.js (revision 200) 6 | @@ -1,8 +1,7 @@ 7 | + Here we highlight correctly 8 | ==== 9 | + Here too 10 | ===== 11 | + Here we don't anymore after five '=' next to each other 12 | -------------------------------------------------------------------------------- /test/markup/haml/default.txt: -------------------------------------------------------------------------------- 1 | !!! XML 2 | %html 3 | %body 4 | %h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js 5 | /html comment 6 | -# ignore this line 7 | %ul(style='margin: 0') 8 | -items.each do |i| 9 | %i= i 10 | = variable 11 | =variable2 12 | ~ variable3 13 | ~variable4 14 | The current year is #{DataTime.now.year}. 15 | -------------------------------------------------------------------------------- /test/markup/swift/tuples.txt: -------------------------------------------------------------------------------- 1 | (3, "string") 2 | (c: (x: 1, y: 1), z: 1) 3 | (var: Array, let: Array) 4 | (_ x: inout Int) throws -> Int 5 | (abs(-2), abs(2)) 6 | (x < y, a > b) 7 | ($0, $1) 8 | (@escaping (String) -> Void, @autoclosure () -> String) -> String 9 | ( 10 | // x 11 | x, 12 | /* y */ 13 | y 14 | ) 15 | (let x, var y) 16 | ([key: value, key: value]) 17 | (/my regex/) 18 | -------------------------------------------------------------------------------- /test/markup/csharp/try-catch.expect.txt: -------------------------------------------------------------------------------- 1 | try 2 | { 3 | throw new InvalidCastException(); 4 | } 5 | catch (InvalidCastException e) when (e.Data != null) 6 | { 7 | throw; 8 | } 9 | -------------------------------------------------------------------------------- /test/markup/ebnf/terminators.expect.txt: -------------------------------------------------------------------------------- 1 | full-stop = "." . 2 | semicolon = ";" ; 3 | end-test = "end" ; (* ending production to test semicolon *) 4 | -------------------------------------------------------------------------------- /test/markup/handlebars/raw-block.expect.txt: -------------------------------------------------------------------------------- 1 | {{{{#raw}}}} {{verbatim}} content {{{{/raw}}}} {{var}} 2 | -------------------------------------------------------------------------------- /test/markup/objectivec/preprocessor.txt: -------------------------------------------------------------------------------- 1 | #include 2 | #define foo 1<<16 3 | 4 | #ifdef DEBUG 5 | TYPE1 foo(void) 6 | #else 7 | int foo(void) 8 | #endif 9 | { } 10 | 11 | #define x(v) ((v)) 12 | # define x(v) ((v)) 13 | # define x(v) ((v)) 14 | 15 | #if MACRO_WITH_STRING_ARG("hello \"world\"") 16 | #elif MULTI_LINE /* comment */ < \ 17 | EXPRESSION 18 | int bar; 19 | #endif // comment 20 | -------------------------------------------------------------------------------- /test/markup/taggerscript/functions.expect.txt: -------------------------------------------------------------------------------- 1 | text$func( 2 | par1$noop(comment),\), 3 | $func(%abc%,xyz), 4 | $noopnot(not a comment$noop(proper\( comment)) 5 | )text 6 | -------------------------------------------------------------------------------- /test/markup/ocaml/types.txt: -------------------------------------------------------------------------------- 1 | (* type variables *) 2 | type 'a t = 'a list 3 | let f (a : 'a list) : 'a = List.hd a 4 | 5 | (* polymorphic variants *) 6 | type t = [ `A | `B ] 7 | 8 | (* variants *) 9 | type result = Sat | Unsat | Unknown 10 | 11 | (* module and module types *) 12 | module type S = sig 13 | val compute : unit -> unit 14 | end 15 | module Impl : S = struct 16 | let compute () = () 17 | end 18 | -------------------------------------------------------------------------------- /test/detect/processing/default.txt: -------------------------------------------------------------------------------- 1 | import java.util.LinkedList; 2 | import java.awt.Point; 3 | 4 | PGraphics pg; 5 | String load; 6 | 7 | void setup() { 8 | size(displayWidth, displayHeight, P3D); 9 | pg = createGraphics(displayWidth*2,displayHeight,P2D); 10 | pg.beginDraw(); 11 | pg.background(255,255,255); 12 | //pg.smooth(8); 13 | pg.endDraw(); 14 | } 15 | void draw(){ 16 | background(255); 17 | } 18 | -------------------------------------------------------------------------------- /test/markup/cpp/expression-keywords.expect.txt: -------------------------------------------------------------------------------- 1 | double x = exp(log(2)); // recognize built-ins 2 | return 0; // recognize keyword that started the expression 3 | -------------------------------------------------------------------------------- /test/markup/http/http3.txt: -------------------------------------------------------------------------------- 1 | HTTP/3 200 2 | content-encoding: gzip 3 | accept-ranges: bytes 4 | age: 361798 5 | cache-control: max-age=604800 6 | content-type: text/html; charset=UTF-8 7 | date: Sat, 21 Jan 2023 12:31:21 GMT 8 | etag: "3147526947+ident" 9 | expires: Sat, 28 Jan 2023 12:31:21 GMT 10 | last-modified: Thu, 17 Oct 2019 07:18:26 GMT 11 | server: ECS (dcb/7ECB) 12 | x-cache: HIT 13 | content-length: 648 14 | -------------------------------------------------------------------------------- /test/markup/processing/default.txt: -------------------------------------------------------------------------------- 1 | import java.util.LinkedList; 2 | import java.awt.Point; 3 | 4 | PGraphics pg; 5 | String load; 6 | 7 | void setup() { 8 | size(displayWidth, displayHeight, P3D); 9 | pg = createGraphics(displayWidth*2,displayHeight,P2D); 10 | pg.beginDraw(); 11 | pg.background(255,255,255); 12 | //pg.smooth(8); 13 | pg.endDraw(); 14 | } 15 | void draw(){ 16 | background(255); 17 | } 18 | -------------------------------------------------------------------------------- /test/markup/ldif/ldapmodify.expect.txt: -------------------------------------------------------------------------------- 1 | dn: uid=user.0,ou=People,dc=example,dc=com 2 | changeType: modify 3 | add: cn 4 | cn: Morris Day 5 | - 6 | add: mobile 7 | mobile: (408) 555-7844 8 | -------------------------------------------------------------------------------- /test/markup/scala/transparent.expect.txt: -------------------------------------------------------------------------------- 1 | transparent inline def f() = 42 2 | transparent trait S 3 | -------------------------------------------------------------------------------- /test/markup/typescript/namespace_as_identifier.expect.txt: -------------------------------------------------------------------------------- 1 | 2 | const message = 'foo'; 3 | const namespace = 'bar'; 4 | function baz() {} -------------------------------------------------------------------------------- /test/markup/typescript/satisfies-and-as.expect.txt: -------------------------------------------------------------------------------- 1 | const test3 = 'test3' as ValidName 2 | const test4 = 'test4' satisfies ValidName 3 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ### Changes 7 | 8 | 9 | ### Checklist 10 | - [ ] Added markup tests, or they don't apply here because... 11 | - [ ] Updated the changelog at `CHANGES.md` 12 | -------------------------------------------------------------------------------- /test/detect/hsp/default.txt: -------------------------------------------------------------------------------- 1 | #include "foo.hsp" 2 | 3 | // line comment 4 | message = "Hello, World!" 5 | message2 = {"Multi 6 | line 7 | string"} 8 | num = 0 9 | mes message 10 | 11 | input num : button "sqrt", *label 12 | stop 13 | 14 | *label 15 | /* 16 | block comment 17 | */ 18 | if(num >= 0) { 19 | dialog "sqrt(" + num + ") = " + sqrt(num) 20 | } else { 21 | dialog "error", 1 22 | } 23 | stop 24 | -------------------------------------------------------------------------------- /test/detect/java/default.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * @author John Smith 3 | */ 4 | package l2f.gameserver.model; 5 | 6 | public abstract strictfp class L2Char extends L2Object { 7 | public static final Short ERROR = 0x0001; 8 | 9 | public void moveTo(int x, int y, int z) { 10 | _ai = null; 11 | log("Should not be called"); 12 | if (1 > 5) { // wtf!? 13 | return; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/detect/vim/default.txt: -------------------------------------------------------------------------------- 1 | if foo > 2 || has("gui_running") 2 | syntax on 3 | set hlsearch 4 | endif 5 | 6 | set autoindent 7 | 8 | " switch on highlighting 9 | function UnComment(fl, ll) 10 | while idx >= a:ll 11 | let srclines=getline(idx) 12 | let dstlines=substitute(srclines, b:comment, "", "") 13 | call setline(idx, dstlines) 14 | endwhile 15 | endfunction 16 | 17 | let conf = {'command': 'git'} 18 | -------------------------------------------------------------------------------- /test/markup/hsp/default.txt: -------------------------------------------------------------------------------- 1 | #include "foo.hsp" 2 | 3 | // line comment 4 | message = "Hello, World!" 5 | message2 = {"Multi 6 | line 7 | string"} 8 | num = 0 9 | mes message 10 | 11 | input num : button "sqrt", *label 12 | stop 13 | 14 | *label 15 | /* 16 | block comment 17 | */ 18 | if(num >= 0) { 19 | dialog "sqrt(" + num + ") = " + sqrt(num) 20 | } else { 21 | dialog "error", 1 22 | } 23 | stop 24 | -------------------------------------------------------------------------------- /test/markup/kotlin/nested_comment.expect.txt: -------------------------------------------------------------------------------- 1 | /* begin comment at LEVEL 0 2 | /* 3 | multiline nested comment LEVEL 1 4 | */ 5 | println("on kotlin this is a commented code in comment LEVEL 0") 6 | /* 7 | another multiline nested comment LEVEL 1 8 | */ 9 | end comment at LEVEL 0 */ 10 | -------------------------------------------------------------------------------- /test/markup/vim/default.txt: -------------------------------------------------------------------------------- 1 | if foo > 2 || has("gui_running") 2 | syntax on 3 | set hlsearch 4 | endif 5 | 6 | set autoindent 7 | 8 | " switch on highlighting 9 | function UnComment(fl, ll) 10 | while idx >= a:ll 11 | let srclines=getline(idx) 12 | let dstlines=substitute(srclines, b:comment, "", "") 13 | call setline(idx, dstlines) 14 | endwhile 15 | endfunction 16 | 17 | let conf = {'command': 'git'} 18 | -------------------------------------------------------------------------------- /test/detect/autoit/default.txt: -------------------------------------------------------------------------------- 1 | #NoTrayIcon 2 | #AutoIt3Wrapper_Run_Tidy=Y 3 | #include 4 | 5 | _Singleton(@ScriptName) ; Allow only one instance 6 | example(0, 10) 7 | 8 | Func example($min, $max) 9 | For $i = $min To $max 10 | If Mod($i, 2) == 0 Then 11 | MsgBox(64, "Message", $i & ' is even number!') 12 | Else 13 | MsgBox(64, "Message", $i & ' is odd number!') 14 | EndIf 15 | Next 16 | EndFunc ;==>example -------------------------------------------------------------------------------- /test/markup/autoit/default.txt: -------------------------------------------------------------------------------- 1 | #NoTrayIcon 2 | #AutoIt3Wrapper_Run_Tidy=Y 3 | #include 4 | 5 | _Singleton(@ScriptName) ; Allow only one instance 6 | example(0, 10) 7 | 8 | Func example($min, $max) 9 | For $i = $min To $max 10 | If Mod($i, 2) == 0 Then 11 | MsgBox(64, "Message", $i & ' is even number!') 12 | Else 13 | MsgBox(64, "Message", $i & ' is odd number!') 14 | EndIf 15 | Next 16 | EndFunc ;==>example -------------------------------------------------------------------------------- /test/markup/fsharp/attributes.expect.txt: -------------------------------------------------------------------------------- 1 | // Strings and numbers are highlighted inside the attribute 2 | [<Foo>] 3 | [<Bar("bar"); Foo(1, 2)>] 4 | let x () = () -------------------------------------------------------------------------------- /test/markup/javascript/object-attr.txt: -------------------------------------------------------------------------------- 1 | { 2 | key: value, // with comment 3 | key2: value, 4 | key2clone: value, 5 | 'key-3': value, 6 | key4: false ? undefined : true, 7 | key5: value, /* with a multiline comment */ 8 | key6: value, 9 | key7: value, /* with a multiline comment */ // another comment 10 | key8: value, 11 | key9: value, /* with a REAL multiline 12 | comment */ 13 | key10: value, 14 | } 15 | 16 | -------------------------------------------------------------------------------- /test/markup/ruby/blocks.expect.txt: -------------------------------------------------------------------------------- 1 | [1, 2, 3].each do |num| 2 | puts num 3 | end 4 | 5 | names |= users.map do |user| 6 | user.name 7 | end 8 | -------------------------------------------------------------------------------- /test/markup/coffeescript/division.expect.txt: -------------------------------------------------------------------------------- 1 | # Divisions 2 | x = 6/foo/i 3 | x = 6 /foo 4 | x = 6 / foo 5 | x = 6 /foo * 2/gm 6 | x = f /foo 7 | x = f / foo / gm 8 | x = f /foo * 2/6 9 | -------------------------------------------------------------------------------- /test/markup/dart/string-interpolation.expect.txt: -------------------------------------------------------------------------------- 1 | '1234$identifier $true'; 2 | // comment 3 | '1234${1234 + true + 'foo'}'; 4 | -------------------------------------------------------------------------------- /test/markup/elixir/function-not-regex.expect.txt: -------------------------------------------------------------------------------- 1 | import Kernel, except: [ 2 | spawn: 1, 3 | +: 2, 4 | /: 2, 5 | unless: 2 6 | ] 7 | -------------------------------------------------------------------------------- /test/markup/pony/number-literals.txt: -------------------------------------------------------------------------------- 1 | let num: U32 = 42_000 2 | let num: U32 = 42_000_ 3 | let num: U32 = 42_000.234 4 | let num: U8 = 1 5 | let num: F32 = 1.234 6 | let num: I32 = 1024 7 | let num: I32 = -1024 8 | let num: I32 = 0x400 9 | let num: I32 = 0X400 10 | let num: I32 = 0b10101010 11 | let num: I32 = 0B1010101 12 | let num: F32 = 42.12e-4 13 | let num: F32 = 42.12E-4 14 | let num: F32 = 42.12e+4 15 | let num: F32 = 42.12E+4 16 | -------------------------------------------------------------------------------- /test/markup/xquery/direct_method.txt: -------------------------------------------------------------------------------- 1 | xquery version "3.1"; 2 | let $var := "rooting" out 1 or 2 root causes 3 | return 4 | 5 | disable highlight for a name such as root { 6 | for $name in $var 7 | return 8 | $name as xs:string 9 | } 10 | return to unhighlighted order of things. 11 | "rooting" out root causes 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/nested.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var BODY = { 3 | className: 'body', endsWithParent: true 4 | }; 5 | var LIST = { 6 | className: 'list', 7 | variants: [ 8 | {begin: /\(/, end: /\)/}, 9 | {begin: /\[/, end: /\]/} 10 | ], 11 | contains: [BODY] 12 | }; 13 | BODY.contains = [LIST]; 14 | return { 15 | disableAutodetect: true, 16 | contains: [LIST] 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /test/markup/sql/string-types.expect.txt: -------------------------------------------------------------------------------- 1 | SELECT '\'; 2 | 3 | -- this is not a string in SQL, it's an identifier 4 | SELECT "name" from users; 5 | 6 | -- not in the SQL spec 7 | SELECT `\`; 8 | -------------------------------------------------------------------------------- /test/markup/swift/distributed-actor-runtime.expect.txt: -------------------------------------------------------------------------------- 1 | distributed actor Foobar { 2 | distributed func baz() { 3 | } 4 | 5 | func qux() { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/markup/x86asm/labels-directives.expect.txt: -------------------------------------------------------------------------------- 1 | .cfi_startproc 2 | _ZN3lib13is_whitespace17h28afa23272bf056bE: 3 | .align 16, 0x90 4 | ja .Lfunc_end0 5 | .Lfunc_end0: 6 | ret 7 | -------------------------------------------------------------------------------- /test/builds/rollup_import_via_commonjs.mjs: -------------------------------------------------------------------------------- 1 | // rollup.config.js 2 | import commonjs from '@rollup/plugin-commonjs'; 3 | 4 | export default { 5 | input: 'test/builds/package.js', 6 | output: { 7 | file: 'build/bundle.js', 8 | format: 'iife' 9 | }, 10 | plugins: [ 11 | commonjs({ 12 | include: 'build/**', // Default: undefined 13 | exclude: [ 'node_modules/**' ], // Default: undefined 14 | }) 15 | ] 16 | }; 17 | -------------------------------------------------------------------------------- /test/detect/erlang-repl/default.txt: -------------------------------------------------------------------------------- 1 | 1> Str = "abcd". 2 | "abcd" 3 | 2> L = test:length(Str). 4 | 4 5 | 3> Descriptor = {L, list_to_atom(Str)}. 6 | {4,abcd} 7 | 4> L. 8 | 4 9 | 5> b(). 10 | Descriptor = {4,abcd} 11 | L = 4 12 | Str = "abcd" 13 | ok 14 | 6> f(L). 15 | ok 16 | 7> b(). 17 | Descriptor = {4,abcd} 18 | Str = "abcd" 19 | ok 20 | 8> {L, _} = Descriptor. 21 | {4,abcd} 22 | 9> L. 23 | 4 24 | 10> 2#101. 25 | 5 26 | 11> 1.85e+3. 27 | 1850 28 | -------------------------------------------------------------------------------- /test/markup/bash/strings.txt: -------------------------------------------------------------------------------- 1 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 2 | TLS_DIR="$SCRIPT_DIR/../src/main/resources/tls" 3 | ROOT_DIR="$SCRIPT_DIR/.." 4 | 5 | jshell -s - << EOF 6 | System.out.printf("Procs: %s%n", getdata()) 7 | EOF 8 | 9 | jshell -s - <<<'System.out.printf("Procs: %s%n", getdata())' 10 | 11 | cat <<< '$VARIABLE' 12 | cat <<< "$VARIABLE" 13 | cat <<< $VARIABLE 14 | cat <<< `$VARIABLE` 15 | -------------------------------------------------------------------------------- /test/markup/crystal/operators.expect.txt: -------------------------------------------------------------------------------- 1 | + 2 | - 3 | * 4 | % 5 | & 6 | | 7 | ^ 8 | ** 9 | << 10 | >> 11 | == 12 | != 13 | < 14 | <= 15 | > 16 | >= 17 | <=> 18 | === 19 | // 20 | //= 21 | &+ 22 | &- 23 | &* 24 | &** 25 | &+= 26 | &-= 27 | &*= 28 | ! 29 | ~ 30 | [] 31 | []? 32 | []= 33 | / 34 | -------------------------------------------------------------------------------- /test/markup/erlang-repl/default.txt: -------------------------------------------------------------------------------- 1 | 1> Str = "abcd". 2 | "abcd" 3 | 2> L = test:length(Str). 4 | 4 5 | 3> Descriptor = {L, list_to_atom(Str)}. 6 | {4,abcd} 7 | 4> L. 8 | 4 9 | 5> b(). 10 | Descriptor = {4,abcd} 11 | L = 4 12 | Str = "abcd" 13 | ok 14 | 6> f(L). 15 | ok 16 | 7> b(). 17 | Descriptor = {4,abcd} 18 | Str = "abcd" 19 | ok 20 | 8> {L, _} = Descriptor. 21 | {4,abcd} 22 | 9> L. 23 | 4 24 | 10> 2#101. 25 | 5 26 | 11> 1.85e+3. 27 | 1850 28 | -------------------------------------------------------------------------------- /test/markup/groovy/oneoffs.expect.txt: -------------------------------------------------------------------------------- 1 | // ternary can include quotes 2 | def formattingMsg = label < 0 ? ('The following files need formatting:\n ' + 3 | codeStyleFiles.join('\n ')) : 'All files are correctly formatted' 4 | -------------------------------------------------------------------------------- /test/markup/powershell/apos-herestring.expect.txt: -------------------------------------------------------------------------------- 1 | @' The wild cat jumped over the $height-tall fence. 2 | He did so with grace. 3 | '@ 4 | 5 | This SHOULDNT be a part of the above strings span. 6 | 7 | @' The wild cat jumped over the $height-tall fence. 8 | He did so with grace. 9 | break-end-of-string'@ 10 | 11 | This SHOULD be a part of the above strings span. -------------------------------------------------------------------------------- /test/markup/verilog/numbers.expect.txt: -------------------------------------------------------------------------------- 1 | a = 'hff; 2 | A = 'HFF; 3 | b = 8'h33; 4 | B = 8'H33; 5 | c = 12; 6 | d = 'o755; 7 | e = 8'b1001_0001; 8 | f = 8'b1111zzzx; 9 | -------------------------------------------------------------------------------- /test/builds/rollup_import_cdn_build_esm.mjs: -------------------------------------------------------------------------------- 1 | // rollup.config.js 2 | import commonjs from "@rollup/plugin-commonjs"; 3 | 4 | export default { 5 | input: "test/builds/cdn_build_as_esm.mjs", 6 | output: { 7 | file: "build/bundle.js", 8 | format: "iife", 9 | }, 10 | plugins: [ 11 | commonjs({ 12 | include: "build/**", // Default: undefined 13 | exclude: ["node_modules/**"], // Default: undefined 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /test/detect/pony/default.txt: -------------------------------------------------------------------------------- 1 | use "collections" 2 | 3 | class StopWatch 4 | """ 5 | A simple stopwatch class for performance micro-benchmarking 6 | """ 7 | var _s: U64 = 0 8 | 9 | fun delta(): U64 => 10 | Time.nanos() - _s 11 | 12 | actor LonelyPony 13 | """ 14 | A simple manifestation of the lonely pony problem 15 | """ 16 | var env: Env 17 | let sw: StopWatch = StopWatch 18 | 19 | new create(env': Env) => 20 | env = env 21 | -------------------------------------------------------------------------------- /test/detect/powershell/default.txt: -------------------------------------------------------------------------------- 1 | $initialDate = [datetime]'2013/1/8' 2 | 3 | $rollingDate = $initialDate 4 | 5 | do { 6 | $client = New-Object System.Net.WebClient 7 | $results = $client.DownloadString("http://not.a.real.url") 8 | Write-Host "$rollingDate.ToShortDateString() - $results" 9 | $rollingDate = $rollingDate.AddDays(21) 10 | $username = [System.Environment]::UserName 11 | } until ($rollingDate -ge [datetime]'2013/12/31') 12 | -------------------------------------------------------------------------------- /test/markup/csharp/generic_modifiers.txt: -------------------------------------------------------------------------------- 1 | interface IObserver; 2 | {} 3 | 4 | interface IObservable; 5 | {} 6 | 7 | public delegate void DContravariant(A argument); 8 | 9 | public delegate A DCovariant(); 10 | 11 | void MethodWithGenericParameter(); 12 | 13 | private static List leftHalfDiamond = new List(); 14 | 15 | private static List> leftHalfDiamond = new List>(); 16 | -------------------------------------------------------------------------------- /test/markup/perl/number.txt: -------------------------------------------------------------------------------- 1 | use v5.38; 2 | use 5.0020; 3 | 4 | my $number = 9; 5 | $number = 0; 6 | $number = 0_; 7 | $number = 00; 8 | $number = 0.99; 9 | $number = 99; 10 | $number = 99.9; 11 | $number = 99.99; 12 | $number = ._99; 13 | $number = 0x99FF; 14 | $number = 0x99_EE_FF; 15 | $number = 0x_99_FF; 16 | $number = 0b00101011; 17 | $number = 0b0010_1011; 18 | $number = 0b_0010_1011; 19 | $number = 0777; 20 | $number = 07_7_7; 21 | $number = 0_777; 22 | -------------------------------------------------------------------------------- /test/markup/swift/operator-declarations.expect.txt: -------------------------------------------------------------------------------- 1 | prefix operator +++ 2 | postfix operator +++ 3 | infix operator +-: AdditionPrecedence 4 | -------------------------------------------------------------------------------- /test/builds/rollup_import_node_build_esm.mjs: -------------------------------------------------------------------------------- 1 | // rollup.config.js 2 | import commonjs from "@rollup/plugin-commonjs"; 3 | 4 | export default { 5 | input: "test/builds/node_build_as_esm.mjs", 6 | output: { 7 | file: "build/bundle.js", 8 | format: "iife", 9 | }, 10 | plugins: [ 11 | commonjs({ 12 | include: "build/**", // Default: undefined 13 | exclude: ["node_modules/**"], // Default: undefined 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /test/markup/javascript/method-call.expect.txt: -------------------------------------------------------------------------------- 1 | x.continue(0); 2 | 3 | x = [ 4 | hljs.COMMENT(/\{%\s*comment\s*%}/, /\{%\s*endcomment\s*%}/), 5 | hljs.COMMENT(/\{#/, /#}/), 6 | ] 7 | 8 | -------------------------------------------------------------------------------- /test/markup/tcl/variables.txt: -------------------------------------------------------------------------------- 1 | $name 2 | ${name} 3 | ${::name} 4 | ${::namespace::name} 5 | ${::namespace::another::name} 6 | 7 | $name() 8 | $name(32) 9 | $name(index) 10 | 11 | $with_underscore::oth_er::and_finally(32) 12 | 13 | ${name()} 14 | ${name(32)} 15 | ${name(index)} 16 | 17 | ${ns::other::name()} 18 | ${ns::other::name(32)} 19 | ${ns::other::name(index)} 20 | 21 | 22 | $ns::other::name() 23 | $ns::other::name(32) 24 | $ns::other::name(index) 25 | -------------------------------------------------------------------------------- /test/markup/javascript/seperated-parameters.expect.txt: -------------------------------------------------------------------------------- 1 | function visibleTodoFilter (state = 'watch', action) {} 2 | 3 | function visibleTodoFilter (state, action) { 4 | // ... 5 | } 6 | -------------------------------------------------------------------------------- /test/markup/json/comments.txt: -------------------------------------------------------------------------------- 1 | /* multi-line comment before */ 2 | [ 3 | { 4 | "title": "apples", // yum 5 | "count": [12000, 20000], /* so many? */ 6 | "description": {"text": "...", "sensitive": false} 7 | }, 8 | { 9 | "title": "oranges", 10 | "count": [17500, null], 11 | "description": {"text": "...", "sensitive": false} 12 | } 13 | // { 14 | // "title" : "brocolli" 15 | // } 16 | ] 17 | /* multi-line 18 | comment after */ 19 | -------------------------------------------------------------------------------- /test/markup/pony/method.expect.txt: -------------------------------------------------------------------------------- 1 | fun foo(bar: String): String => 2 | bar + "baz" 3 | 4 | new create(hunger: I32) => 5 | _hunger = hunger 6 | 7 | be feed(food: I32) => 8 | _hunger = _hunger - food -------------------------------------------------------------------------------- /test/markup/sql/functions.expect.txt: -------------------------------------------------------------------------------- 1 | select CURRENT_CATALOG, 2 | CURRENT_USER, 3 | CURRENT_TIME, 4 | CURRENT_TIME(), 5 | CURRENT_TIMESTAMP, 6 | CURRENT_TIMESTAMP() 7 | FROM sys; 8 | -------------------------------------------------------------------------------- /test/markup/xml/non-ascii-element-names.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | sofá 4 | mueble 5 | Asiento cómodo para dos o más personas, que tiene respaldo y brazos. 6 | 7 | 8 | sillón 9 | mueble 10 | Silla de brazos, mayor y más cómoda que la ordinaria. 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/detect/ada/default.txt: -------------------------------------------------------------------------------- 1 | package body Sqlite.Simple is 2 | 3 | Foo : int := int'Size; 4 | Bar : int := long'Size; 5 | 6 | Error_Message_C : chars_ptr := Sqlite_Errstr (Error); 7 | Error_Message : String := Null_Ignore_Value (Error_Message_C); 8 | begin 9 | 10 | Named : for Index in Foo..Bar loop 11 | Put ("Hi[]{}"); 12 | end loop Named; 13 | 14 | Foo := Bar; 15 | end Message; 16 | 17 | end Sqlite.Simple; 18 | -------------------------------------------------------------------------------- /test/markup/crystal/toplevel-keywords.expect.txt: -------------------------------------------------------------------------------- 1 | class Foo; end 2 | struct Bar; end 3 | 4 | annotation JSON::Field; end 5 | -------------------------------------------------------------------------------- /test/markup/java/titles.txt: -------------------------------------------------------------------------------- 1 | public class Greet { 2 | public Either f(int val) { 3 | new Type(); 4 | if (val) { 5 | return getType(); 6 | } else if (!val) { 7 | throw getError(); 8 | } 9 | } 10 | } 11 | 12 | sealed interface Command permits LoginCommand { 13 | void run(); 14 | } 15 | 16 | non-sealed abstract class UserPluginCommand extends Command { 17 | void runAsUser(); 18 | } 19 | -------------------------------------------------------------------------------- /test/markup/python/decorators.txt: -------------------------------------------------------------------------------- 1 | @foo 2 | def bar(): 3 | pass 4 | 5 | @foo # bar 6 | def baz(): 7 | pass 8 | 9 | @foo.bar.baz 10 | def qux(): 11 | pass 12 | 13 | @surround_with("#", repeat=3) 14 | def text(): 15 | return "hi!" 16 | 17 | @py38.style 18 | def func(): 19 | pass 20 | 21 | @py["3.9"].style 22 | def func(): 23 | pass 24 | 25 | @py[3.9].style 26 | def func(): 27 | pass 28 | 29 | @2 + 2 == 5 30 | def func(): 31 | pass 32 | -------------------------------------------------------------------------------- /test/browser/plain.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const {newTestCase, defaultCase, buildFakeDOM } = require('./test_case') 4 | 5 | describe('plain browser', function() { 6 | 7 | it('should return relevance key', async function() { 8 | await buildFakeDOM.bind(this, defaultCase)(); 9 | var out = this.hljs.highlight("", { language: "javascript" }); 10 | out.relevance.should.equal(0); 11 | }); 12 | 13 | it('should highlight block', defaultCase.runner); 14 | }); 15 | -------------------------------------------------------------------------------- /test/markup/maxima/symbols.txt: -------------------------------------------------------------------------------- 1 | /* symbolic constants */ 2 | 3 | [true, false, unknown, inf, minf, ind, 4 | und, %e, %i, %pi, %phi, %gamma]; 5 | 6 | /* built-in variables */ 7 | 8 | [_, __, %, %%, linel, simp, dispflag, 9 | stringdisp, lispdisp, %edispflag]; 10 | 11 | /* built-in functions */ 12 | 13 | [sin, cosh, exp, atan2, sqrt, log, struve_h, 14 | sublist_indices, read_array]; 15 | 16 | /* user-defined symbols */ 17 | 18 | [foo, ?bar, baz%, quux_mumble_blurf]; 19 | -------------------------------------------------------------------------------- /test/markup/reasonml/modules.txt: -------------------------------------------------------------------------------- 1 | let decode = json => 2 | Json.Decode.{ 3 | query: json |> field("query", string), 4 | cacheKey: json |> field("cacheKey", string), 5 | desc: json |> field("desc", string), 6 | lambda: json |> field("lambda", string), 7 | }; 8 | 9 | Some.Bucket.Of.( 10 | let value = stuff(); 11 | ); 12 | 13 | let value = Some.Bucket.Of.stuff(); 14 | 15 | module type RewiredModule = { 16 | type t = { 17 | name: string 18 | }; 19 | }; -------------------------------------------------------------------------------- /test/markup/ada/default.txt: -------------------------------------------------------------------------------- 1 | package body Sqlite.Simple is 2 | 3 | Foo : int := int'Size; 4 | Bar : int := long'Size; 5 | 6 | Error_Message_C : chars_ptr := Sqlite_Errstr (Error); 7 | Error_Message : String := Null_Ignore_Value (Error_Message_C); 8 | begin 9 | 10 | Named : parallel for Index in Foo..Bar loop 11 | Put ("Hi[]{}"); 12 | end loop Named; 13 | 14 | Foo := Bar; 15 | end Message; 16 | 17 | end Sqlite.Simple; 18 | -------------------------------------------------------------------------------- /test/markup/csharp/floats.expect.txt: -------------------------------------------------------------------------------- 1 | float test = 1.0f; 2 | float test2 = 1.f; 3 | float test3 = 1.0; 4 | float test4 = 1; 5 | float test5 = 1_000; 6 | 7 | -------------------------------------------------------------------------------- /test/markup/delphi/character-string.txt: -------------------------------------------------------------------------------- 1 | const 2 | CDecimalCharacterString = #123; 3 | CHexadecimalCharacterString = #$7B; 4 | COctalCharacterString = #&123; 5 | CBinaryCharacterString = #%1111011; 6 | 7 | CDecimalCharacterStringWithSeparator = #1_23; 8 | CHexadecimalCharacterStringWithSeparator = #$7_B; 9 | COctalCharacterStringWithSeparator = #&123; 10 | CBinaryCharacterStringWithSeparator = #%1_111011; 11 | 12 | CMultipleCharacterStrings = #123#$ABC#&765#%0011001; -------------------------------------------------------------------------------- /test/fixtures/expect/useBr.txt: -------------------------------------------------------------------------------- 1 | <head>
    <meta charset="utf-8">
    <title></title>
    </head> 2 | -------------------------------------------------------------------------------- /test/markup/properties/syntax.txt: -------------------------------------------------------------------------------- 1 | # comment 2 | # comment 3 | ! comment 4 | ! comment 5 | key=val 6 | key = val 7 | key:val 8 | key : val 9 | key val 10 | key val 11 | key = val\ 12 | val 13 | key\ key\:\= val 14 | key 15 | # if the number of backslashes at the end of the line is even, the next line is not included in the value 16 | key = val\\ 17 | key = diffValue\\\\ 18 | # val with odd number of backslash, here val2 is part of the key 19 | key = val\\\ 20 | val2 21 | -------------------------------------------------------------------------------- /test/markup/python/matrix-multiplication.expect.txt: -------------------------------------------------------------------------------- 1 | @meta 2 | class C: 3 | 4 | @decorator 5 | def f(self, H, V, beta, r): 6 | S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r) 7 | return S 8 | -------------------------------------------------------------------------------- /test/markup/shell/command-continuation.txt: -------------------------------------------------------------------------------- 1 | $ docker run \ 2 | --publish=7474:7474 --publish=7687:7687 \ 3 | --volume=/neo4j/data:/data \ 4 | --volume=/neo4j/plugins:/plugins \ 5 | --volume=/neo4j/conf:/conf \ 6 | --volume=/logs/neo4j:/logs \ 7 | --user="$(id -u neo4j):$(id -g neo4j)" \ 8 | --group-add=$groups \ 9 | neo4j:3.4 10 | > /bin/cat \.travis.yml\ 11 | -b | head -n1 12 | 1 language: node_js 13 | > echo 'hello' 14 | hello 15 | -------------------------------------------------------------------------------- /test/detect/csharp/default.txt: -------------------------------------------------------------------------------- 1 | using System.IO.Compression; 2 | 3 | #pragma warning disable 414, 3021 4 | 5 | namespace MyApplication 6 | { 7 | [Obsolete("...")] 8 | class Program : IInterface 9 | { 10 | public static List JustDoIt(int count) 11 | { 12 | Span numbers = stackalloc int[length]; 13 | Console.WriteLine($"Hello {Name}!"); 14 | return new List(new int[] { 1, 2, 3 }) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/markup/javascript/built-in.expect.txt: -------------------------------------------------------------------------------- 1 | let bi = BigInt('1'); 2 | let inf = Infinity 3 | Number(undefined) 4 | let today = new Date() -------------------------------------------------------------------------------- /test/markup/latex/chars.expect.txt: -------------------------------------------------------------------------------- 1 | {}$&^_~"[]()<> 2 | 3 | +-0123456789 pt 4 | 5 | ^^3abc 6 | ^^3ABC 7 | ^^xyz 8 | ^^#3 9 | ^^°! 10 | ^^{ 11 | ^^} 12 | ^^$ 13 | ^^& 14 | ^^%asdf 15 | ^^^ 16 | ^^_ 17 | ^^^^3bf2a3 18 | ^^^^g12345 19 | -------------------------------------------------------------------------------- /test/markup/dockerfile/default.txt: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | 3 | MAINTAINER laurent@docker.com 4 | 5 | ARG debug=0 6 | 7 | COPY www.conf /etc/php5/fpm/pool.d/ 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y php5-fpm php-apc php5-curl php5-gd php5-intl php5-mysql 11 | RUN mkdir /tmp/sessions 12 | 13 | ENV APPLICATION_ENV dev 14 | 15 | USER www-data 16 | 17 | EXPOSE 80 18 | 19 | VOLUME ["/var/www/html"] 20 | 21 | WORKDIR "/var/www/html" 22 | 23 | CMD [ "/usr/sbin/php5-fpm", "-F" ] 24 | -------------------------------------------------------------------------------- /test/markup/javascript/regex.expect.txt: -------------------------------------------------------------------------------- 1 | // examples that have proven problematic in the past 2 | `Bad ${foo / 1000}` 3 | foo = 2 / 2 + 2 / 2; 4 | foo = / 2 + 2 /; 5 | b = a++ / 2; 6 | -------------------------------------------------------------------------------- /test/markup/llvm/simple.txt: -------------------------------------------------------------------------------- 1 | ;; foooo 2 | define i32 @mul_add(i32 %x, i32 %y, i32 %z) { 3 | entry: 4 | %tmp = mul i32 %x, %y 5 | %tmp2 = add i32 %tmp, %z 6 | %tmp3 = add i32 %tmp, 0 7 | ret i32 %tmp3 8 | } 9 | 10 | ; Named metadata 11 | !0 = !{i32 42, null, !"string"} 12 | !foo = !{!0} 13 | 14 | ; Some unnamed metadata nodes, which are referenced by the named metadata. 15 | !0 = !{!"zero"} 16 | !1 = !{!"one"} 17 | !2 = !{!"two"} 18 | ; A named metadata. 19 | !name = !{!0, !1, !2} 20 | -------------------------------------------------------------------------------- /test/markup/r/numbers.txt: -------------------------------------------------------------------------------- 1 | 1 # Regression caused numbers at beginning not to be highlighted. 2 | 3 | # Numbers 4 | 5 | 0, 01, 08, 123456, 1256.701, 123e3, 123E+3, 1.23e-3, 1.23E3, .25, 2. 6 | 7 | # Integers 8 | 9 | 123L, -50L 10 | 11 | # Imaginary numbers 12 | 13 | 123i, -123i, 1.2e-3i, 1.i, .0i 14 | 15 | # Hex numbers 16 | 17 | 0x0, 0xabcdefABCDEF01234, 0xabcp123, 0xabcP-123, 0x1.2p2, 0xa.bp-3i 18 | 19 | # Invalid/not literals (for reference) 20 | 21 | # 2e, 0x1pa, 0x1.2, 0xg, .2L, 0.L 22 | -------------------------------------------------------------------------------- /test/markup/scala/enum.expect.txt: -------------------------------------------------------------------------------- 1 | enum Color: 2 | case Red, Green, Blue 3 | 4 | enum State: 5 | case On 6 | case Off 7 | -------------------------------------------------------------------------------- /test/detect/markdown/default.txt: -------------------------------------------------------------------------------- 1 | # hello world 2 | 3 | you can write text [with links](http://example.com) inline or [link references][1]. 4 | 5 | * one _thing_ has *em*phasis 6 | * two __things__ are **bold** 7 | 8 | [1]: http://example.com 9 | 10 | --- 11 | 12 | hello world 13 | =========== 14 | 15 | 16 | 17 | > markdown is so cool 18 | 19 | so are code segments 20 | 21 | 1. one thing (yeah!) 22 | 2. two thing `i can write code`, and `more` wipee! 23 | 24 | -------------------------------------------------------------------------------- /test/markup/ini/comments.expect.txt: -------------------------------------------------------------------------------- 1 | # Comment 2 | ; ini-style comment 3 | x = "abc" # Comment on same line 4 | y = 123 ; Comment on same line 5 | [table] ; Comment on same line 6 | -------------------------------------------------------------------------------- /test/markup/java/functions.expect.txt: -------------------------------------------------------------------------------- 1 | public static <A,B,C> Tuple<A,B,C> fun(Future<Tuple<A,B,C>> future) throws Exceptions { 2 | } 3 | 4 | static Optional<List<Token>> parseAll(String s) { 5 | } 6 | -------------------------------------------------------------------------------- /test/markup/javascript/jsdoc.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * Create a point. 3 | * @author Test 4 | * @author Test Smith 5 | * @param {number} x - The x value. 6 | * @param {number} y 7 | * @returns {Point} A Point object. 8 | */ 9 | 10 | /** 11 | * @typedef {Array} 12 | * @param {string=} n - Optional 13 | * @param {(string|number)} n - Multiple types 14 | * @param {*} n - Any type 15 | * @param {...string} n - repeatable arguments 16 | * @param {string[]} n - Array of strings 17 | */ 18 | -------------------------------------------------------------------------------- /test/detect/n1ql/default.txt: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM `beer-sample` 3 | WHERE brewery_id IS NOT MISSING AND type="beer" 4 | LIMIT 1; 5 | 6 | UPSERT INTO product (KEY, VALUE) VALUES ( 7 | "odwalla-juice1", { 8 | "productId": "odwalla-juice1", 9 | "unitPrice": 5.40, 10 | "type": "product", 11 | "color":"red" 12 | } 13 | ) RETURNING *; 14 | 15 | INFER `beer-sample` WITH { 16 | "sample_size": 10000, 17 | "num_sample_values": 1, 18 | "similarity_metric": 0.0 19 | }; 20 | -------------------------------------------------------------------------------- /test/markup/javascript/arrow-function.txt: -------------------------------------------------------------------------------- 1 | var f = x => x; 2 | f(x => x + (y=2, z=undefined, ...rest) => y); 3 | () => null; 4 | const FC = props =>

    functional component

    ; 5 | 6 | const good = () => 0; 7 | const good = (x) => 0; 8 | const bad = (a => [...a, b]); 9 | const bad = (_ => doSomething()); 10 | const bad = (() => 0); 11 | const bad = ((a, b) => [...a, b]); 12 | const array = [1, 2, 3].reduce((acc, next) => [...acc, next], []); 13 | sides.every((length,width=(3+2+(4/5))) => length > 0 ); 14 | 15 | -------------------------------------------------------------------------------- /test/markup/markdown/entity.expect.txt: -------------------------------------------------------------------------------- 1 | - named entities: &amp;, &frac34;, &AElig; 2 | - decimal entities: &#65; &#164; 3 | - hexadecimal entities: &#xFFFD; &#x48;. -------------------------------------------------------------------------------- /test/markup/n1ql/default.txt: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM `beer-sample` 3 | WHERE brewery_id IS NOT MISSING AND type="beer" 4 | LIMIT 1; 5 | 6 | UPSERT INTO product (KEY, VALUE) VALUES ( 7 | "odwalla-juice1", { 8 | "productId": "odwalla-juice1", 9 | "unitPrice": 5.40, 10 | "type": "product", 11 | "color":"red" 12 | } 13 | ) RETURNING *; 14 | 15 | INFER `beer-sample` WITH { 16 | "sample_size": 10000, 17 | "num_sample_values": 1, 18 | "similarity_metric": 0.0 19 | }; 20 | -------------------------------------------------------------------------------- /test/detect/go/swift-like.txt: -------------------------------------------------------------------------------- 1 | func makeRequest(method string, url string, cb func(error, io.ReadCloser)) { 2 | req, _ := http.NewRequest(method, url, nil) 3 | resp, err := http.DefaultClient.Do(req) 4 | if err != nil { 5 | cb(err, nil) 6 | } else { 7 | cb(err, resp.Body) 8 | } 9 | } 10 | func main() { 11 | makeRequest("GET", "http://ipinfo.io/json", func(err error, body io.ReadCloser) { 12 | defer body.Close() 13 | io.Copy(os.Stdout, body) 14 | }) 15 | } 16 | -------------------------------------------------------------------------------- /test/detect/q/default.txt: -------------------------------------------------------------------------------- 1 | select time, price by date,stock from quote where price=(max;price)fby stock 2 | data:raze value flip trade 3 | select vwap:size wavg price by 5 xbar time.minute from aapl where date within (.z.d-10;.z.d) 4 | f1:{[x;y;z] show (x;y+z);sum 1 2 3} 5 | .z.pc:{[handle] show -3!(`long$.z.p;"Closed";handle)} 6 | // random normal distribution, e.g. nor 10 7 | nor:{$[x=2*n:x div 2;raze sqrt[-2*log n?1f]*/:(sin;cos)@\:(2*pi)*n?1f;-1_.z.s 1+x]} 8 | 9 | mode:{where g=max g:count each group x} // mode function -------------------------------------------------------------------------------- /test/detect/rsl/default.txt: -------------------------------------------------------------------------------- 1 | #define TEST_DEFINE 3.14 2 | /* plastic surface shader 3 | * 4 | * Pixie is: 5 | * (c) Copyright 1999-2003 Okan Arikan. All rights reserved. 6 | */ 7 | 8 | surface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1; 9 | color specularcolor = 1;) { 10 | normal Nf = faceforward (normalize(N),I); 11 | Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks * 12 | specular(Nf,-normalize(I),roughness); 13 | Oi = Os; 14 | Ci *= Oi; 15 | } 16 | -------------------------------------------------------------------------------- /test/markup/pony/control-flow.txt: -------------------------------------------------------------------------------- 1 | if a == b and b == a then 2 | env.out.print("they are the same") 3 | elseif a > b or b < a then 4 | env.out.print("a is bigger") 5 | else 6 | env.out.print("b bigger") 7 | end 8 | 9 | while count <= 10 do 10 | env.out.print(count.string()) 11 | count = count + 1 12 | end 13 | 14 | for name in ["Bob"; "Fred"; "Sarah"].values() do 15 | env.out.print(name) 16 | end 17 | 18 | repeat 19 | env.out.print("hello!") 20 | counter = counter + 1 21 | until counter > 7 end -------------------------------------------------------------------------------- /test/markup/q/default.txt: -------------------------------------------------------------------------------- 1 | select time, price by date,stock from quote where price=(max;price)fby stock 2 | data:raze value flip trade 3 | select vwap:size wavg price by 5 xbar time.minute from aapl where date within (.z.d-10;.z.d) 4 | f1:{[x;y;z] show (x;y+z);sum 1 2 3} 5 | .z.pc:{[handle] show -3!(`long$.z.p;"Closed";handle)} 6 | // random normal distribution, e.g. nor 10 7 | nor:{$[x=2*n:x div 2;raze sqrt[-2*log n?1f]*/:(sin;cos)@\:(2*pi)*n?1f;-1_.z.s 1+x]} 8 | 9 | mode:{where g=max g:count each group x} // mode function -------------------------------------------------------------------------------- /test/markup/rsl/default.txt: -------------------------------------------------------------------------------- 1 | #define TEST_DEFINE 3.14 2 | /* plastic surface shader 3 | * 4 | * Pixie is: 5 | * (c) Copyright 1999-2003 Okan Arikan. All rights reserved. 6 | */ 7 | 8 | surface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1; 9 | color specularcolor = 1;) { 10 | normal Nf = faceforward (normalize(N),I); 11 | Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks * 12 | specular(Nf,-normalize(I),roughness); 13 | Oi = Os; 14 | Ci *= Oi; 15 | } 16 | -------------------------------------------------------------------------------- /test/builds/package.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is used by import_via_commonjs.js to build a single "package" 3 | and acts as a sanity check that all our code is "use strict" safe 4 | 5 | See .github/workflows/tests.js.yml 6 | */ 7 | 8 | import hljs from '../../build/lib/index.js'; 9 | import { HighlightJS } from '../../build/lib/index.js' 10 | 11 | const language = "cpp"; 12 | hljs.highlight("/* test */", {language}); 13 | HighlightJS.highlight("/* test */", {language}); 14 | console.log("Rollup built package works."); 15 | -------------------------------------------------------------------------------- /test/markup/powershell/quote-herestring.expect.txt: -------------------------------------------------------------------------------- 1 | @" The wild cat jumped over the $height-tall fence. 2 | He did so with grace. 3 | "@ 4 | 5 | This SHOULDNT be a part of the above strings span. 6 | 7 | @" The wild cat jumped over the $height-tall fence. 8 | He did so with grace. 9 | break-end-of-string"@ 10 | 11 | This SHOULD be a part of the above strings span. -------------------------------------------------------------------------------- /test/markup/sql/set-operator.expect.txt: -------------------------------------------------------------------------------- 1 | SELECT * FROM VALUES 1, 2 ,3 UNION ALL VALUES 1, 2, 3; 2 | -------------------------------------------------------------------------------- /test/markup/xml/sublanguage_no_relevancy.expect.txt: -------------------------------------------------------------------------------- 1 | <script>foo();</script> 2 | <script>booger</script> 3 | <script>hjk</script> 4 | -------------------------------------------------------------------------------- /test/detect/brainfuck/default.txt: -------------------------------------------------------------------------------- 1 | ++++++++++ 2 | [ 3*10 and 10*10 3 | ->+++>++++++++++<< 4 | ]>> 5 | [ filling cells 6 | ->++>>++>++>+>++>>++>++>++>++>++>++>++>++>++>++>++[> 7 | ]< 8 | +++++++++<< 9 | [ rough codes correction loop 10 | ->>>+>+>+>+++>+>+>+>+>+>+>+>+>+>+>+>+>+>+[<]< 11 | ] 12 | more accurate сodes correction 13 | >>>++> 14 | -->+++++++>------>++++++>++>+++++++++>++++++++++>++++++++>--->++++++++++>------>++++++> 15 | ++>+++++++++++>++++++++++++>------>+++ 16 | rewind and output 17 | [<]>[.>] 18 | -------------------------------------------------------------------------------- /test/markup/brainfuck/default.txt: -------------------------------------------------------------------------------- 1 | ++++++++++ 2 | [ 3*10 and 10*10 3 | ->+++>++++++++++<< 4 | ]>> 5 | [ filling cells 6 | ->++>>++>++>+>++>>++>++>++>++>++>++>++>++>++>++>++[> 7 | ]< 8 | +++++++++<< 9 | [ rough codes correction loop 10 | ->>>+>+>+>+++>+>+>+>+>+>+>+>+>+>+>+>+>+>+[<]< 11 | ] 12 | more accurate сodes correction 13 | >>>++> 14 | -->+++++++>------>++++++>++>+++++++++>++++++++++>++++++++>--->++++++++++>------>++++++> 15 | ++>+++++++++++>++++++++++++>------>+++ 16 | rewind and output 17 | [<]>[.>] 18 | -------------------------------------------------------------------------------- /test/markup/clojure/symbols-numbers.expect.txt: -------------------------------------------------------------------------------- 1 | (def +x [(a 1) +2 -3.0 y-5]) 2 | (System/getProperty "java.vm.version") 3 | (.getEnclosingClass java.util.Map$Entry) 4 | (java.util.Map$Entry. .getEnclosingClass) -------------------------------------------------------------------------------- /test/markup/ini/array.expect.txt: -------------------------------------------------------------------------------- 1 | 2 | moo=["foo"] 3 | 4 | KNOWN_PEERS = [ 5 | "finland.some-host.com:11625", 6 | "germany.some-host.com:11625", 7 | "hongkong.some-host.com:11625", 8 | 32, 9 | true 10 | ] 11 | -------------------------------------------------------------------------------- /test/markup/r/strings.txt: -------------------------------------------------------------------------------- 1 | "test #" 2 | "a'b" 3 | 'a"b' 4 | "foo\"bar" 5 | 'foo\'bar' 6 | "\013x" 7 | "\xfex" 8 | "\uabc0x" 9 | "\U0123abcdx" 10 | "\u{abcd}x" 11 | "\U{0123abcd}x" 12 | r"(foo"bar)" 13 | r"{foo)"bar}" 14 | r"[foo)"bar]" 15 | r"-(foo)"bar)-" 16 | R"--(foo)-"bar)--" 17 | r'-(foo)'bar)-' # ' 18 | r"( 19 | xyz 20 | " 21 | \ 22 | ) 23 | )" 24 | "this is a quote that spans 25 | multiple lines 26 | \" 27 | 28 | is this still a quote? it should be. 29 | # even still! 30 | 31 | " 32 | 'same for 33 | single quotes #' 34 | -------------------------------------------------------------------------------- /test/markup/tap/basic.expect.txt: -------------------------------------------------------------------------------- 1 | 1..4 2 | ok 1 - Input file opened 3 | not ok 2 - First line of the input valid 4 | ok 3 - Read the rest of the file 5 | not ok 4 - Summarized correctly # TODO Not written yet 6 | -------------------------------------------------------------------------------- /test/api/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('hljs', function() { 4 | require('./autoDetection'); 5 | require('./beginKeywords'); 6 | require('./binaryNumber'); 7 | require('./cNumber'); 8 | require('./getLanguage'); 9 | require('./highlight'); 10 | require('./ident'); 11 | require('./keywords'); 12 | require('./number'); 13 | require('./registerAlias'); 14 | require('./unregisterLanguage'); 15 | require('./starters'); 16 | require('./underscoreIdent'); 17 | require('./multiClassMatch'); 18 | }); 19 | -------------------------------------------------------------------------------- /test/detect/twig/default.txt: -------------------------------------------------------------------------------- 1 | {% if posts|length %} 2 | {% for article in articles %} 3 | <div> 4 | {{ article.title|upper() }} 5 | 6 | {# outputs 'WELCOME' #} 7 | </div> 8 | {% endfor %} 9 | {% endif %} 10 | 11 | {% set user = json_encode(user) %} 12 | 13 | {{ random(['apple', 'orange', 'citrus']) }} 14 | 15 | {{ include(template_from_string("Hello {{ name }}")) }} 16 | 17 | 18 | {# 19 | Comments may be long and multiline. 20 | Markup is <em>not</em> highlighted within comments. 21 | #} 22 | --------------------------------------------------------------------------------