highlight.js-9.12.0/0000755000175000017500000000000013113427226014572 5ustar infinity0infinity0highlight.js-9.12.0/CHANGES.md0000644000175000017500000016140713113427226016175 0ustar infinity0infinity0## Version 9.12.0 New language: - *MikroTik* RouterOS Scripting language by [Ivan Dementev][]. New style: - *VisualStudio 2015 Dark* by [Nicolas LLOBERA][] Improvements: - *Crystal* updated with new keywords and syntaxes by [Tsuyusato Kitsune][]. - *Julia* updated to the modern definitions by [Alex Arslan][]. - *julia-repl* added by [Morten Piibeleht][]. - [Stanislav Belov][] wrote a new definition for *1C*, replacing the one that has not been updated for more than 8 years. The new version supports syntax for versions 7.7 and 8. - [Nicolas LLOBERA][] improved C# definition fixing edge cases with function titles detection and added highlighting of `[Attributes]`. - [nnnik][] provided a few correctness fixes for *Autohotkey*. - [Martin Clausen][] made annotation collections in *Clojure* to look consistently with other kinds. - [Alejandro Alonso][] updated *Swift* keywords. [Tsuyusato Kitsune]: https://github.com/MakeNowJust [Alex Arslan]: https://github.com/ararslan [Morten Piibeleht]: https://github.com/mortenpi [Stanislav Belov]: https://github.com/4ppl [Ivan Dementev]: https://github.com/DiVAN1x [Nicolas LLOBERA]: https://github.com/Nicolas01 [nnnik]: https://github.com/nnnik [Martin Clausen]: https://github.com/maacl [Alejandro Alonso]: https://github.com/Azoy ## Version 9.11.0 New languages: - *Shell* by [Tsuyusato Kitsune][] - *jboss-cli* by [Raphaël Parrëe][] Improvements: - [Joël Porquet] has [greatly improved the definition of *makefile*][5b3e0e6]. - *C++* class titles are now highlighted as in other languages with classes. - [Jordi Petit][] added rarely used `or`, `and` and `not` keywords to *C++*. - [Pieter Vantorre][] fixed highlighting of negative floating point values. [Tsuyusato Kitsune]: https://github.com/MakeNowJust [Jordi Petit]: https://github.com/jordi-petit [Raphaël Parrëe]: https://github.com/rparree [Pieter Vantorre]: https://github.com/NuclearCookie [5b3e0e6]: https://github.com/isagalaev/highlight.js/commit/5b3e0e68bfaae282faff6697d6a490567fa9d44b ## Version 9.10.0 Apologies for missing the previous release cycle. Some thing just can't be automated… Anyway, we're back! New languages: - *Hy* by [Sergey Sobko][] - *Leaf* by [Hale Chan][] - *N1QL* by [Andres Täht][] and [Rene Saarsoo][] Improvements: - *Rust* got updated with new keywords by [Kasper Andersen][] and then significantly modernized even more by [Eduard-Mihai Burtescu][] (yes, @eddyb, Rust core team member!) - *Python* updated with f-literals by [Philipp A][]. - *YAML* updated with unquoted strings support. - *Gauss* updated with new keywords by [Matt Evans][]. - *Lua* updated with new keywords by [Joe Blow][]. - *Kotlin* updated with new keywords by [Philipp Hauer][]. - *TypeScript* got highlighting of function params and updated keywords by [Ike Ku][]. - *Scheme* now correctly handles \`-quoted lists thanks to [Guannan Wei]. - [Sam Wu][] fixed handling of `<<` in *C++* defines. [Philipp A]: https://github.com/flying-sheep [Philipp Hauer]: https://github.com/phauer [Sergey Sobko]: https://github.com/profitware [Hale Chan]: https://github.com/halechan [Matt Evans]: https://github.com/matthewevans [Joe Blow]: https://github.com/mossarelli [Kasper Andersen]: https://github.com/kasma1990 [Eduard-Mihai Burtescu]: https://github.com/eddyb [Andres Täht]: https://github.com/andrestaht [Rene Saarsoo]: https://github.com/nene [Philipp Hauer]: https://github.com/phauer [Ike Ku]: https://github.com/dempfi [Guannan Wei]: https://github.com/Kraks [Sam Wu]: https://github.com/samsam2310 ## Version 9.9.0 New languages - *LLVM* by [Michael Rodler][] Improvements: - *TypeScript* updated with annotations and param lists inside constructors, by [Raphael Parree][]. - *CoffeeScript* updated with new keywords and fixed to recognize JavaScript in \`\`\`, thanks to thanks to [Geoffrey Booth][]. - Compiler directives in *Delphi* are now correctly highlighted as "meta". [Raphael Parree]: https://github.com/rparree [Michael Rodler]: https://github.com/f0rki [Geoffrey Booth]: https://github.com/GeoffreyBooth ## Version 9.8.0 "New York" This version is the second one that deserved a name. Because I'm in New York, and the release isn't missing the deadline only because it's still Tuesday on West Coast. New languages: - *Clean* by [Camil Staps][] - *Flix* by [Magnus Madsen][] Improvements: - [Kenton Hamaluik][] did a comprehensive update for *Haxe*. - New commands for *PowerShell* from [Nicolas Le Gall][]. - [Jan T. Sott][] updated *NSIS*. - *Java* and *Swift* support unicode characters in identifiers thanks to [Alexander Lichter][]. [Camil Staps]: https://github.com/camilstaps [Magnus Madsen]: https://github.com/magnus-madsen [Kenton Hamaluik]: https://github.com/FuzzyWuzzie [Nicolas Le Gall]: https://github.com/darkitty [Jan T. Sott]: https://github.com/idleberg [Alexander Lichter]: https://github.com/manniL ## Version 9.7.0 A comprehensive bugfix release. This is one of the best things about highlight.js: even boring things keep getting better (even if slow). - VHDL updated with PSL keywords and uses more consistent styling. - Nested C-style comments no longer break highlighting in many languages. - JavaScript updated with `=>` functions, highlighted object attributes and parsing within template string substitution blocks (`${...}`). - Fixed another corner case with self-closing `` in JSX. - Added `HEALTHCHECK` directive in Docker. - Delphi updated with new Free Pascal keywords. - Fixed digit separator parsing in C++. - C# updated with new keywords and fixed to allow multiple identifiers within generics `<...>`. - Fixed another slow regex in Less. ## Version 9.6.0 New languages: - *ABNF* and *EBNF* by [Alex McKibben][] - *Awk* by [Matthew Daly][] - *SubUnit* by [Sergey Bronnikov][] New styles: - *Atom One* in both Dark and Light variants by [Daniel Gamage][] Plus, a few smaller updates for *Lasso*, *Elixir*, *C++* and *SQL*. [Alex McKibben]: https://github.com/mckibbenta [Daniel Gamage]: https://github.com/danielgamage [Matthew Daly]: https://github.com/matthewbdaly [Sergey Bronnikov]: https://github.com/ligurio ## Version 9.5.0 New languages: - *Excel* by [Victor Zhou][] - *Linden Scripting Language* by [Builder's Brewery][] - *TAP* (Test Anything Protocol) by [Sergey Bronnikov][] - *Pony* by [Joe Eli McIlvain][] - *Coq* by [Stephan Boyer][] - *dsconfig* and *LDIF* by [Jacob Childress][] New styles: - *Ocean Dark* by [Gavin Siu][] Notable changes: - [Minh Nguyễn][] added more built-ins to Objective C. - [Jeremy Hull][] fixed corner cases in C++ preprocessor directives and Diff comments. - [Victor Zhou][] added support for digit separators in C++ numbers. [Gavin Siu]: https://github.com/gavsiu [Builder's Brewery]: https://github.com/buildersbrewery [Victor Zhou]: https://github.com/OiCMudkips [Sergey Bronnikov]: https://github.com/ligurio [Joe Eli McIlvain]: https://github.com/jemc [Stephan Boyer]: https://github.com/boyers [Jacob Childress]: https://github.com/braveulysses [Minh Nguyễn]: https://github.com/1ec5 [Jeremy Hull]: https://github.com/sourrust ## Version 9.4.0 New languages: - *PureBASIC* by [Tristano Ajmone][] - *BNF* by [Oleg Efimov][] - *Ada* by [Lars Schulna][] New styles: - *PureBASIC* by [Tristano Ajmone][] Improvements to existing languages and styles: - We now highlight function declarations in Go. - [Taisuke Fujimoto][] contributed very convoluted rules for raw and interpolated strings in C#. - [Boone Severson][] updated Verilog to comply with IEEE 1800-2012 SystemVerilog. - [Victor Zhou][] improved rules for comments and strings in PowerShell files. - [Janis Voigtländer][] updated the definition of Elm to version 0.17 of the languages. Elm is now featured on the front page of . - Special variable `$this` is highlighted as a keyword in PHP. - `usize` and `isize` are now highlighted in Rust. - Fixed labels and directives in x86 assembler. [Tristano Ajmone]: https://github.com/tajmone [Taisuke Fujimoto]: https://github.com/temp-impl [Oleg Efimov]: https://github.com/Sannis [Boone Severson]: https://github.com/BooneJS [Victor Zhou]: https://github.com/OiCMudkips [Lars Schulna]: https://github.com/captain-hanuta [Janis Voigtländer]: https://github.com/jvoigtlaender ## Version 9.3.0 New languages: - *Tagger Script* by [Philipp Wolfer][] - *MoonScript* by [Billy Quith][] New styles: - *xt256* by [Herbert Shin][] Improvements to existing languages and styles: - More robust handling of unquoted HTML tag attributes - Relevance tuning for QML which was unnecessary eager at seizing other languages' code - Improve GAMS language parsing - Fixed a bunch of bugs around selectors in Less - Kotlin's got a new definition for annotations, updated keywords and other minor improvements - Added `move` to Rust keywords - Markdown now recognizes \`\`\`-fenced code blocks - Improved detection of function declarations in C++ and C# [Philipp Wolfer]: https://github.com/phw [Billy Quith]: https://github.com/billyquith [Herbert Shin]: https://github.com/initbar ## Version 9.2.0 New languages: - *QML* by [John Foster][] - *HTMLBars* by [Michael Johnston][] - *CSP* by [Taras][] - *Maxima* by [Robert Dodier][] New styles: - *Gruvbox* by [Qeole][] - *Dracula* by [Denis Ciccale][] Improvements to existing languages and styles: - We now correctly handle JSX with arbitrary node tree depth. - Argument list for `(lambda)` in Scheme is no longer highlighted as a function call. - Stylus syntax doesn't break on valid CSS. - More correct handling of comments and strings and other improvements for VimScript. - More subtle work on the default style. - We now use anonymous modules for AMD. - `macro_rules!` is now recognized as a built-in in Rust. [John Foster]: https://github.com/jf990 [Qeole]: https://github.com/Qeole [Denis Ciccale]: https://github.com/dciccale [Michael Johnston]: https://github.com/lastobelus [Taras]: https://github.com/oxdef [Robert Dodier]: https://github.com/robert-dodier ## Version 9.1.0 New languages: - *Stan* by [Brendan Rocks][] - *BASIC* by [Raphaël Assénat][] - *GAUSS* by [Matt Evans][] - *DTS* by [Martin Braun][] - *Arduino* by [Stefania Mellai][] New Styles: - *Arduino Light* by [Stefania Mellai][] Improvements to existing languages and styles: - Handle return type annotations in Python - Allow shebang headers in Javascript - Support strings in Rust meta - Recognize `struct` as a class-level definition in Rust - Recognize b-prefixed chars and strings in Rust - Better numbers handling in Verilog [Brendan Rocks]: http://brendanrocks.com [Raphaël Assénat]: https://github.com/raphnet [Matt Evans]: https://github.com/matthewevans [Martin Braun]: https://github.com/mbr0wn [Stefania Mellai]: https://github.com/smellai ## Version 9.0.0 The new major version brings a reworked styling system. Highlight.js now defines a limited set of highlightable classes giving a consistent result across all the styles and languages. You can read a more detailed explanation and background in the [tracking issue][#348] that started this long process back in May. This change is backwards incompatible for those who uses highlight.js with a custom stylesheet. The [new style guide][sg] explains how to write styles in this new world. Bundled themes have also suffered a significant amount of improvements and may look different in places, but all the things now consistent and make more sense. Among others, the Default style has got a refresh and will probably be tweaked some more in next releases. Please do give your feedback in our [issue tracker][issues]. New languages in this release: - *Caché Object Script* by [Nikita Savchenko][] - *YAML* by [Stefan Wienert][] - *MIPS Assembler* by [Nebuleon Fumika][] - *HSP* by [prince][] Improvements to existing languages and styles: - ECMAScript 6 modules import now do not require closing semicolon. - ECMAScript 6 classes constructors now highlighted. - Template string support for Typescript, as for ECMAScript 6. - Scala case classes params highlight fixed. - Built-in names introduced in Julia v0.4 added by [Kenta Sato][]. - Refreshed Default style. Other notable changes: - [Web workers support][webworkers] added bu [Jan Kühle][]. - We now have tests for compressed browser builds as well. - The building tool chain has been switched to node.js 4.x. and is now shamelessly uses ES6 features all over the place, courtesy of [Jeremy Hull][]. - License added to non-compressed browser build. [Jan Kühle]: https://github.com/frigus02 [Stefan Wienert]: https://github.com/zealot128 [Kenta Sato]: https://github.com/bicycle1885 [Nikita Savchenko]: https://github.com/ZitRos [webworkers]: https://github.com/isagalaev/highlight.js#web-workers [Jeremy Hull]: https://github.com/sourrust [#348]: https://github.com/isagalaev/highlight.js/issues/348 [sg]: http://highlightjs.readthedocs.org/en/latest/style-guide.html [issues]: https://github.com/isagalaev/highlight.js/issues [Nebuleon Fumika]: https://github.com/Nebuleon [prince]: https://github.com/prince-0203 ## Version 8.9.1 Some last-minute changes reverted due to strange bug with minified browser build: - Scala case classes params highlight fixed - ECMAScript 6 modules import now do not require closing semicolon - ECMAScript 6 classes constructors now highlighted - Template string support for Typescript, as for ECMAScript 6 - License added to not minified browser build ## Version 8.9.0 New languages: - *crmsh* by [Kristoffer Gronlund][] - *SQF* by [Soren Enevoldsen][] [Kristoffer Gronlund]: https://github.com/krig [Soren Enevoldsen]: https://github.com/senevoldsen90 Notable fixes and improvements to existing languages: - Added `abstract` and `namespace` keywords to TypeScript by [Daniel Rosenwasser][] - Added `label` support to Dockerfile by [Ladislav Prskavec][] - Crystal highlighting improved by [Tsuyusato Kitsune][] - Missing Swift keywords added by [Nate Cook][] - Improve detection of C block comments - ~~Scala case classes params highlight fixed~~ - ~~ECMAScript 6 modules import now do not require closing semicolon~~ - ~~ECMAScript 6 classes constructors now highlighted~~ - ~~Template string support for Typescript, as for ECMAScript 6~~ Other notable changes: - ~~License added to not minified browser build~~ [Kristoffer Gronlund]: https://github.com/krig [Søren Enevoldsen]: https://github.com/senevoldsen90 [Daniel Rosenwasser]: https://github.com/DanielRosenwasser [Ladislav Prskavec]: https://github.com/abtris [Tsuyusato Kitsune]: https://github.com/MakeNowJust [Nate Cook]: https://github.com/natecook1000 ## Version 8.8.0 New languages: - *Golo* by [Philippe Charrière][] - *GAMS* by [Stefan Bechert][] - *IRPF90* by [Anthony Scemama][] - *Access logs* by [Oleg Efimov][] - *Crystal* by [Tsuyusato Kitsune][] Notable fixes and improvements to existing languages: - JavaScript highlighting no longer fails with ES6 default parameters - Added keywords `async` and `await` to Python - PHP heredoc support improved - Allow preprocessor directives within C++ functions Other notable changes: - Change versions to X.Y.Z SemVer-compatible format - Added ability to build all targets at once [Philippe Charrière]: https://github.com/k33g [Stefan Bechert]: https://github.com/b-pos465 [Anthony Scemama]: https://github.com/scemama [Oleg Efimov]: https://github.com/Sannis [Tsuyusato Kitsune]: https://github.com/MakeNowJust ## Version 8.7 New languages: - *Zephir* by [Oleg Efimov][] - *Elm* by [Janis Voigtländer][] - *XQuery* by [Dirk Kirsten][] - *Mojolicious* by [Dotan Dimet][] - *AutoIt* by Manh Tuan from [J2TeaM][] - *Toml* (ini extension) by [Guillaume Gomez][] New styles: - *Hopscotch* by [Jan T. Sott][] - *Grayscale* by [MY Sun][] Notable fixes and improvements to existing languages: - Fix encoding of images when copied over in certain builds - Fix incorrect highlighting of the word "bug" in comments - Treat decorators different from matrix multiplication in Python - Fix traits inheritance highlighting in Rust - Fix incorrect document - Oracle keywords added to SQL language definition by [Vadimtro][] - Postgres keywords added to SQL language definition by [Benjamin Auder][] - Fix registers in x86asm being highlighted as a hex number - Fix highlighting for numbers with a leading decimal point - Correctly highlight numbers and strings inside of C/C++ macros - C/C++ functions now support pointer, reference, and move returns [Oleg Efimov]: https://github.com/Sannis [Guillaume Gomez]: https://github.com/GuillaumeGomez [Janis Voigtländer]: https://github.com/jvoigtlaender [Jan T. Sott]: https://github.com/idleberg [Dirk Kirsten]: https://github.com/dirkk [MY Sun]: https://github.com/simonmysun [Vadimtro]: https://github.com/Vadimtro [Benjamin Auder]: https://github.com/ghost [Dotan Dimet]: https://github.com/dotandimet [J2TeaM]: https://github.com/J2TeaM ## Version 8.6 New languages: - *C/AL* by [Kenneth Fuglsang][] - *DNS zone file* by [Tim Schumacher][] - *Ceylon* by [Lucas Werkmeister][] - *OpenSCAD* by [Dan Panzarella][] - *Inform7* by [Bruno Dias][] - *armasm* by [Dan Panzarella][] - *TP* by [Jay Strybis][] New styles: - *Atelier Cave*, *Atelier Estuary*, *Atelier Plateau* and *Atelier Savanna* by [Bram de Haan][] - *Github Gist* by [Louis Barranqueiro][] Notable fixes and improvements to existing languages: - Multi-line raw strings from C++11 are now supported - Fix class names with dashes in HAML - The `async` keyword from ES6/7 is now supported - TypeScript functions handle type and parameter complexity better - We unified phpdoc/javadoc/yardoc etc modes across all languages - CSS .class selectors relevance was dropped to prevent wrong language detection - Images is now included to CDN build - Release process is now automated [Bram de Haan]: https://github.com/atelierbram [Kenneth Fuglsang]: https://github.com/kfuglsang [Louis Barranqueiro]: https://github.com/LouisBarranqueiro [Tim Schumacher]: https://github.com/enko [Lucas Werkmeister]: https://github.com/lucaswerkmeister [Dan Panzarella]: https://github.com/pzl [Bruno Dias]: https://github.com/sequitur [Jay Strybis]: https://github.com/unreal ## Version 8.5 New languages: - *pf.conf* by [Peter Piwowarski][] - *Julia* by [Kenta Sato][] - *Prolog* by [Raivo Laanemets][] - *Docker* by [Alexis Hénaut][] - *Fortran* by [Anthony Scemama][] and [Thomas Applencourt][] - *Kotlin* by [Sergey Mashkov][] New styles: - *Agate* by [Taufik Nurrohman][] - *Darcula* by [JetBrains][] - *Atelier Sulphurpool* by [Bram de Haan][] - *Android Studio* by [Pedro Oliveira][] Notable fixes and improvements to existing languages: - ES6 features in JavaScript are better supported now by [Gu Yiling][]. - Swift now recognizes body-less method definitions. - Single expression functions `def foo, do: ... ` now work in Elixir. - More uniform detection of built-in classes in Objective C. - Fixes for number literals and processor directives in Rust. - HTML ` ``` - `tabReplace` and `useBR` that were used in different places are also unified into the global options object and are to be set using `configure(options)`. This function is documented in our [API docs][]. Also note that these parameters are gone from `highlightBlock` and `fixMarkup` which are now also rely on `configure`. - We removed public-facing (though undocumented) object `hljs.LANGUAGES` which was used to register languages with the library in favor of two new methods: `registerLanguage` and `getLanguage`. Both are documented in our [API docs][]. - Result returned from `highlight` and `highlightAuto` no longer contains two separate attributes contributing to relevance score, `relevance` and `keyword_count`. They are now unified in `relevance`. Another technically compatible change that nonetheless might need attention: - The structure of the NPM package was refactored, so if you had installed it locally, you'll have to update your paths. The usual `require('highlight.js')` works as before. This is contributed by [Dmitry Smolin][]. New features: - Languages now can be recognized by multiple names like "js" for JavaScript or "html" for, well, HTML (which earlier insisted on calling it "xml"). These aliases can be specified in the class attribute of the code container in your HTML as well as in various API calls. For now there are only a few very common aliases but we'll expand it in the future. All of them are listed in the [class reference][cr]. - Language detection can now be restricted to a subset of languages relevant in a given context — a web page or even a single highlighting call. This is especially useful for node.js build that includes all the known languages. Another example is a StackOverflow-style site where users specify languages as tags rather than in the markdown-formatted code snippets. This is documented in the [API reference][] (see methods `highlightAuto` and `configure`). - Language definition syntax streamlined with [variants][] and [beginKeywords][]. New languages and styles: - *Oxygene* by [Carlo Kok][] - *Mathematica* by [Daniel Kvasnička][] - *Autohotkey* by [Seongwon Lee][] - *Atelier* family of styles in 10 variants by [Bram de Haan][] - *Paraíso* styles by [Jan T. Sott][] Miscellaneous improvements: - Highlighting `=>` prompts in Clojure. - [Jeremy Hull][] fixed a lot of styles for consistency. - Finally, highlighting PHP and HTML [mixed in peculiar ways][php-html]. - Objective C and C# now properly highlight titles in method definition. - Big overhaul of relevance counting for a number of languages. Please do report bugs about mis-detection of non-trivial code snippets! [API reference]: http://highlightjs.readthedocs.org/en/latest/api.html [cr]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html [api docs]: http://highlightjs.readthedocs.org/en/latest/api.html [variants]: https://groups.google.com/d/topic/highlightjs/VoGC9-1p5vk/discussion [beginKeywords]: https://github.com/isagalaev/highlight.js/commit/6c7fdea002eb3949577a85b3f7930137c7c3038d [php-html]: https://twitter.com/highlightjs/status/408890903017689088 [Carlo Kok]: https://github.com/carlokok [Bram de Haan]: https://github.com/atelierbram [Daniel Kvasnička]: https://github.com/dkvasnicka [Dmitry Smolin]: https://github.com/dimsmol [Jeremy Hull]: https://github.com/sourrust [Seongwon Lee]: https://github.com/dlimpid [Jan T. Sott]: https://github.com/idleberg ## Version 7.5 A catch-up release dealing with some of the accumulated contributions. This one is probably will be the last before the 8.0 which will be slightly backwards incompatible regarding some advanced use-cases. One outstanding change in this version is the addition of 6 languages to the [hosted script][d]: Markdown, ObjectiveC, CoffeeScript, Apache, Nginx and Makefile. It now weighs about 6K more but we're going to keep it under 30K. New languages: - OCaml by [Mehdi Dogguy][mehdid] and [Nicolas Braud-Santoni][nbraud] - [LiveCode Server][lcs] by [Ralf Bitter][revig] - Scilab by [Sylvestre Ledru][sylvestre] - basic support for Makefile by [Ivan Sagalaev][isagalaev] Improvements: - Ruby's got support for characters like `?A`, `?1`, `?\012` etc. and `%r{..}` regexps. - Clojure now allows a function call in the beginning of s-expressions `(($filter "myCount") (arr 1 2 3 4 5))`. - Haskell's got new keywords and now recognizes more things like pragmas, preprocessors, modules, containers, FFIs etc. Thanks to [Zena Treep][treep] for the implementation and to [Jeremy Hull][sourrust] for guiding it. - Miscellaneous fixes in PHP, Brainfuck, SCSS, Asciidoc, CMake, Python and F#. [mehdid]: https://github.com/mehdid [nbraud]: https://github.com/nbraud [revig]: https://github.com/revig [lcs]: http://livecode.com/developers/guides/server/ [sylvestre]: https://github.com/sylvestre [isagalaev]: https://github.com/isagalaev [treep]: https://github.com/treep [sourrust]: https://github.com/sourrust [d]: http://highlightjs.org/download/ ## New core developers The latest long period of almost complete inactivity in the project coincided with growing interest to it led to a decision that now seems completely obvious: we need more core developers. So without further ado let me welcome to the core team two long-time contributors: [Jeremy Hull][] and [Oleg Efimov][]. Hope now we'll be able to work through stuff faster! P.S. The historical commit is [here][1] for the record. [Jeremy Hull]: https://github.com/sourrust [Oleg Efimov]: https://github.com/sannis [1]: https://github.com/isagalaev/highlight.js/commit/f3056941bda56d2b72276b97bc0dd5f230f2473f ## Version 7.4 This long overdue version is a snapshot of the current source tree with all the changes that happened during the past year. Sorry for taking so long! Along with the changes in code highlight.js has finally got its new home at , moving from its cradle on Software Maniacs which it outgrew a long time ago. Be sure to report any bugs about the site to . On to what's new… New languages: - Handlebars templates by [Robin Ward][] - Oracle Rules Language by [Jason Jacobson][] - F# by [Joans Follesø][] - AsciiDoc and Haml by [Dan Allen][] - Lasso by [Eric Knibbe][] - SCSS by [Kurt Emch][] - VB.NET by [Poren Chiang][] - Mizar by [Kelley van Evert][] [Robin Ward]: https://github.com/eviltrout [Jason Jacobson]: https://github.com/jayce7 [Joans Follesø]: https://github.com/follesoe [Dan Allen]: https://github.com/mojavelinux [Eric Knibbe]: https://github.com/EricFromCanada [Kurt Emch]: https://github.com/kemch [Poren Chiang]: https://github.com/rschiang [Kelley van Evert]: https://github.com/kelleyvanevert New style themes: - Monokai Sublime by [noformnocontent][] - Railscasts by [Damien White][] - Obsidian by [Alexander Marenin][] - Docco by [Simon Madine][] - Mono Blue by [Ivan Sagalaev][] (uses a single color hue for everything) - Foundation by [Dan Allen][] [noformnocontent]: http://nn.mit-license.org/ [Damien White]: https://github.com/visoft [Alexander Marenin]: https://github.com/ioncreature [Simon Madine]: https://github.com/thingsinjars [Ivan Sagalaev]: https://github.com/isagalaev Other notable changes: - Corrected many corner cases in CSS. - Dropped Python 2 version of the build tool. - Implemented building for the AMD format. - Updated Rust keywords (thanks to [Dmitry Medvinsky][]). - Literal regexes can now be used in language definitions. - CoffeeScript highlighting is now significantly more robust and rich due to input from [Cédric Néhémie][]. [Dmitry Medvinsky]: https://github.com/dmedvinsky [Cédric Néhémie]: https://github.com/abe33 ## Version 7.3 - Since this version highlight.js no longer works in IE version 8 and older. It's made it possible to reduce the library size and dramatically improve code readability and made it easier to maintain. Time to go forward! - New languages: AppleScript (by [Nathan Grigg][ng] and [Dr. Drang][dd]) and Brainfuck (by [Evgeny Stepanischev][bolk]). - Improvements to existing languages: - interpreter prompt in Python (`>>>` and `...`) - @-properties and classes in CoffeeScript - E4X in JavaScript (by [Oleg Efimov][oe]) - new keywords in Perl (by [Kirk Kimmel][kk]) - big Ruby syntax update (by [Vasily Polovnyov][vast]) - small fixes in Bash - Also Oleg Efimov did a great job of moving all the docs for language and style developers and contributors from the old wiki under the source code in the "docs" directory. Now these docs are nicely presented at . [ng]: https://github.com/nathan11g [dd]: https://github.com/drdrang [bolk]: https://github.com/bolknote [oe]: https://github.com/Sannis [kk]: https://github.com/kimmel [vast]: https://github.com/vast ## Version 7.2 A regular bug-fix release without any significant new features. Enjoy! ## Version 7.1 A Summer crop: - [Marc Fornos][mf] made the definition for Clojure along with the matching style Rainbow (which, of course, works for other languages too). - CoffeeScript support continues to improve getting support for regular expressions. - Yoshihide Jimbo ported to highlight.js [five Tomorrow styles][tm] from the [project by Chris Kempson][tm0]. - Thanks to [Casey Duncun][cd] the library can now be built in the popular [AMD format][amd]. - And last but not least, we've got a fair number of correctness and consistency fixes, including a pretty significant refactoring of Ruby. [mf]: https://github.com/mfornos [tm]: http://jmblog.github.com/color-themes-for-highlightjs/ [tm0]: https://github.com/ChrisKempson/Tomorrow-Theme [cd]: https://github.com/caseman [amd]: http://requirejs.org/docs/whyamd.html ## Version 7.0 The reason for the new major version update is a global change of keyword syntax which resulted in the library getting smaller once again. For example, the hosted build is 2K less than at the previous version while supporting two new languages. Notable changes: - The library now works not only in a browser but also with [node.js][]. It is installable with `npm install highlight.js`. [API][] docs are available on our wiki. - The new unique feature (apparently) among syntax highlighters is highlighting *HTTP* headers and an arbitrary language in the request body. The most useful languages here are *XML* and *JSON* both of which highlight.js does support. Here's [the detailed post][p] about the feature. - Two new style themes: a dark "south" *[Pojoaque][]* by Jason Tate and an emulation of*XCode* IDE by [Angel Olloqui][ao]. - Three new languages: *D* by [Aleksandar Ružičić][ar], *R* by [Joe Cheng][jc] and *GLSL* by [Sergey Tikhomirov][st]. - *Nginx* syntax has become a million times smaller and more universal thanks to remaking it in a more generic manner that doesn't require listing all the directives in the known universe. - Function titles are now highlighted in *PHP*. - *Haskell* and *VHDL* were significantly reworked to be more rich and correct by their respective maintainers [Jeremy Hull][sr] and [Igor Kalnitsky][ik]. And last but not least, many bugs have been fixed around correctness and language detection. Overall highlight.js currently supports 51 languages and 20 style themes. [node.js]: http://nodejs.org/ [api]: http://softwaremaniacs.org/wiki/doku.php/highlight.js:api [p]: http://softwaremaniacs.org/blog/2012/05/10/http-and-json-in-highlight-js/en/ [pojoaque]: http://web-cms-designs.com/ftopict-10-pojoaque-style-for-highlight-js-code-highlighter.html [ao]: https://github.com/angelolloqui [ar]: https://github.com/raleksandar [jc]: https://github.com/jcheng5 [st]: https://github.com/tikhomirov [sr]: https://github.com/sourrust [ik]: https://github.com/ikalnitsky ## Version 6.2 A lot of things happened in highlight.js since the last version! We've got nine new contributors, the discussion group came alive, and the main branch on GitHub now counts more than 350 followers. Here are most significant results coming from all this activity: - 5 (five!) new languages: Rust, ActionScript, CoffeeScript, MatLab and experimental support for markdown. Thanks go to [Andrey Vlasovskikh][av], [Alexander Myadzel][am], [Dmytrii Nagirniak][dn], [Oleg Efimov][oe], [Denis Bardadym][db] and [John Crepezzi][jc]. - 2 new style themes: Monokai by [Luigi Maselli][lm] and stylistic imitation of another well-known highlighter Google Code Prettify by [Aahan Krish][ak]. - A vast number of [correctness fixes and code refactorings][log], mostly made by [Oleg Efimov][oe] and [Evgeny Stepanischev][es]. [av]: https://github.com/vlasovskikh [am]: https://github.com/myadzel [dn]: https://github.com/dnagir [oe]: https://github.com/Sannis [db]: https://github.com/btd [jc]: https://github.com/seejohnrun [lm]: http://grigio.org/ [ak]: https://github.com/geekpanth3r [es]: https://github.com/bolknote [log]: https://github.com/isagalaev/highlight.js/commits/ ## Version 6.1 — Solarized [Jeremy Hull][jh] has implemented my dream feature — a port of [Solarized][] style theme famous for being based on the intricate color theory to achieve correct contrast and color perception. It is now available for highlight.js in both variants — light and dark. This version also adds a new original style Arta. Its author pumbur maintains a [heavily modified fork of highlight.js][pb] on GitHub. [jh]: https://github.com/sourrust [solarized]: http://ethanschoonover.com/solarized [pb]: https://github.com/pumbur/highlight.js ## Version 6.0 New major version of the highlighter has been built on a significantly refactored syntax. Due to this it's even smaller than the previous one while supporting more languages! New languages are: - Haskell by [Jeremy Hull][sourrust] - Erlang in two varieties — module and REPL — made collectively by [Nikolay Zakharov][desh], [Dmitry Kovega][arhibot] and [Sergey Ignatov][ignatov] - Objective C by [Valerii Hiora][vhbit] - Vala by [Antono Vasiljev][antono] - Go by [Stephan Kountso][steplg] [sourrust]: https://github.com/sourrust [desh]: http://desh.su/ [arhibot]: https://github.com/arhibot [ignatov]: https://github.com/ignatov [vhbit]: https://github.com/vhbit [antono]: https://github.com/antono [steplg]: https://github.com/steplg Also this version is marginally faster and fixes a number of small long-standing bugs. Developer overview of the new language syntax is available in a [blog post about recent beta release][beta]. [beta]: http://softwaremaniacs.org/blog/2011/04/25/highlight-js-60-beta/en/ P.S. New version is not yet available on a Yandex CDN, so for now you have to download [your own copy][d]. [d]: /soft/highlight/en/download/ ## Version 5.14 Fixed bugs in HTML/XML detection and relevance introduced in previous refactoring. Also test.html now shows the second best result of language detection by relevance. ## Version 5.13 Past weekend began with a couple of simple additions for existing languages but ended up in a big code refactoring bringing along nice improvements for language developers. ### For users - Description of C++ has got new keywords from the upcoming [C++ 0x][] standard. - Description of HTML has got new tags from [HTML 5][]. - CSS-styles have been unified to use consistent padding and also have lost pop-outs with names of detected languages. - [Igor Kalnitsky][ik] has sent two new language descriptions: CMake & VHDL. This makes total number of languages supported by highlight.js to reach 35. Bug fixes: - Custom classes on `
` tags are not being overridden anymore
- More correct highlighting of code blocks inside non-`
` containers:
  highlighter now doesn't insist on replacing them with its own container and
  just replaces the contents.
- Small fixes in browser compatibility and heuristics.

[c++ 0x]: http://ru.wikipedia.org/wiki/C%2B%2B0x
[html 5]: http://en.wikipedia.org/wiki/HTML5
[ik]: http://kalnitsky.org.ua/

### For developers

The most significant change is the ability to include language submodes right
under `contains` instead of defining explicit named submodes in the main array:

    contains: [
      'string',
      'number',
      {begin: '\\n', end: hljs.IMMEDIATE_RE}
    ]

This is useful for auxiliary modes needed only in one place to define parsing.
Note that such modes often don't have `className` and hence won't generate a
separate `` in the resulting markup. This is similar in effect to
`noMarkup: true`. All existing languages have been refactored accordingly.

Test file test.html has at last become a real test. Now it not only puts the
detected language name under the code snippet but also tests if it matches the
expected one. Test summary is displayed right above all language snippets.


## CDN

Fine people at [Yandex][] agreed to host highlight.js on their big fast servers.
[Link up][l]!

[yandex]: http://yandex.com/
[l]: http://softwaremaniacs.org/soft/highlight/en/download/


## Version 5.10 — "Paris".

Though I'm on a vacation in Paris, I decided to release a new version with a
couple of small fixes:

- Tomas Vitvar discovered that TAB replacement doesn't always work when used
  with custom markup in code
- SQL parsing is even more rigid now and doesn't step over SmallTalk in tests


## Version 5.9

A long-awaited version is finally released.

New languages:

- Andrew Fedorov made a definition for Lua
- a long-time highlight.js contributor [Peter Leonov][pl] made a definition for
  Nginx config
- [Vladimir Moskva][vm] made a definition for TeX

[pl]: http://kung-fu-tzu.ru/
[vm]: http://fulc.ru/

Fixes for existing languages:

- [Loren Segal][ls] reworked the Ruby definition and added highlighting for
  [YARD][] inline documentation
- the definition of SQL has become more solid and now it shouldn't be overly
  greedy when it comes to language detection

[ls]: http://gnuu.org/
[yard]: http://yardoc.org/

The highlighter has become more usable as a library allowing to do highlighting
from initialization code of JS frameworks and in ajax methods (see.
readme.eng.txt).

Also this version drops support for the [WordPress][wp] plugin. Everyone is
welcome to [pick up its maintenance][p] if needed.

[wp]: http://wordpress.org/
[p]: http://bazaar.launchpad.net/~isagalaev/+junk/highlight/annotate/342/src/wp_highlight.js.php


## Version 5.8

- Jan Berkel has contributed a definition for Scala. +1 to hotness!
- All CSS-styles are rewritten to work only inside `
` tags to avoid
  conflicts with host site styles.


## Version 5.7.

Fixed escaping of quotes in VBScript strings.


## Version 5.5

This version brings a small change: now .ini-files allow digits, underscores and
square brackets in key names.


## Version 5.4

Fixed small but upsetting bug in the packer which caused incorrect highlighting
of explicitly specified languages. Thanks to Andrew Fedorov for precise
diagnostics!


## Version 5.3

The version to fulfil old promises.

The most significant change is that highlight.js now preserves custom user
markup in code along with its own highlighting markup. This means that now it's
possible to use, say, links in code. Thanks to [Vladimir Dolzhenko][vd] for the
[initial proposal][1] and for making a proof-of-concept patch.

Also in this version:

- [Vasily Polovnyov][vp] has sent a GitHub-like style and has implemented
  support for CSS @-rules and Ruby symbols.
- Yura Zaripov has sent two styles: Brown Paper and School Book.
- Oleg Volchkov has sent a definition for [Parser 3][p3].

[1]: http://softwaremaniacs.org/forum/highlightjs/6612/
[p3]: http://www.parser.ru/
[vp]: http://vasily.polovnyov.ru/
[vd]: http://dolzhenko.blogspot.com/


## Version 5.2

- at last it's possible to replace indentation TABs with something sensible
  (e.g. 2 or 4 spaces)
- new keywords and built-ins for 1C by Sergey Baranov
- a couple of small fixes to Apache highlighting


## Version 5.1

This is one of those nice version consisting entirely of new and shiny
contributions!

- [Vladimir Ermakov][vooon] created highlighting for AVR Assembler
- [Ruslan Keba][rukeba] created highlighting for Apache config file. Also his
  original visual style for it is now available for all highlight.js languages
  under the name "Magula".
- [Shuen-Huei Guan][drake] (aka Drake) sent new keywords for RenderMan
  languages. Also thanks go to [Konstantin Evdokimenko][ke] for his advice on
  the matter.

[vooon]: http://vehq.ru/about/
[rukeba]: http://rukeba.com/
[drake]: http://drakeguan.org/
[ke]: http://k-evdokimenko.moikrug.ru/


## Version 5.0

The main change in the new major version of highlight.js is a mechanism for
packing several languages along with the library itself into a single compressed
file. Now sites using several languages will load considerably faster because
the library won't dynamically include additional files while loading.

Also this version fixes a long-standing bug with Javascript highlighting that
couldn't distinguish between regular expressions and division operations.

And as usually there were a couple of minor correctness fixes.

Great thanks to all contributors! Keep using highlight.js.


## Version 4.3

This version comes with two contributions from [Jason Diamond][jd]:

- language definition for C# (yes! it was a long-missed thing!)
- Visual Studio-like highlighting style

Plus there are a couple of minor bug fixes for parsing HTML and XML attributes.

[jd]: http://jason.diamond.name/weblog/


## Version 4.2

The biggest news is highlighting for Lisp, courtesy of Vasily Polovnyov. It's
somewhat experimental meaning that for highlighting "keywords" it doesn't use
any pre-defined set of a Lisp dialect. Instead it tries to highlight first word
in parentheses wherever it makes sense. I'd like to ask people programming in
Lisp to confirm if it's a good idea and send feedback to [the forum][f].

Other changes:

- Smalltalk was excluded from DEFAULT_LANGUAGES to save traffic
- [Vladimir Epifanov][voldmar] has implemented javascript style switcher for
  test.html
- comments now allowed inside Ruby function definition
- [MEL][] language from [Shuen-Huei Guan][drake]
- whitespace now allowed between `
` and ``
- better auto-detection of C++ and PHP
- HTML allows embedded VBScript (`<% .. %>`)

[f]: http://softwaremaniacs.org/forum/highlightjs/
[voldmar]: http://voldmar.ya.ru/
[mel]: http://en.wikipedia.org/wiki/Maya_Embedded_Language
[drake]: http://drakeguan.org/


## Version 4.1

Languages:

- Bash from Vah
- DOS bat-files from Alexander Makarov (Sam)
- Diff files from Vasily Polovnyov
- Ini files from myself though initial idea was from Sam

Styles:

- Zenburn from Vladimir Epifanov, this is an imitation of a
  [well-known theme for Vim][zenburn].
- Ascetic from myself, as a realization of ideals of non-flashy highlighting:
  just one color in only three gradations :-)

In other news. [One small bug][bug] was fixed, built-in keywords were added for
Python and C++ which improved auto-detection for the latter (it was shame that
[my wife's blog][alenacpp] had issues with it from time to time). And lastly
thanks go to Sam for getting rid of my stylistic comments in code that were
getting in the way of [JSMin][].

[zenburn]: http://en.wikipedia.org/wiki/Zenburn
[alenacpp]: http://alenacpp.blogspot.com/
[bug]: http://softwaremaniacs.org/forum/viewtopic.php?id=1823
[jsmin]: http://code.google.com/p/jsmin-php/


## Version 4.0

New major version is a result of vast refactoring and of many contributions.

Visible new features:

- Highlighting of embedded languages. Currently is implemented highlighting of
  Javascript and CSS inside HTML.
- Bundled 5 ready-made style themes!

Invisible new features:

- Highlight.js no longer pollutes global namespace. Only one object and one
  function for backward compatibility.
- Performance is further increased by about 15%.

Changing of a major version number caused by a new format of language definition
files. If you use some third-party language files they should be updated.


## Version 3.5

A very nice version in my opinion fixing a number of small bugs and slightly
increased speed in a couple of corner cases. Thanks to everybody who reports
bugs in he [forum][f] and by email!

There is also a new language — XML. A custom XML formerly was detected as HTML
and didn't highlight custom tags. In this version I tried to make custom XML to
be detected and highlighted by its own rules. Which by the way include such
things as CDATA sections and processing instructions (``).

[f]: http://softwaremaniacs.org/forum/viewforum.php?id=6


## Version 3.3

[Vladimir Gubarkov][xonix] has provided an interesting and useful addition.
File export.html contains a little program that shows and allows to copy and
paste an HTML code generated by the highlighter for any code snippet. This can
be useful in situations when one can't use the script itself on a site.


[xonix]: http://xonixx.blogspot.com/


## Version 3.2 consists completely of contributions:

- Vladimir Gubarkov has described SmallTalk
- Yuri Ivanov has described 1C
- Peter Leonov has packaged the highlighter as a Firefox extension
- Vladimir Ermakov has compiled a mod for phpBB

Many thanks to you all!


## Version 3.1

Three new languages are available: Django templates, SQL and Axapta. The latter
two are sent by [Dmitri Roudakov][1]. However I've almost entirely rewrote an
SQL definition but I'd never started it be it from the ground up :-)

The engine itself has got a long awaited feature of grouping keywords
("keyword", "built-in function", "literal"). No more hacks!

[1]: http://roudakov.ru/


## Version 3.0

It is major mainly because now highlight.js has grown large and has become
modular. Now when you pass it a list of languages to highlight it will
dynamically load into a browser only those languages.

Also:

- Konstantin Evdokimenko of [RibKit][] project has created a highlighting for
  RenderMan Shading Language and RenderMan Interface Bytestream. Yay for more
  languages!
- Heuristics for C++ and HTML got better.
- I've implemented (at last) a correct handling of backslash escapes in C-like
  languages.

There is also a small backwards incompatible change in the new version. The
function initHighlighting that was used to initialize highlighting instead of
initHighlightingOnLoad a long time ago no longer works. If you by chance still
use it — replace it with the new one.

[RibKit]: http://ribkit.sourceforge.net/


## Version 2.9

Highlight.js is a parser, not just a couple of regular expressions. That said
I'm glad to announce that in the new version 2.9 has support for:

- in-string substitutions for Ruby -- `#{...}`
- strings from from numeric symbol codes (like #XX) for Delphi


## Version 2.8

A maintenance release with more tuned heuristics. Fully backwards compatible.


## Version 2.7

- Nikita Ledyaev presents highlighting for VBScript, yay!
- A couple of bugs with escaping in strings were fixed thanks to Mickle
- Ongoing tuning of heuristics

Fixed bugs were rather unpleasant so I encourage everyone to upgrade!


## Version 2.4

- Peter Leonov provides another improved highlighting for Perl
- Javascript gets a new kind of keywords — "literals". These are the words
  "true", "false" and "null"

Also highlight.js homepage now lists sites that use the library. Feel free to
add your site by [dropping me a message][mail] until I find the time to build a
submit form.

[mail]: mailto:Maniac@SoftwareManiacs.Org


## Version 2.3

This version fixes IE breakage in previous version. My apologies to all who have
already downloaded that one!


## Version 2.2

- added highlighting for Javascript
- at last fixed parsing of Delphi's escaped apostrophes in strings
- in Ruby fixed highlighting of keywords 'def' and 'class', same for 'sub' in
  Perl


## Version 2.0

- Ruby support by [Anton Kovalyov][ak]
- speed increased by orders of magnitude due to new way of parsing
- this same way allows now correct highlighting of keywords in some tricky
  places (like keyword "End" at the end of Delphi classes)

[ak]: http://anton.kovalyov.net/


## Version 1.0

Version 1.0 of javascript syntax highlighter is released!

It's the first version available with English description. Feel free to post
your comments and question to [highlight.js forum][forum]. And don't be afraid
if you find there some fancy Cyrillic letters -- it's for Russian users too :-)

[forum]: http://softwaremaniacs.org/forum/viewforum.php?id=6
highlight.js-9.12.0/.gitattributes0000644000175000017500000000027513113427226017471 0ustar  infinity0infinity0# The build script and some tests use `\n` as markers, so we need to make sure
# that all javascript files are checked out using UNIX line endings (not `\r\n`)
*.js    eol=lf
*.txt   eol=lfhighlight.js-9.12.0/LICENSE0000644000175000017500000000273213113427226015603 0ustar  infinity0infinity0Copyright (c) 2006, Ivan Sagalaev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of highlight.js nor the names of its contributors 
      may be used to endorse or promote products derived from this software 
      without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
highlight.js-9.12.0/AUTHORS.en.txt0000644000175000017500000002321413113427226017063 0ustar  infinity0infinity0Syntax highlighting with language autodetection.

URL:   https://highlightjs.org/

Core developers (in order of appearance):

- Ivan Sagalaev (original author) 
- Jeremy Hull 
- Oleg Efimov 

Contributors:

- Peter Leonov 
- Victor Karamzin 
- Vsevolod Solovyov 
- Anton Kovalyov 
- Nikita Ledyaev 
- Konstantin Evdokimenko 
- Dmitri Roudakov 
- Yuri Ivanov 
- Vladimir Ermakov 
- Vladimir Gubarkov 
- Brian Beck 
- MajestiC 
- Vasily Polovnyov 
- Vladimir Epifanov 
- Alexander Makarov 
- Vah 
- Shuen-Huei Guan 
- Jason Diamond 
- Michal Gabrukiewicz 
- Ruslan Keba 
- Sergey Baranov 
- Zaripov Yura 
- Oleg Volchkov 
- Vasily Mikhailitchenko 
- Jan Berkel 
- Vladimir Moskva 
- Loren Segal 
- Andrew Fedorov 
- Igor Kalnitsky 
- Valerii Hiora 
- Nikolay Zakharov 
- Dmitry Kovega 
- Sergey Ignatov 
- Antono Vasiljev 
- Stephan Kountso 
- pumbur 
- John Crepezzi 
- Andrey Vlasovskikh 
- Alexander Myadzel 
- Evgeny Stepanischev 
- Dmytrii Nagirniak 
- Luigi Maselli 
- Denis Bardadym 
- Aahan Krish 
- Ilya Baryshev 
- Aleksandar Ruzicic 
- Joe Cheng 
- Angel G. Olloqui 
- Jason Tate 
- Sergey Tikhomirov 
- Marc Fornos 
- Yoshihide Jimbo 
- Casey Duncan 
- Eugene Nizhibitsky 
- Alberto Gimeno 
- Kirk Kimmel 
- Nathan Grigg 
- Dr. Drang 
- Robin Ward 
- Dmitry Medvinsky 
- Jason Jacobson 
- Jonas Follesø 
- Dan Allen 
- noformnocontent 
- Damien White 
- Alexander Marenin 
- Cédric Néhémie 
- Simon Madine 
- Benjamin Pannell 
- Eric Knibbe 
- Poren Chiang 
- Kelley van Evert 
- Kurt Emch 
- Mehdi Dogguy 
- Nicolas Braud-Santoni 
- Ralf Bitter 
- Sylvestre Ledru 
- Troy Kershaw 
- Zena Treep 
- Daniel Kvasnicka 
- Carlo Kok 
- Bram de Haan 
- Seongwon Lee 
- Zaven Muradyan 
- Jan T. Sott 
- Brent Bradbury 
- Martin Dilling-Hansen 
- Ilya Vassilevsky 
- Josh Adams 
- Dan Tao 
- Jeff Escalante 
- Jun Yang 
- Nikolay Lisienko 
- Heiko August 
- Domen Kožar 
- Travis Odom 
- innocenat 
- Arthur Bikmullin 
- Pascal Hurni 
- Roman Shmatov 
- Nic West 
- Panu Horsmalahti 
- Flaviu Tamas 
- Damian Mee 
- Christopher Kaster 
- Chris Eidhof 
- Nate Cook 
- Matt Diephouse 
- Erik Osheim 
- Guillaume Laforge 
- Lucas Mazza 
- Maxim Dikun 
- Henrik Feldt 
- Anton Kochkov 
- Michael Allen 
- JP Verkamp 
- Adam Joseph Cook 
- Sergey Vidyuk 
- Radek Liska 
- Jose Molina Colmenero 
- Max Mikhailov 
- Bryant Williams 
- Erik Paluka 
- Luke Holder 
- David Mohundro 
- Nicholas Blumhardt 
- Christophe de Dinechin 
- Taneli Vatanen 
- Jen Evers-Corvina 
- Kassio Borges 
- Cedric Sohrauer 
- Mickaël Delahaye 
- Hakan Özler 
- Trey Shugart 
- Vincent Zurczak 
- Adam Joseph Cook 
- Edwin Dalorzo 
- mucaho 
- Dennis Titze 
- Jon Evans 
- Brian Quistorff 
- Jonathan Suever 
- Alexis Hénaut 
- Chris Kiehl 
- Peter Piwowarski 
- Kenta Sato 
- Anthony Scemama 
- Taufik Nurrohman 
- Pedro Oliveira 
- Gu Yiling 
- Thomas Applencourt 
- Andrew Farmer 
- Sergey Mashkov 
- Raivo Laanemets 
- Kenneth Fuglsang 
- David Anson 
- Louis Barranqueiro 
- Tim Schumacher 
- Lucas Werkmeister 
- Dan Panzarella 
- Bruno Dias 
- Jay Strybis 
- Guillaume Gomez 
- Janis Voigtländer 
- Dirk Kirsten 
- MY Sun 
- Vadimtro 
- Benjamin Auder 
- Dotan Dimet 
- Manh Tuan 
- Philippe Charrière 
- Stefan Bechert 
- Samuel Reed 
- Yury Selivanov 
- Tsuyusato Kitsune 
- Mick MacCallum 
- Kristoffer Gronlund 
- Søren Enevoldsen 
- Daniel Rosenwasser 
- Ladislav Prskavec 
- Jan Kühle 
- Stefan Wienert 
- Nikita Savchenko 
- Stefania Mellai 
- Nebuleon Fumika 
- prince 
- Brendan Rocks 
- Raphaël Assénat 
- Matt Evans 
- Martin Braun 
- Boris Cherny 
- John Foster 
- Robert Dodier 
- Anthony Dugois 
- Qeole 
- Denis Ciccale 
- Michael Johnston 
- Taras 
- Philipp Wolfer 
- Mikko Kouhia 
- Billy Quith 
- Herbert Shin 
- Tristano Ajmone 
- Taisuke Fujimoto 
- Boone Severson 
- Victor Zhou 
- Lars Schulna 
- Jacob Childress 
- Gavin Siu 
- Builder's Brewery 
- Sergey Bronnikov 
- Joe Eli McIlvain 
- Stephan Boyer 
- Alex McKibben 
- Daniel Gamage 
- Matthew Daly 
- Magnus Madsen 
- Camil Staps 
- Alexander Lichter 
- Nicolas Le Gall 
- Kenton Hamaluik 
- Marvin Saignat 
- Michael Rodler 
- Sergey Sobko 
- Hale Chan 
- Matt Evans 
- Kasper Andersen 
- Philipp A. 
- Guannan Wei 
- Sam Wu 
- Ike Ku 
- Andres Täht 
- Rene Saarsoo 
- Jordi Petit 
- Raphaël Parrëe 
- Joël Porquet 
- Alex Arslan 
- Stanislav Belov 
- Ivan Dementev 
- Nicolas LLOBERA 
- Morten Piibeleht 
- Martin Clausen 
highlight.js-9.12.0/docs/0000755000175000017500000000000013113427226015522 5ustar  infinity0infinity0highlight.js-9.12.0/docs/_build/0000755000175000017500000000000013113427226016760 5ustar  infinity0infinity0highlight.js-9.12.0/docs/_build/.gitkeep0000644000175000017500000000000013113427226020377 0ustar  infinity0infinity0highlight.js-9.12.0/docs/language-guide.rst0000644000175000017500000001646313113427226021144 0ustar  infinity0infinity0Language definition guide
=========================

Highlighting overview
---------------------

Programming language code consists of parts with different rules of parsing: keywords like ``for`` or ``if``
don't make sense inside strings, strings may contain backslash-escaped symbols like ``\"``
and comments usually don't contain anything interesting except the end of the comment.

In highlight.js such parts are called "modes".

Each mode consists of:

* starting condition
* ending condition
* list of contained sub-modes
* lexing rules and keywords
* …exotic stuff like another language inside a language

The parser's work is to look for modes and their keywords.
Upon finding, it wraps them into the markup ``...``
and puts the name of the mode ("string", "comment", "number")
or a keyword group name ("keyword", "literal", "built-in") as the span's class name.


General syntax
--------------

A language definition is a JavaScript object describing the default parsing mode for the language.
This default mode contains sub-modes which in turn contain other sub-modes, effectively making the language definition a tree of modes.

Here's an example:

::

  {
    case_insensitive: true, // language is case-insensitive
    keywords: 'for if while',
    contains: [
      {
        className: 'string',
        begin: '"', end: '"'
      },
      hljs.COMMENT(
        '/\\*', // begin
        '\\*/', // end
        {
          contains: [
            {
              className: 'doc', begin: '@\\w+'
            }
          ]
        }
      )
    ]
  }

Usually the default mode accounts for the majority of the code and describes all language keywords.
A notable exception here is XML in which a default mode is just a user text that doesn't contain any keywords,
and most interesting parsing happens inside tags.


Keywords
--------

In the simple case language keywords are defined in a string, separated by space:

::

  {
    keywords: 'else for if while'
  }

Some languages have different kinds of "keywords" that might not be called as such by the language spec
but are very close to them from the point of view of a syntax highlighter. These are all sorts of "literals", "built-ins", "symbols" and such.
To define such keyword groups the attribute ``keywords`` becomes an object each property of which defines its own group of keywords:

::

  {
    keywords: {
      keyword: 'else for if while',
      literal: 'false true null'
    }
  }

The group name becomes then a class name in a generated markup enabling different styling for different kinds of keywords.

To detect keywords highlight.js breaks the processed chunk of code into separate words — a process called lexing.
The "word" here is defined by the regexp ``[a-zA-Z][a-zA-Z0-9_]*`` that works for keywords in most languages.
Different lexing rules can be defined by the ``lexemes`` attribute:

::

  {
    lexemes '-[a-z]+',
    keywords: '-import -export'
  }


Sub-modes
---------

Sub-modes are listed in the ``contains`` attribute:

::

  {
    keywords: '...',
    contains: [
      hljs.QUOTE_STRING_MODE,
      hljs.C_LINE_COMMENT,
      { ... custom mode definition ... }
    ]
  }

A mode can reference itself in the ``contains`` array by using a special keyword ``'self``'.
This is commonly used to define nested modes:

::

  {
    className: 'object',
    begin: '{', end: '}',
    contains: [hljs.QUOTE_STRING_MODE, 'self']
  }


Comments
--------

To define custom comments it is recommended to use a built-in helper function ``hljs.COMMENT`` instead of describing the mode directly, as it also defines a few default sub-modes that improve language detection and do other nice things.

Parameters for the function are:

::

  hljs.COMMENT(
    begin,      // begin regex
    end,        // end regex
    extra       // optional object with extra attributes to override defaults
                // (for example {relevance: 0})
  )


Markup generation
-----------------

Modes usually generate actual highlighting markup — ```` elements with specific class names that are defined by the ``className`` attribute:

::

  {
    contains: [
      {
        className: 'string',
        // ... other attributes
      },
      {
        className: 'number',
        // ...
      }
    ]
  }

Names are not required to be unique, it's quite common to have several definitions with the same name.
For example, many languages have various syntaxes for strings, comments, etc…

Sometimes modes are defined only to support specific parsing rules and aren't needed in the final markup.
A classic example is an escaping sequence inside strings allowing them to contain an ending quote.

::

  {
    className: 'string',
    begin: '"', end: '"',
    contains: [{begin: '\\\\.'}],
  }

For such modes ``className`` attribute should be omitted so they won't generate excessive markup.


Mode attributes
---------------

Other useful attributes are defined in the :doc:`mode reference `.


.. _relevance:

Relevance
---------

Highlight.js tries to automatically detect the language of a code fragment.
The heuristics is essentially simple: it tries to highlight a fragment with all the language definitions
and the one that yields most specific modes and keywords wins. The job of a language definition
is to help this heuristics by hinting relative relevance (or irrelevance) of modes.

This is best illustrated by example. Python has special kinds of strings defined by prefix letters before the quotes:
``r"..."``, ``u"..."``. If a code fragment contains such strings there is a good chance that it's in Python.
So these string modes are given high relevance:

::

  {
    className: 'string',
    begin: 'r"', end: '"',
    relevance: 10
  }

On the other hand, conventional strings in plain single or double quotes aren't specific to any language
and it makes sense to bring their relevance to zero to lessen statistical noise:

::

  {
    className: 'string',
    begin: '"', end: '"',
    relevance: 0
  }

The default value for relevance is 1. When setting an explicit value it's recommended to use either 10 or 0.

Keywords also influence relevance. Each of them usually has a relevance of 1, but there are some unique names
that aren't likely to be found outside of their languages, even in the form of variable names.
For example just having ``reinterpret_cast`` somewhere in the code is a good indicator that we're looking at C++.
It's worth to set relevance of such keywords a bit higher. This is done with a pipe:

::

  {
    keywords: 'for if reinterpret_cast|10'
  }


Illegal symbols
---------------

Another way to improve language detection is to define illegal symbols for a mode.
For example in Python first line of class definition (``class MyClass(object):``) cannot contain symbol "{" or a newline.
Presence of these symbols clearly shows that the language is not Python and the parser can drop this attempt early.

Illegal symbols are defined as a a single regular expression:

::

  {
    className: 'class',
    illegal: '[${]'
  }


Pre-defined modes and regular expressions
-----------------------------------------

Many languages share common modes and regular expressions. Such expressions are defined in core highlight.js code
at the end under "Common regexps" and "Common modes" titles. Use them when possible.


Contributing
------------

Follow the :doc:`contributor checklist `.
highlight.js-9.12.0/docs/release-process.rst0000644000175000017500000000162013113427226021347 0ustar  infinity0infinity0Release process
===============

Note: this is intended for core committers.

* Update CHANGES.md with everything interesting since the last update.

* Update version numbers using the three-part x.y.z notation everywhere:

  * The header in CHANGES.md (this is where the site looks for the latest version number)
  * ``"version"`` attribute in package.json
  * Two places in docs/conf.py (``version`` and ``release``)

* Commit the version changes and tag the commit with the plain version number (no "v." or anything like that)

* Push the commit and the tags to master (``git push && git push --tags``)

Pushing the tag triggers the update process which can be monitored at http://highlightjs.org/api/release/

When something didn't work *and* it's fixable in code (version numbers mismatch, last minute patches, etc), simply make another release incrementing the third (revision) part of the version number.
highlight.js-9.12.0/docs/line-numbers.rst0000644000175000017500000000433213113427226020656 0ustar  infinity0infinity0Line numbers
============

Highlight.js' notable lack of line numbers support is not an oversight but a
feature. Following is the explanation of this policy from the current project
maintainer (hey guys!):

    One of the defining design principles for highlight.js from the start was
    simplicity. Not the simplicity of code (in fact, it's quite complex) but
    the simplicity of usage and of the actual look of highlighted snippets on
    HTML pages. Many highlighters, in my opinion, are overdoing it with such
    things as separate colors for every single type of lexemes, striped
    backgrounds, fancy buttons around code blocks and — yes — line numbers.
    The more fancy stuff resides around the code the more it distracts a
    reader from understanding it.

    This is why it's not a straightforward decision: this new feature will not
    just make highlight.js better, it might actually make it worse simply by
    making it look more bloated in blog posts around the Internet. This is why
    I'm asking people to show that it's worth it.

    The only real use-case that ever was brought up in support of line numbers
    is referencing code from the descriptive text around it. On my own blog I
    was always solving this either with comments within the code itself or by
    breaking the larger snippets into smaller ones and describing each small
    part separately. I'm not saying that my solution is better. But I don't
    see how line numbers are better either. And the only way to show that they
    are better is to set up some usability research on the subject. I doubt
    anyone would bother to do it.

    Then there's maintenance. So far the core code of highlight.js is
    maintained by only one person — yours truly. Inclusion of any new code in
    highlight.js means that from that moment I will have to fix bugs in it,
    improve it further, make it work together with the rest of the code,
    defend its design. And I don't want to do all this for the feature that I
    consider "evil" and probably will never use myself.

This position is `subject to discuss `_.
Also it doesn't stop anyone from forking the code and maintaining line-numbers implementation separately.
highlight.js-9.12.0/docs/api.rst0000644000175000017500000001013513113427226017025 0ustar  infinity0infinity0Library API
===========

Highlight.js exports a few functions as methods of the ``hljs`` object.


``highlight(name, value, ignore_illegals, continuation)``
---------------------------------------------------------

Core highlighting function.
Accepts a language name, or an alias, and a string with the code to highlight.
The ``ignore_illegals`` parameter, when present and evaluates to a true value,
forces highlighting to finish even in case of detecting illegal syntax for the
language instead of throwing an exception.
The ``continuation`` is an optional mode stack representing unfinished parsing.
When present, the function will restart parsing from this state instead of
initializing a new one.
Returns an object with the following properties:

* ``language``: language name, same as the one passed into a function, returned for consistency with ``highlightAuto``
* ``relevance``: integer value
* ``value``: HTML string with highlighting markup
* ``top``: top of the current mode stack


``highlightAuto(value, languageSubset)``
----------------------------------------

Highlighting with language detection.
Accepts a string with the code to highlight and an optional array of language names and aliases restricting detection to only those languages. The subset can also be set with ``configure``, but the local parameter overrides the option if set.
Returns an object with the following properties:

* ``language``: detected language
* ``relevance``: integer value
* ``value``: HTML string with highlighting markup
* ``second_best``: object with the same structure for second-best heuristically detected language, may be absent


``fixMarkup(value)``
--------------------

Post-processing of the highlighted markup. Currently consists of replacing indentation TAB characters and using ``
`` tags instead of new-line characters. Options are set globally with ``configure``. Accepts a string with the highlighted markup. ``highlightBlock(block)`` ------------------------- Applies highlighting to a DOM node containing code. This function is the one to use to apply highlighting dynamically after page load or within initialization code of third-party Javascript frameworks. The function uses language detection by default but you can specify the language in the ``class`` attribute of the DOM node. See the :doc:`class reference ` for all available language names and aliases. ``configure(options)`` ---------------------- Configures global options: * ``tabReplace``: a string used to replace TAB characters in indentation. * ``useBR``: a flag to generate ``
`` tags instead of new-line characters in the output, useful when code is marked up using a non-``
`` container.
* ``classPrefix``: a string prefix added before class names in the generated markup, used for backwards compatibility with stylesheets.
* ``languages``: an array of language names and aliases restricting auto detection to only these languages.

Accepts an object representing options with the values to updated. Other options don't change
::

  hljs.configure({
    tabReplace: '    ', // 4 spaces
    classPrefix: ''     // don't append class prefix
                        // … other options aren't changed
  })
  hljs.initHighlighting();


``initHighlighting()``
----------------------

Applies highlighting to all ``
..
`` blocks on a page. ``initHighlightingOnLoad()`` ---------------------------- Attaches highlighting to the page load event. ``registerLanguage(name, language)`` ------------------------------------ Adds new language to the library under the specified name. Used mostly internally. * ``name``: a string with the name of the language being registered * ``language``: a function that returns an object which represents the language definition. The function is passed the ``hljs`` object to be able to use common regular expressions defined within it. ``listLanguages()`` ---------------------------- Returns the languages names list. .. _getLanguage: ``getLanguage(name)`` --------------------- Looks up a language by name or alias. Returns the language object if found, ``undefined`` otherwise. highlight.js-9.12.0/docs/style-guide.rst0000644000175000017500000000452313113427226020513 0ustar infinity0infinity0Style guide =========== Key principle ------------- Highlight.js themes are language agnostic. Instead of trying to make a *rich* set of highlightable classes look good in a handful of languages we have a *limited* set of classes that work for all languages. Hence, there are two important implications: * Highlight.js styles tend to be minimalistic. * It's not possible to exactly emulate themes from other highlighting engines. Defining a theme ---------------- A theme is a single CSS defining styles for class names listed in the :doc:`class reference `. The general guideline is to style all available classes, however an author may deliberately choose to exclude some (for example, ``.attr`` is usually left unstyled). You are not required to invent a separate styling for every group of class names, it's perfectly okay to group them: :: .hljs-string, .hljs-section, .hljs-selector-class, .hljs-template-variable, .hljs-deletion { color: #800; } Use as few or as many unique style combinations as you want. Typography and layout dos and don'ts ------------------------------------ Don't use: * non-standard borders/margin/paddings for the root container ``.hljs`` * specific font faces * font size, line height and anything that affects position and size of characters within the container Okay to use: * colors (obviously!) * italic, bold, underlining, etc. * image backgrounds These may seem arbitrary at first but it's what has shown to make sense in practice. There's also a common set of rules that *has* to be defined for the root container verbatim: :: .hljs { display: block; overflow-x: auto; padding: 0.5em; } ``.subst`` ---------- One important caveat: don't forget to style ``.subst``. It's used for parsed sections within strings and almost always should be reset to the default color: :: .hljs, .hljs-subst { color: black; } Contributing ------------ You should include a comment at the top of the CSS file with attribution and other meta data if necessary. The format is free: :: /* Fancy style (c) John Smith */ If you're a new contributor add yourself to the authors list in AUTHORS.*.txt (use either English and/or Russian version). Also update CHANGES.md with your contribution. Send your contribution as a pull request on GitHub. highlight.js-9.12.0/docs/building-testing.rst0000644000175000017500000000627113113427226021532 0ustar infinity0infinity0Building and testing ==================== To actually run highlight.js it is necessary to build it for the environment where you're going to run it: a browser, the node.js server, etc. Building -------- The build tool is written in JavaScript using node.js. Before running the script, make sure to have node installed and run ``npm install`` to get the dependencies. The tool is located in ``tools/build.js``. A few useful examples: * Build for a browser using only common languages:: node tools/build.js :common * Build for node.js including all available languages:: node tools/build.js -t node * Build two specific languages for debugging, skipping compression in this case:: node tools/build.js -n python ruby On some systems the node binary is named ``nodejs``; simply replace ``node`` with ``nodejs`` in the examples above if that is the case. The full option reference is available with the usual ``--help`` option. The build result will be in the ``build/`` directory. .. _basic-testing: Basic testing ------------- The usual approach to debugging and testing a language is first doing it visually. You need to build highlight.js with only the language you're working on (without compression, to have readable code in browser error messages) and then use the Developer tool in ``tools/developer.html`` to see how it highlights a test snippet in that language. A test snippet should be short and give the idea of the overall look of the language. It shouldn't include every possible syntactic element and shouldn't even make practical sense. After you satisfied with the result you need to make sure that language detection still works with your language definition included in the whole suite. Testing is done using `Mocha `_ and the files are found in the ``test/`` directory. You can use the node build to run the tests in the command line with ``npm test`` after installing the dependencies with ``npm install``. **Note**: for Debian-based machine, like Ubuntu, you might need to create an alias or symbolic link for nodejs to node. The reason for this is the dependencies that are requires to test highlight.js has a reference to "node". Place the snippet you used inside the browser in ``test/detect//default.txt``, build the package with all the languages for node and run the test suite. If your language breaks auto-detection, it should be fixed by :ref:`improving relevance `, which is a black art in and of itself. When in doubt, please refer to the discussion group! Testing markup -------------- You can also provide additional markup tests for the language to test isolated cases of various syntactic construct. If your language has 19 different string literals or complicated heuristics for telling division (``/``) apart from regexes (``/ .. /``) -- this is the place. A test case consists of two files: * ``test/markup//.txt``: test code * ``test/markup//.expect.txt``: reference rendering To generate reference rendering use the Developer tool located at ``tools/developer.html``. Make sure to explicitly select your language in the drop-down menu, as automatic detection is unlikely to work in this case. highlight.js-9.12.0/docs/_templates/0000755000175000017500000000000013113427226017657 5ustar infinity0infinity0highlight.js-9.12.0/docs/_templates/.gitkeep0000644000175000017500000000000013113427226021276 0ustar infinity0infinity0highlight.js-9.12.0/docs/language-contribution.rst0000644000175000017500000000470513113427226022562 0ustar infinity0infinity0Language contributor checklist ============================== 1. Put language definition into a .js file ------------------------------------------ The file defines a function accepting a reference to the library and returning a language object. The library parameter is useful to access common modes and regexps. You should not immediately call this function, this is done during the build process and details differ for different build targets. :: function(hljs) { return { keywords: 'foo bar', contains: [ ..., hljs.NUMBER_MODE, ... ] } } The name of the file is used as a short language identifier and should be usable as a class name in HTML and CSS. 2. Provide meta data -------------------- At the top of the file there is a specially formatted comment with meta data processed by a build system. Meta data format is simply key-value pairs each occupying its own line: :: /* Language: Superlanguage Requires: java.js, sql.js Author: John Smith Contributors: Mike Johnson <...@...>, Matt Wilson <...@...> Description: Some cool language definition */ ``Language`` — the only required header giving a human-readable language name. ``Requires`` — a list of other language files required for this language to work. This make it possible to describe languages that extend definitions of other ones. Required files aren't processed in any special way. The build system just makes sure that they will be in the final package in ``LANGUAGES`` object. The meaning of the other headers is pretty obvious. 3. Create a code example ------------------------ The code example is used both to test language detection and for the demo page on https://highlightjs.org/. Put it in ``test/detect//default.txt``. Take inspiration from other languages in ``test/detect/`` and read :ref:`testing instructions ` for more details. 4. Write class reference ------------------------ Class reference lives in the :doc:`CSS classes reference `.. Describe shortly names of all meaningful modes used in your language definition. 5. Add yourself to AUTHORS.*.txt and CHANGES.md ----------------------------------------------- If you're a new contributor add yourself to the authors list. Feel free to use either English and/or Russian version. Also it will be good to update CHANGES.md. 6. Create a pull request ------------------------ Send your contribution as a pull request on GitHub. highlight.js-9.12.0/docs/css-classes-reference.rst0000644000175000017500000010207413113427226022437 0ustar infinity0infinity0CSS classes reference ===================== Stylable classes ---------------- +------------------------------------------------------------------------------+ | **General-purpose** | +--------------------------+---------------------------------------------------+ | keyword | keyword in a regular Algol-style language | +--------------------------+---------------------------------------------------+ | built_in | built-in or library object (constant, class, | | | function) | +--------------------------+---------------------------------------------------+ | type | user-defined type in a language with first-class | | | syntactically significant types, like Haskell | +--------------------------+---------------------------------------------------+ | literal | special identifier for a built-in value ("true", | | | "false", "null") | +--------------------------+---------------------------------------------------+ | number | number, including units and modifiers, if any. | +--------------------------+---------------------------------------------------+ | regexp | literal regular expression | +--------------------------+---------------------------------------------------+ | string | literal string, character | +--------------------------+---------------------------------------------------+ | subst | parsed section inside a literal string | +--------------------------+---------------------------------------------------+ | symbol | symbolic constant, interned string, goto label | +--------------------------+---------------------------------------------------+ | class | class or class-level declaration (interfaces, | | | traits, modules, etc) | +--------------------------+---------------------------------------------------+ | function | function or method declaration | +--------------------------+---------------------------------------------------+ | title | name of a class or a function at the place of | | | declaration | +--------------------------+---------------------------------------------------+ | params | block of function arguments (parameters) at the | | | place of declaration | +--------------------------+---------------------------------------------------+ | **Meta** | +--------------------------+---------------------------------------------------+ | comment | comment | +--------------------------+---------------------------------------------------+ | doctag | documentation markup within comments | +--------------------------+---------------------------------------------------+ | meta | flags, modifiers, annotations, processing | | | instructions, preprocessor directive, etc | +--------------------------+---------------------------------------------------+ | meta-keyword | keyword or built-in within meta construct | +--------------------------+---------------------------------------------------+ | meta-string | string within meta construct | +--------------------------+---------------------------------------------------+ | **Tags, attributes, configs** | +--------------------------+---------------------------------------------------+ | section | heading of a section in a config file, heading in | | | text markup | +--------------------------+---------------------------------------------------+ | tag | XML/HTML tag | +--------------------------+---------------------------------------------------+ | name | name of an XML tag, the first word in an | | | s-expression | +--------------------------+---------------------------------------------------+ | builtin-name | s-expression name from the language standard | | | library | +--------------------------+---------------------------------------------------+ | attr | name of an attribute with no language defined | | | semantics (keys in JSON, setting names in .ini), | | | also sub-attribute within another highlighted | | | object, like XML tag | +--------------------------+---------------------------------------------------+ | attribute | name of an attribute followed by a structured | | | value part, like CSS properties | +--------------------------+---------------------------------------------------+ | variable | variable in a config or a template file, | | | environment var expansion in a script | +--------------------------+---------------------------------------------------+ | **Markup** | +--------------------------+---------------------------------------------------+ | bullet | list item bullet in text markup | +--------------------------+---------------------------------------------------+ | code | code block in text markup | +--------------------------+---------------------------------------------------+ | emphasis | emphasis in text markup | +--------------------------+---------------------------------------------------+ | strong | strong emphasis in text markup | +--------------------------+---------------------------------------------------+ | formula | mathematical formula in text markup | +--------------------------+---------------------------------------------------+ | link | hyperlink in text markup | +--------------------------+---------------------------------------------------+ | quote | quotation in text markup | +--------------------------+---------------------------------------------------+ | **CSS** | +--------------------------+---------------------------------------------------+ | selector-tag | tag selector in CSS | +--------------------------+---------------------------------------------------+ | selector-id | #id selector in CSS | +--------------------------+---------------------------------------------------+ | selector-class | .class selector in CSS | +--------------------------+---------------------------------------------------+ | selector-attr | [attr] selector in CSS | +--------------------------+---------------------------------------------------+ | selector-pseudo | :pseudo selector in CSS | +--------------------------+---------------------------------------------------+ | **Templates** | +--------------------------+---------------------------------------------------+ | template-tag | tag of a template language | +--------------------------+---------------------------------------------------+ | template-variable | variable in a template language | +--------------------------+---------------------------------------------------+ | **diff** | +--------------------------+---------------------------------------------------+ | addition | added or changed line in a diff | +--------------------------+---------------------------------------------------+ | deletion | deleted line in a diff | +--------------------------+---------------------------------------------------+ Language names and aliases -------------------------- +-------------------------+---------------------------------------------------+ | 1C | 1c | +-------------------------+---------------------------------------------------+ | ABNF | abnf | +-------------------------+---------------------------------------------------+ | Access logs | accesslog | +-------------------------+---------------------------------------------------+ | Ada | ada | +-------------------------+---------------------------------------------------+ | ARM assembler | armasm, arm | +-------------------------+---------------------------------------------------+ | AVR assembler | avrasm | +-------------------------+---------------------------------------------------+ | ActionScript | actionscript, as | +-------------------------+---------------------------------------------------+ | Apache | apache, apacheconf | +-------------------------+---------------------------------------------------+ | AppleScript | applescript, osascript | +-------------------------+---------------------------------------------------+ | AsciiDoc | asciidoc, adoc | +-------------------------+---------------------------------------------------+ | AspectJ | aspectj | +-------------------------+---------------------------------------------------+ | AutoHotkey | autohotkey | +-------------------------+---------------------------------------------------+ | AutoIt | autoit | +-------------------------+---------------------------------------------------+ | Awk | awk, mawk, nawk, gawk | +-------------------------+---------------------------------------------------+ | Axapta | axapta | +-------------------------+---------------------------------------------------+ | Bash | bash, sh, zsh | +-------------------------+---------------------------------------------------+ | Basic | basic | +-------------------------+---------------------------------------------------+ | BNF | bnf | +-------------------------+---------------------------------------------------+ | Brainfuck | brainfuck, bf | +-------------------------+---------------------------------------------------+ | C# | cs, csharp | +-------------------------+---------------------------------------------------+ | C++ | cpp, c, cc, h, c++, h++, hpp | +-------------------------+---------------------------------------------------+ | C/AL | cal | +-------------------------+---------------------------------------------------+ | Cache Object Script | cos, cls | +-------------------------+---------------------------------------------------+ | CMake | cmake, cmake.in | +-------------------------+---------------------------------------------------+ | Coq | coq | +-------------------------+---------------------------------------------------+ | CSP | csp | +-------------------------+---------------------------------------------------+ | CSS | css | +-------------------------+---------------------------------------------------+ | Cap’n Proto | capnproto, capnp | +-------------------------+---------------------------------------------------+ | Clojure | clojure, clj | +-------------------------+---------------------------------------------------+ | CoffeeScript | coffeescript, coffee, cson, iced | +-------------------------+---------------------------------------------------+ | Crmsh | crmsh, crm, pcmk | +-------------------------+---------------------------------------------------+ | Crystal | crystal, cr | +-------------------------+---------------------------------------------------+ | D | d | +-------------------------+---------------------------------------------------+ | DNS Zone file | dns, zone, bind | +-------------------------+---------------------------------------------------+ | DOS | dos, bat, cmd | +-------------------------+---------------------------------------------------+ | Dart | dart | +-------------------------+---------------------------------------------------+ | Delphi | delphi, dpr, dfm, pas, pascal, freepascal, | | | lazarus, lpr, lfm | +-------------------------+---------------------------------------------------+ | Diff | diff, patch | +-------------------------+---------------------------------------------------+ | Django | django, jinja | +-------------------------+---------------------------------------------------+ | Dockerfile | dockerfile, docker | +-------------------------+---------------------------------------------------+ | dsconfig | dsconfig | +-------------------------+---------------------------------------------------+ | DTS (Device Tree) | dts | +-------------------------+---------------------------------------------------+ | Dust | dust, dst | +-------------------------+---------------------------------------------------+ | EBNF | ebnf | +-------------------------+---------------------------------------------------+ | Elixir | elixir | +-------------------------+---------------------------------------------------+ | Elm | elm | +-------------------------+---------------------------------------------------+ | Erlang | erlang, erl | +-------------------------+---------------------------------------------------+ | Excel | excel, xls, xlsx | +-------------------------+---------------------------------------------------+ | F# | fsharp, fs | +-------------------------+---------------------------------------------------+ | FIX | fix | +-------------------------+---------------------------------------------------+ | Fortran | fortran, f90, f95 | +-------------------------+---------------------------------------------------+ | G-Code | gcode, nc | +-------------------------+---------------------------------------------------+ | Gams | gams, gms | +-------------------------+---------------------------------------------------+ | GAUSS | gauss, gss | +-------------------------+---------------------------------------------------+ | Gherkin | gherkin | +-------------------------+---------------------------------------------------+ | Go | go, golang | +-------------------------+---------------------------------------------------+ | Golo | golo, gololang | +-------------------------+---------------------------------------------------+ | Gradle | gradle | +-------------------------+---------------------------------------------------+ | Groovy | groovy | +-------------------------+---------------------------------------------------+ | HTML, XML | xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist | +-------------------------+---------------------------------------------------+ | HTTP | http, https | +-------------------------+---------------------------------------------------+ | Haml | haml | +-------------------------+---------------------------------------------------+ | Handlebars | handlebars, hbs, html.hbs, html.handlebars | +-------------------------+---------------------------------------------------+ | Haskell | haskell, hs | +-------------------------+---------------------------------------------------+ | Haxe | haxe, hx | +-------------------------+---------------------------------------------------+ | Hy | hy, hylang | +-------------------------+---------------------------------------------------+ | Ini | ini | +-------------------------+---------------------------------------------------+ | Inform7 | inform7, i7 | +-------------------------+---------------------------------------------------+ | IRPF90 | irpf90 | +-------------------------+---------------------------------------------------+ | JSON | json | +-------------------------+---------------------------------------------------+ | Java | java, jsp | +-------------------------+---------------------------------------------------+ | JavaScript | javascript, js, jsx | +-------------------------+---------------------------------------------------+ | Leaf | leaf | +-------------------------+---------------------------------------------------+ | Lasso | lasso, ls, lassoscript | +-------------------------+---------------------------------------------------+ | Less | less | +-------------------------+---------------------------------------------------+ | LDIF | ldif | +-------------------------+---------------------------------------------------+ | Lisp | lisp | +-------------------------+---------------------------------------------------+ | LiveCode Server | livecodeserver | +-------------------------+---------------------------------------------------+ | LiveScript | livescript, ls | +-------------------------+---------------------------------------------------+ | Lua | lua | +-------------------------+---------------------------------------------------+ | Makefile | makefile, mk, mak | +-------------------------+---------------------------------------------------+ | Markdown | markdown, md, mkdown, mkd | +-------------------------+---------------------------------------------------+ | Mathematica | mathematica, mma | +-------------------------+---------------------------------------------------+ | Matlab | matlab | +-------------------------+---------------------------------------------------+ | Maxima | maxima | +-------------------------+---------------------------------------------------+ | Maya Embedded Language | mel | +-------------------------+---------------------------------------------------+ | Mercury | mercury | +-------------------------+---------------------------------------------------+ | Mizar | mizar | +-------------------------+---------------------------------------------------+ | Mojolicious | mojolicious | +-------------------------+---------------------------------------------------+ | Monkey | monkey | +-------------------------+---------------------------------------------------+ | Moonscript | moonscript, moon | +-------------------------+---------------------------------------------------+ | N1QL | n1ql | +-------------------------+---------------------------------------------------+ | NSIS | nsis | +-------------------------+---------------------------------------------------+ | Nginx | nginx, nginxconf | +-------------------------+---------------------------------------------------+ | Nimrod | nimrod, nim | +-------------------------+---------------------------------------------------+ | Nix | nix | +-------------------------+---------------------------------------------------+ | OCaml | ocaml, ml | +-------------------------+---------------------------------------------------+ | Objective C | objectivec, mm, objc, obj-c | +-------------------------+---------------------------------------------------+ | OpenGL Shading Language | glsl | +-------------------------+---------------------------------------------------+ | OpenSCAD | openscad, scad | +-------------------------+---------------------------------------------------+ | Oracle Rules Language | ruleslanguage | +-------------------------+---------------------------------------------------+ | Oxygene | oxygene | +-------------------------+---------------------------------------------------+ | PF | pf, pf.conf | +-------------------------+---------------------------------------------------+ | PHP | php, php3, php4, php5, php6 | +-------------------------+---------------------------------------------------+ | Parser3 | parser3 | +-------------------------+---------------------------------------------------+ | Perl | perl, pl, pm | +-------------------------+---------------------------------------------------+ | Pony | pony | +-------------------------+---------------------------------------------------+ | PowerShell | powershell, ps | +-------------------------+---------------------------------------------------+ | Processing | processing | +-------------------------+---------------------------------------------------+ | Prolog | prolog | +-------------------------+---------------------------------------------------+ | Protocol Buffers | protobuf | +-------------------------+---------------------------------------------------+ | Puppet | puppet, pp | +-------------------------+---------------------------------------------------+ | Python | python, py, gyp | +-------------------------+---------------------------------------------------+ | Python profiler results | profile | +-------------------------+---------------------------------------------------+ | Q | k, kdb | +-------------------------+---------------------------------------------------+ | QML | qml | +-------------------------+---------------------------------------------------+ | R | r | +-------------------------+---------------------------------------------------+ | RenderMan RIB | rib | +-------------------------+---------------------------------------------------+ | RenderMan RSL | rsl | +-------------------------+---------------------------------------------------+ | Roboconf | graph, instances | +-------------------------+---------------------------------------------------+ | Ruby | ruby, rb, gemspec, podspec, thor, irb | +-------------------------+---------------------------------------------------+ | Rust | rust, rs | +-------------------------+---------------------------------------------------+ | SCSS | scss | +-------------------------+---------------------------------------------------+ | SQL | sql | +-------------------------+---------------------------------------------------+ | STEP Part 21 | p21, step, stp | +-------------------------+---------------------------------------------------+ | Scala | scala | +-------------------------+---------------------------------------------------+ | Scheme | scheme | +-------------------------+---------------------------------------------------+ | Scilab | scilab, sci | +-------------------------+---------------------------------------------------+ | Shell | shell, console | +-------------------------+---------------------------------------------------+ | Smali | smali | +-------------------------+---------------------------------------------------+ | Smalltalk | smalltalk, st | +-------------------------+---------------------------------------------------+ | Stan | stan | +-------------------------+---------------------------------------------------+ | Stata | stata | +-------------------------+---------------------------------------------------+ | Stylus | stylus, styl | +-------------------------+---------------------------------------------------+ | SubUnit | subunit | +-------------------------+---------------------------------------------------+ | Swift | swift | +-------------------------+---------------------------------------------------+ | Test Anything Protocol | tap | +-------------------------+---------------------------------------------------+ | Tcl | tcl, tk | +-------------------------+---------------------------------------------------+ | TeX | tex | +-------------------------+---------------------------------------------------+ | Thrift | thrift | +-------------------------+---------------------------------------------------+ | TP | tp | +-------------------------+---------------------------------------------------+ | Twig | twig, craftcms | +-------------------------+---------------------------------------------------+ | TypeScript | typescript, ts | +-------------------------+---------------------------------------------------+ | VB.Net | vbnet, vb | +-------------------------+---------------------------------------------------+ | VBScript | vbscript, vbs | +-------------------------+---------------------------------------------------+ | VHDL | vhdl | +-------------------------+---------------------------------------------------+ | Vala | vala | +-------------------------+---------------------------------------------------+ | Verilog | verilog, v | +-------------------------+---------------------------------------------------+ | Vim Script | vim | +-------------------------+---------------------------------------------------+ | x86 Assembly | x86asm | +-------------------------+---------------------------------------------------+ | XL | xl, tao | +-------------------------+---------------------------------------------------+ | XQuery | xpath, xq | +-------------------------+---------------------------------------------------+ | Zephir | zephir, zep | +-------------------------+---------------------------------------------------+ highlight.js-9.12.0/docs/reference.rst0000644000175000017500000002304513113427226020216 0ustar infinity0infinity0Mode reference ============== Types ----- Types of attributes values in this reference: +------------+-------------------------------------------------------------------------------------+ | identifier | String suitable to be used as a Javascript variable and CSS class name | | | (i.e. mostly ``/[A-Za-z0-9_]+/``) | +------------+-------------------------------------------------------------------------------------+ | regexp | String representing a Javascript regexp. | | | Note that since it's not a literal regexp all back-slashes should be repeated twice | +------------+-------------------------------------------------------------------------------------+ | boolean | Javascript boolean: ``true`` or ``false`` | +------------+-------------------------------------------------------------------------------------+ | number | Javascript number | +------------+-------------------------------------------------------------------------------------+ | object | Javascript object: ``{ ... }`` | +------------+-------------------------------------------------------------------------------------+ | array | Javascript array: ``[ ... ]`` | +------------+-------------------------------------------------------------------------------------+ Attributes ---------- case_insensitive ^^^^^^^^^^^^^^^^ **type**: boolean Case insensitivity of language keywords and regexps. Used only on the top-level mode. aliases ^^^^^^^ **type**: array A list of additional names (besides the canonical one given by the filename) that can be used to identify a language in HTML classes and in a call to :ref:`getLanguage `. className ^^^^^^^^^ **type**: identifier The name of the mode. It is used as a class name in HTML markup. Multiple modes can have the same name. This is useful when a language has multiple variants of syntax for one thing like string in single or double quotes. begin ^^^^^ **type**: regexp Regular expression starting a mode. For example a single quote for strings or two forward slashes for C-style comments. If absent, ``begin`` defaults to a regexp that matches anything, so the mode starts immediately. end ^^^ **type**: regexp Regular expression ending a mode. For example a single quote for strings or "$" (end of line) for one-line comments. It's often the case that a beginning regular expression defines the entire mode and doesn't need any special ending. For example a number can be defined with ``begin: "\\b\\d+"`` which spans all the digits. If absent, ``end`` defaults to a regexp that matches anything, so the mode ends immediately. Sometimes a mode can end not by itself but implicitly with its containing (parent) mode. This is achieved with :ref:`endsWithParent ` attribute. beginKeywords ^^^^^^^^^^^^^^^^ **type**: string Used instead of ``begin`` for modes starting with keywords to avoid needless repetition: :: { begin: '\\b(extends|implements) ', keywords: 'extends implements' } … becomes: :: { beginKeywords: 'extends implements' } Unlike the :ref:`keywords ` attribute, this one allows only a simple list of space separated keywords. If you do need additional features of ``keywords`` or you just need more keywords for this mode you may include ``keywords`` along with ``beginKeywords``. .. _endsWithParent: endsWithParent ^^^^^^^^^^^^^^ **type**: boolean A flag showing that a mode ends when its parent ends. This is best demonstrated by example. In CSS syntax a selector has a set of rules contained within symbols "{" and "}". Individual rules separated by ";" but the last one in a set can omit the terminating semicolon: :: p { width: 100%; color: red } This is when ``endsWithParent`` comes into play: :: { className: 'rules', begin: '{', end: '}', contains: [ {className: 'rule', /* ... */ end: ';', endsWithParent: true} ] } .. _endsParent: endsParent ^^^^^^^^^^^^^^ **type**: boolean Forces closing of the parent mode right after the current mode is closed. This is used for modes that don't have an easily expressible ending lexeme but instead could be closed after the last interesting sub-mode is found. Here's an example with two ways of defining functions in Elixir, one using a keyword ``do`` and another using a comma: :: def foo :clear, list do :ok end def foo, do: IO.puts "hello world" Note that in the first case the parameter list after the function title may also include a comma. And iIf we're only interested in highlighting a title we can tell it to end the function definition after itself: :: { className: 'function', beginKeywords: 'def', end: /\B\b/, contains: [ { className: 'title', begin: hljs.IDENT_RE, endsParent: true } ] } (The ``end: /\B\b/`` regex tells function to never end by itself.) .. _lexemes: lexemes ^^^^^^^ **type**: regexp A regular expression that extracts individual lexemes from language text to find :ref:`keywords ` among them. Default value is ``hljs.IDENT_RE`` which works for most languages. .. _keywords: keywords ^^^^^^^^ **type**: object Keyword definition comes in two forms: * ``'for while if else weird_voodoo|10 ... '`` -- a string of space-separated keywords with an optional relevance over a pipe * ``{'keyword': ' ... ', 'literal': ' ... '}`` -- an object whose keys are names of different kinds of keywords and values are keyword definition strings in the first form For detailed explanation see :doc:`Language definition guide `. illegal ^^^^^^^ **type**: regexp A regular expression that defines symbols illegal for the mode. When the parser finds a match for illegal expression it immediately drops parsing the whole language altogether. excludeBegin, excludeEnd ^^^^^^^^^^^^^^^^^^^^^^^^ **type**: boolean Exclude beginning or ending lexemes out of mode's generated markup. For example in CSS syntax a rule ends with a semicolon. However visually it's better not to color it as the rule contents. Having ``excludeEnd: true`` forces a ```` element for the rule to close before the semicolon. returnBegin ^^^^^^^^^^^ **type**: boolean Returns just found beginning lexeme back into parser. This is used when beginning of a sub-mode is a complex expression that should not only be found within a parent mode but also parsed according to the rules of a sub-mode. Since the parser is effectively goes back it's quite possible to create a infinite loop here so use with caution! returnEnd ^^^^^^^^^ **type**: boolean Returns just found ending lexeme back into parser. This is used for example to parse Javascript embedded into HTML. A Javascript block ends with the HTML closing tag ```` that cannot be parsed with Javascript rules. So it is returned back into its parent HTML mode that knows what to do with it. Since the parser is effectively goes back it's quite possible to create a infinite loop here so use with caution! contains ^^^^^^^^ **type**: array The list of sub-modes that can be found inside the mode. For detailed explanation see :doc:`Language definition guide `. starts ^^^^^^ **type**: identifier The name of the mode that will start right after the current mode ends. The new mode won't be contained within the current one. Currently this attribute is used to highlight Javascript and CSS contained within HTML. Tags `` ``` This will find and highlight code inside of `
` tags; it tries
to detect the language automatically. If automatic detection doesn’t
work for you, you can specify the language in the `class` attribute:

```html
...
``` The list of supported language classes is available in the [class reference][2]. Classes can also be prefixed with either `language-` or `lang-`. To disable highlighting altogether use the `nohighlight` class: ```html
...
``` ## Custom Initialization When you need a bit more control over the initialization of highlight.js, you can use the [`highlightBlock`][3] and [`configure`][4] functions. This allows you to control *what* to highlight and *when*. Here’s an equivalent way to calling [`initHighlightingOnLoad`][1] using jQuery: ```javascript $(document).ready(function() { $('pre code').each(function(i, block) { hljs.highlightBlock(block); }); }); ``` You can use any tags instead of `
` to mark up your code. If
you don't use a container that preserve line breaks you will need to
configure highlight.js to use the `
` tag: ```javascript hljs.configure({useBR: true}); $('div.code').each(function(i, block) { hljs.highlightBlock(block); }); ``` For other options refer to the documentation for [`configure`][4]. ## Web Workers You can run highlighting inside a web worker to avoid freezing the browser window while dealing with very big chunks of code. In your main script: ```javascript addEventListener('load', function() { var code = document.querySelector('#code'); var worker = new Worker('worker.js'); worker.onmessage = function(event) { code.innerHTML = event.data; } worker.postMessage(code.textContent); }) ``` In worker.js: ```javascript onmessage = function(event) { importScripts('/highlight.pack.js'); var result = self.hljs.highlightAuto(event.data); postMessage(result.value); } ``` ## Getting the Library You can get highlight.js as a hosted, or custom-build, browser script or as a server module. Right out of the box the browser script supports both AMD and CommonJS, so if you wish you can use RequireJS or Browserify without having to build from source. The server module also works perfectly fine with Browserify, but there is the option to use a build specific to browsers rather than something meant for a server. Head over to the [download page][5] for all the options. **Don't link to GitHub directly.** The library is not supposed to work straight from the source, it requires building. If none of the pre-packaged options work for you refer to the [building documentation][6]. **The CDN-hosted package doesn't have all the languages.** Otherwise it'd be too big. If you don't see the language you need in the ["Common" section][5], it can be added manually: ```html ``` **On Almond.** You need to use the optimizer to give the module a name. For example: ``` r.js -o name=hljs paths.hljs=/path/to/highlight out=highlight.js ``` ## License Highlight.js is released under the BSD License. See [LICENSE][7] file for details. ## Links The official site for the library is at . Further in-depth documentation for the API and other topics is at . Authors and contributors are listed in the [AUTHORS.en.txt][8] file. [1]: http://highlightjs.readthedocs.io/en/latest/api.html#inithighlightingonload [2]: http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html [3]: http://highlightjs.readthedocs.io/en/latest/api.html#highlightblock-block [4]: http://highlightjs.readthedocs.io/en/latest/api.html#configure-options [5]: https://highlightjs.org/download/ [6]: http://highlightjs.readthedocs.io/en/latest/building-testing.html [7]: https://github.com/isagalaev/highlight.js/blob/master/LICENSE [8]: https://github.com/isagalaev/highlight.js/blob/master/AUTHORS.en.txt highlight.js-9.12.0/AUTHORS.ru.txt0000644000175000017500000003057313113427226017115 0ustar infinity0infinity0Подсветка синтаксиса с автоопределением языка. URL: https://highlightjs.org/ Ключевые разработчики (в порядке появления): - Иван Сагалаев (первоначальный автор) - Джереми Халл - Олег Ефимов Внесли свой вклад: - Петр Леонов - Виктор Карамзин - Всеволод Соловьёв - Антон Ковалёв - Никита Ледяев - Константин Евдокименко - Дмитрий Рудаков - Юрий Иванов - Владимир Ермаков - Владимир Губарьков - Брайан Бек - MajestiC - Василий Половнёв - Владимир Епифанов - Александр Макаров - Vah - Шуэн-Хуэй Гуан - Джейсон Даймонд - Михал Габрукевич - Руслан Кеба - Сергей Баранов - Зарипов Юра - Олег Волчков - Василий Михайличенко - Ян Беркель - Владимир Москва - Лорен Сегал - Андрей Фёдоров - Игорь Кальницкий - Валерий Хиора - Николай Захаров - Дмитрий Ковега - Сергей Игнатов - Антоно Васильев - Степан Кунцьо - pumbur - Джон Крепецци - Андрей Власовских - Александр Мядзель - Евгений Степанищев - Дмитрий Нагирняк - Луиджи Мазелли - Денис Бардадым - Аахан Криш - Илья Барышев - Александр Ружичич - Джо Ченг - Анхель Ойоки - Джейсон Тейт - Сергей Тихомиров - Марк Форнос - Йошихиде Джимбо - Кейси Данкан - Евгений Нижибицкий - Альберто Гимено - Кирк Киммель - Натан Григг - Dr. Drang - Робин Ворд - Дмитрий Медвинский - Джейсон Джейкобсон - Йонас Фоллесо - Ден Аллен - noformnocontent - Дамиен Вайт - Александр Маренин - Седрик Нееми - Саймон Мадин - Бенджамин Паннел - Эрик Книббе - Порен Чянь - Келли ван Эверт - Курт Эмч - Мейди Догги - Николя Бро-Сантони - Ральф Биттер - Сильвестр Ледру - Трой Кершоу - Зена Трип - Даниэль Квасничка - Карло Кок - Брэм де Хаан - Сенгвон Ли - Завен Мурадян - Ян Т. Сотт - Брент Брэдбери - Мартин Дилинг-Хэнсен - Илья Вассилевский - Джош Адамс - Дан Тао - Джеф Эскаланте - Джун Янг - Николай Лисиенко - Хейко Август - Домен Кожар - Трэвис Одом - innocenat - Артур Бикмуллин - Паскаль Хурни - Роман Шматов - Ник Вест - Пану Хорсмалахти - Флавиу Тамас - Дамьен Ми - Кристофер Кастер - Крис Еидхоф - Нейт Кук - Мэтт Дайпхауз - Эрик Осхейм - Гийом Ляфорж - Лукас Мазза - Максим Дикун - Хенрик Фельдт - Антон Кочков - Михаэль Аллен - Д.П. Веркамп - Адам Джозеф Кук - Сергей Видюк - Радэк Лиска - Хосе Молина Колменеро - Макс Михайлов - Брайант Вильямс - Эрик Палука - Люк Холдер - Дэвид Мохундро - Николас Блумхардт - Кристоф де Денишен - Танели Ватанен - Джен Эверс-Корвина - Кассио Борхес - Седрик Зорауер - Микаэль Делахэй - Хакан Озлер - Трей Шугарт - Винсен Зуржак - Адам Жозеф Кук - Эдвин Далорсо - mucaho - Деннис Титце - Джон Эванс - Брайан Куисторф - Жоначан Суевер - Алексис Эно - Крис Кихл - Петер Пивоварски - Кента Сато - Энтони Скемама - Тофик Нурроман - Педро Оливейра - Гу Илинь - Томас Аппленкур - Эндрю Фармер - Сергей Машков - Райво Ляэнеметс - Кеннет Фаглсанг - Дэвид Ансон - Льюис Барранкуэйро - Тим Шумахер - Лукас Веркмайстер - Ден Панзарелла - Бруно Диаз - Джей Стрибис - Гийом Гомес - Янис Фойгтлэндер - Дирк Кирстен - MY Sun - Vadimtro - Бенджамин Одер - Дотан Димет - Ман Туан - Филипп Шарьер - Стефан Бечерт - Сэмюел Рид - Юрий Селиванов - Цуюсато Кицуне - Мик МаКаллум - Кристофер Гронлунд - Сорен Эневолдсен - Даниэль Розенвассен - Ладислав Пршкавеч - Ян Кюле - Стефан Винерт - Никита Савченко - Стефания Мелай - Небулеон Фумика - prince - Брэндан Рокс - Рафаэль Ассенат - Мэт Эванс - Мартин Браун - Боря Черный - Джон Фостер - Робер Додье - Антони Дюгуа - Qeole - Денис Сиккале - Майкл Джонстон - Тарас - Филипп Вольфер - Микко Коухиа - Билли Куит - Герберт Шин - Тристано Аймоне - Тайсуке Фудзимото - Бооне Северсон - Виктор Жоу - Ларс Шульна - Джейкоб Чайлдресс - Гавин Сиу - Builder's Brewery - Сергей Бронников - Джо Эли Макилвейн - Стефан Боер - Алекс МакКиббен - Дэниел Гэмадж - Мэттью Дэли - Магнус Мэдсен - Камил Стапс - Александер Лихтер - Николя Ле Галль - Кентон Хамалуик - Марвин Сайнат - Михаель Родлер - Сергей Собко - Хейл Чан - Мэт Эванс - Каспер Андерсен - Филипп А. - Гуаннан Вей - Сэм Ву - Айк Ку - Андрес Тахт - Рене Саарсо - Джорди Петит - Рафаэль Паре - Джоель Порке - Алекс Арслан - Станислав Белов - Иван Дементьев - Николя Ллобера - Мортен Пибелехт - Мартин Клаузен highlight.js-9.12.0/tools/0000755000175000017500000000000013113427226015732 5ustar infinity0infinity0highlight.js-9.12.0/tools/tasks.js0000644000175000017500000001547013113427226017424 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let del = require('del'); let gear = require('gear'); let path = require('path'); let utility = require('./utility'); let parseHeader = utility.parseHeader; let tasks = require('gear-lib'); tasks.clean = function(directories, blobs, done) { directories = _.isString(directories) ? [directories] : directories; return del(directories).then(() => done(null, blobs)); }; tasks.clean.type = 'collect'; // Depending on the languages required for the current language being // processed, this task reorders it's dependencies first then include the // language. tasks.reorderDeps = function(options, blobs, done) { let buffer = {}, newBlobOrder = []; _.each(blobs, function(blob) { let basename = path.basename(blob.name), fileInfo = parseHeader(blob.result), extra = { blob: blob, processed: false }; buffer[basename] = _.merge(extra, fileInfo || {}); }); function pushInBlob(object) { if(!object.processed) { object.processed = true; newBlobOrder.push(object.blob); } } _.each(buffer, function(buf) { let object; if(buf.Requires) { _.each(buf.Requires, function(language) { object = buffer[language]; pushInBlob(object); }); } pushInBlob(buf); }); done(null, newBlobOrder); }; tasks.reorderDeps.type = 'collect'; tasks.template = function(template, blob, done) { template = template || ''; let filename = path.basename(blob.name), basename = path.basename(filename, '.js'), content = _.template(template)({ name: basename, filename: filename, content: blob.result.trim() }); return done(null, new gear.Blob(content, blob)); }; tasks.templateAll = function(options, blobs, done) { return options.callback(blobs) .then(function(data) { let template = options.template || data.template, content = _.template(template)(data); return done(null, [new gear.Blob(content)]); }) .catch(done); }; tasks.templateAll.type = 'collect'; tasks.rename = function(options, blob, done) { options = options || {}; let name = blob.name, ext = new RegExp(path.extname(name) + '$'); name = name.replace(ext, options.extname); return done(null, new gear.Blob(blob.result, { name: name })); }; // Adds the contributors from `AUTHORS.en.txt` onto the `package.json` file // and moves the result into the `build` directory. tasks.buildPackage = function(json, blob, done) { let result, lines = blob.result.split(/\r?\n/), regex = /^- (.*) <(.*)>$/; json.contributors = _.transform(lines, function(result, line) { let matches = line.match(regex); if(matches) { result.push({ name: matches[1], email: matches[2] }); } }, []); result = JSON.stringify(json, null, ' '); return done(null, new gear.Blob(result, blob)); }; // Mainly for replacing the keys of `utility.REPLACES` for it's values while // skipping over strings, regular expressions, or comments. However, this is // pretty generic so long as you use the `utility.replace` function, you can // replace a regular expression with a string. tasks.replaceSkippingStrings = function(params, blob, done) { let content = blob.result, length = content.length, offset = 0, replace = params.replace || '', regex = params.regex, starts = /\/\/|['"\/]/, result = [], chunk, end, match, start, terminator; while(offset < length) { chunk = content.slice(offset); match = chunk.match(starts); end = match ? match.index : length; chunk = content.slice(offset, end + offset); result.push(chunk.replace(regex, replace)); offset += end; if(match) { // We found a starter sequence: either a `//` or a "quote" // In the case of `//` our terminator is the end of line. // Otherwise it's either a matching quote or an escape symbol. terminator = match[0] !== '//' ? new RegExp(`[${match[0]}\\\\]`) : /$/m; start = offset; offset += 1; while(true) { chunk = content.slice(offset); match = chunk.match(terminator); if(!match) { return done('Unmatched quote'); } if(match[0] === '\\') { offset += match.index + 2; } else { offset += match.index + 1; result.push(content.slice(start, offset)); break; } } } } return done(null, new gear.Blob(result.join(''), blob)); }; tasks.filter = function(callback, blobs, done) { let filteredBlobs = _.filter(blobs, callback); // Re-add in blobs required from header definition _.each(filteredBlobs, function(blob) { let dirname = path.dirname(blob.name), content = blob.result, fileInfo = parseHeader(content); if(fileInfo && fileInfo.Requires) { _.each(fileInfo.Requires, function(language) { let filename = `${dirname}/${language}`, fileFound = _.find(filteredBlobs, { name: filename }); if(!fileFound) { filteredBlobs.push( _.find(blobs, { name: filename })); } }); } }); return done(null, filteredBlobs); }; tasks.filter.type = 'collect'; tasks.readSnippet = function(options, blob, done) { let name = path.basename(blob.name, '.js'), fileInfo = parseHeader(blob.result), snippetName = path.join('test', 'detect', name, 'default.txt'); function onRead(error, blob) { if(error) return done(error); // ignore missing snippets let meta = { name: `${name}.js`, fileInfo: fileInfo }; return done(null, new gear.Blob(blob.result, meta)); } gear.Blob.readFile(snippetName, 'utf8', onRead, false); }; tasks.insertLicenseTag = function(options, blob, done) { let hljsVersion = require('../package').version, licenseTag = `/*! highlight.js v${hljsVersion} | ` + `BSD3 License | git.io/hljslicense */\n`; return done(null, new gear.Blob(licenseTag + blob.result, blob)); }; // Packages up included languages into the core `highlight.js` and moves the // result into the `build` directory. tasks.packageFiles = function(options, blobs, done) { let content, coreFile = _.head(blobs), languages = _.tail(blobs), lines = coreFile.result .replace(utility.regex.header, '') .split('\n\n'), lastLine = _.last(lines), langStr = _.reduce(languages, (str, language) => `${str + language.result}\n`, ''); lines[lines.length - 1] = langStr.trim(); lines = lines.concat(lastLine); content = lines.join('\n\n'); return done(null, [new gear.Blob(content)]); }; tasks.packageFiles.type = 'collect'; module.exports = new gear.Registry({ tasks: tasks }); highlight.js-9.12.0/tools/utility.js0000644000175000017500000001045413113427226017777 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let bluebird = require('bluebird'); let glob = bluebird.promisify(require('glob')); let path = require('path'); let Queue = require('gear').Queue; let regex = {}, headerRegex = /^\s*\/\*((.|\r?\n)*?)\*/; const REPLACES = { 'case_insensitive': 'cI', 'lexemes': 'l', 'contains': 'c', 'keywords': 'k', 'subLanguage': 'sL', 'className': 'cN', 'begin': 'b', 'beginKeywords': 'bK', 'end': 'e', 'endsWithParent': 'eW', 'illegal': 'i', 'excludeBegin': 'eB', 'excludeEnd': 'eE', 'returnBegin': 'rB', 'returnEnd': 'rE', 'relevance': 'r', 'variants': 'v', 'IDENT_RE': 'IR', 'UNDERSCORE_IDENT_RE': 'UIR', 'NUMBER_RE': 'NR', 'C_NUMBER_RE': 'CNR', 'BINARY_NUMBER_RE': 'BNR', 'RE_STARTERS_RE': 'RSR', 'BACKSLASH_ESCAPE': 'BE', 'APOS_STRING_MODE': 'ASM', 'QUOTE_STRING_MODE': 'QSM', 'PHRASAL_WORDS_MODE': 'PWM', 'C_LINE_COMMENT_MODE': 'CLCM', 'C_BLOCK_COMMENT_MODE': 'CBCM', 'HASH_COMMENT_MODE': 'HCM', 'NUMBER_MODE': 'NM', 'C_NUMBER_MODE': 'CNM', 'BINARY_NUMBER_MODE': 'BNM', 'CSS_NUMBER_MODE': 'CSSNM', 'REGEXP_MODE': 'RM', 'TITLE_MODE': 'TM', 'UNDERSCORE_TITLE_MODE': 'UTM', 'COMMENT': 'C', 'beginRe': 'bR', 'endRe': 'eR', 'illegalRe': 'iR', 'lexemesRe': 'lR', 'terminators': 't', 'terminator_end': 'tE' }; regex.replaces = new RegExp( `\\b(${Object.keys(REPLACES).join('|')})\\b`, 'g'); regex.classname = /(block|parentNode)\.cN/g; regex.header = /^\s*(\/\*((.|\r?\n)*?)\*\/)?\s*/; function replace(from, to) { return { regex: from, replace: to }; } function replaceClassNames(match) { return REPLACES[match]; } // All meta data, for each language definition, it store within the headers // of each file in `src/languages`. `parseHeader` extracts that data and // turns it into a useful object -- mainly for categories and what language // this definition requires. function parseHeader(content) { let headers, match = content.match(headerRegex); if (!match) { return null; } headers = _.compact(match[1].split('\n')); return _.reduce(headers, function(result, header) { let keyVal = header.trim().split(': '), key = keyVal[0], value = keyVal[1] || ''; if(key !== 'Description' && key !== 'Language') { value = value.split(/\s*,\s*/); } result[key] = value; return result; }, {}); } function filterByQualifiers(blob, languages, categories) { if(_.isEmpty(languages) && _.isEmpty(categories)) return true; let language = path.basename(blob.name, '.js'), fileInfo = parseHeader(blob.result), fileCategories = fileInfo.Category || [], containsCategory = _.partial(_.includes, categories); if(!fileInfo) return false; return _.includes(languages, language) || _.some(fileCategories, containsCategory); } // For the filter task in `tools/tasks.js`, this function will look for // categories and languages specificed from the CLI. function buildFilterCallback(qualifiers) { const result = _.partition(qualifiers, { 0: ':' }), languages = result[1], categories = _.map(result[0], category => category.slice(1)); return blob => filterByQualifiers(blob, languages, categories); } function globDefaults(pattern, encoding) { encoding = encoding || 'utf8'; // The limit option is a fix for issue #636 when the build script would // EMFILE error for those systems who had a limit of open files per // process. // // return { pattern: pattern, limit: 50, encoding: encoding }; } function getStyleNames() { let stylesDir = 'src/styles/', options = { ignore: `${stylesDir}default.css` }; return glob(`${stylesDir}*.css`, options) .map(function(style) { let basename = path.basename(style, '.css'), name = _.startCase(basename), pathName = path.relative('src', style); return { path: pathName, name: name }; }); } function toQueue(tasks, registry) { return _.map(tasks, task => new Queue({ registry }).tasks(task)); } module.exports = { buildFilterCallback: buildFilterCallback, getStyleNames: getStyleNames, glob: globDefaults, parseHeader: parseHeader, regex: regex, replace: replace, replaceClassNames: replaceClassNames, toQueue: toQueue }; highlight.js-9.12.0/tools/node.js0000644000175000017500000001063513113427226017222 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let bluebird = require('bluebird'); let path = require('path'); let packageJSON = require('../package'); let registry = require('./tasks'); let utility = require('./utility'); let directory, filterCB, languages = utility.glob(path.join('src', 'languages', '*.js')), header = utility.regex.header; function templateAllFunc(blobs) { const names = _.map(blobs, blob => path.basename(blob.name, '.js')); return bluebird.resolve({ names: names }); } function buildLanguages() { let input = languages, output = path.join(directory.build, 'lib', 'languages'), replaceArgs = utility.replace(header, ''), template = 'module.exports = <%= content %>;'; return { logStart: { task: ['log', 'Building language files.'] }, read: { requires: 'logStart', task: ['glob', input] }, filter: { requires: 'read', task: ['filter', filterCB] }, replace: { requires: 'filter', task: ['replace', replaceArgs] }, template: { requires: 'replace', task: ['template', template] }, writeLog: { requires: 'template', task: ['log', 'Writing language files.'] }, write: { requires: 'writeLog', task: ['dest', output] } }; } function buildCore() { const input = path.join(directory.root, 'src', 'highlight.js'), output = path.join(directory.build, 'lib'); return { startLog: { task: ['log', 'Building core file.'] }, read: { requires: 'startLog', task: ['read', input] }, writeLog: { requires: 'read', task: ['log', 'Writing core file.'] }, write: { requires: 'writeLog', task: ['dest', output] } }; } function buildIndex() { let input = languages, output = path.join(directory.build, 'lib', 'index.js'), templateArgs = { template: [ 'var hljs = require(\'./highlight\');\n' , '<% _.each(names, function(name) { %>' + 'hljs.registerLanguage(\'<%= name %>\', ' + 'require(\'./languages/<%= name %>\'));' , '<% }); %>' , 'module.exports = hljs;' ].join('\n'), callback: templateAllFunc }; return { startLog: { task: ['log', 'Building index file.'] }, read: { requires: 'startLog', task: ['glob', input] }, filter: { requires: 'read', task: ['filter', filterCB] }, reorder: { requires: 'filter', task: 'reorderDeps' }, template: { requires: 'reorder', task: ['templateAll', templateArgs] }, writeLog: { requires: 'template', task: ['log', 'Writing index file.'] }, write: { requires: 'writeLog', task: ['write', output] } }; } function copyMetaFiles() { let docs = path.join('docs', '*.rst'), glob = `{README.md,LICENSE,${docs}}`, input = utility.glob(path.join(directory.root, glob)), output = { dir: directory.build, base: '.' }; return { startLog: { task: ['log', 'Copying meta files.'] }, read: { requires: 'startLog', task: ['glob', input] }, writeLog: { requires: 'read', task: ['log', 'Writing meta files.'] }, write: { requires: 'writeLog', task: ['dest', output] } }; } function buildStyles() { let input = path.join(directory.root, 'src', 'styles', '*'), output = path.join(directory.build, 'styles'), options = { encoding: 'binary', dir: output }; return { startLog: { task: ['log', 'Building style files.'] }, read: { requires: 'startLog', task: ['glob', utility.glob(input, 'binary')] }, writeLog: { requires: 'read', task: ['log', 'Writing style files.'] }, write: { requires: 'writeLog', task: ['dest', options] } }; } function buildPackageFile() { const input = path.join(directory.root, 'AUTHORS.en.txt'), output = path.join(directory.build, 'package.json'); return { startLog: { task: ['log', 'Building package.json file.'] }, read: { requires: 'startLog', task: ['read', input] }, build: { requires: 'read', task: ['buildPackage', packageJSON] }, writeLog: { requires: 'build', task: ['log', 'Writing package.json file.'] }, write: { requires: 'writeLog', task: ['write', output] } }; } module.exports = function(commander, dir) { directory = dir; filterCB = utility.buildFilterCallback(commander.args); let tasks = [ buildLanguages(), buildCore(), buildIndex(), buildStyles(), copyMetaFiles(), buildPackageFile() ]; return utility.toQueue(tasks, registry); }; highlight.js-9.12.0/tools/all.js0000644000175000017500000000155513113427226017046 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let path = require('path'); let cdn = require('./cdn'); let node = require('./node'); let browser = require('./browser'); function newBuildDirectory(dir, subdir) { const build = path.join(dir.build, subdir); return { build: build }; } module.exports = function(commander, dir) { let data = {}; _.each(['cdn', 'node', 'browser'], function(target) { const newDirectory = newBuildDirectory(dir, target), directory = _.defaults(newDirectory, dir), options = _.defaults({ target: target }, commander); data[target] = { directory: directory, commander: options }; }); return [].concat( cdn(data.cdn.commander, data.cdn.directory), node(data.node.commander, data.node.directory), browser(data.browser.commander, data.browser.directory) ); }; highlight.js-9.12.0/tools/keywordsformat.js0000644000175000017500000000053213113427226021350 0ustar infinity0infinity0/** Example */ var all = 'keywords here'; var output = '', line = ''; all.forEach(function (item) { if (12 + 1 + line.length + 1 + item.length + 4 > 120) { output += "\n" + " '" + line + " ' +"; line = ''; return; } if (line) { line = line + ' ' + item; } else { line = item; } }); console.log(output); highlight.js-9.12.0/tools/build.js0000644000175000017500000000667213113427226017402 0ustar infinity0infinity0// For the basic introductions on using this build script, see: // // // // Otherwise, lets explain what each build target does in more detail, for // those that wish to know before running this script. // // Build Targets // ------------- // // * browser // // The default target. This will package up the core `highlight.js` along // with all the language definitions into the file `highlight.pack.js` -- // which will be compressed without including the option to disable it. It // also builds the documentation for our readthedocs page, mentioned // above, along with a local instance of the demo at: // // . // // * cdn // // This will package up the core `highlight.js` along with all the // language definitions into the file `highlight.min.js` and compresses // all languages and styles into separate files. Since the target is for // CDNs -- like cdnjs and jsdelivr -- it doesn't matter if you put the // option to disable compression, this target is always be compressed. Do // keep in mind that we don't keep the build results in the main // repository; however, there is a separate repository for those that want // the CDN builds without using a third party site or building it // themselves. For those curious, head over to: // // // // * node // // This build will transform the library into a CommonJS module. It // includes the generation of an `index.js` file that will be the main // file imported for use with Node.js or browserify. Do note that this // includes all languages by default and it might be too heavy to use for // browserify. Luckily, you can easily do two things to make the build // smaller; either specify the specific language/category you need or you // can use the browser or cdn builds and it will work like any CommonJS // file. Also with the CommonJS module, it includes the documentation for // our readthedocs page and the uncompressed styles. Getting this build is // pretty easy as it is the one that gets published to npm with the // standard `npm install highlight.js`, but you can also visit the package // page at: // // // // * all // // Builds every target and places the results into a sub-directory based // off of the target name relative to the `build` directory; for example, // "node" with go into `build/node`, "cdn" will go into `build/cdn`, // "browser" will go into `build/browser` and so forth. // // All build targets will end up in the `build` directory. 'use strict'; let commander = require('commander'); let path = require('path'); let Queue = require('gear').Queue; let registry = require('./tasks'); let build, dir = {}; commander .usage('[options] [...]') .option('-n, --no-compress', 'Disable compression') .option('-t, --target ', 'Build for target ' + '[all, browser, cdn, node]', /^(browser|cdn|node|all)$/i, 'browser') .parse(process.argv); commander.target = commander.target.toLowerCase(); build = require(`./${commander.target}`); dir.root = path.dirname(__dirname); dir.build = path.join(dir.root, 'build'); new Queue({ registry: registry }) .clean(dir.build) .log('Starting build.') .series(build(commander, dir)) .log('Finished build.') .run(); highlight.js-9.12.0/tools/codeformat.js0000644000175000017500000000245113113427226020415 0ustar infinity0infinity0'use strict'; var _ = require('lodash'); var bluebird = require('bluebird'); var path = require('path'); var glob = bluebird.promisify(require('glob')); var fs = require('fs'); var readFile = bluebird.promisify(fs.readFile); var writeFile = bluebird.promisify(fs.writeFile); var beautify = require('js-beautify').js_beautify; var beautify_options = { "indent_size": 2, "indent_char": " ", "eol": "\n", "indent_level": 0, "indent_with_tabs": false, "preserve_newlines": true, "max_preserve_newlines": 10, "jslint_happy": false, "space_after_anon_function": false, "brace_style": "collapse", "keep_array_indentation": false, "keep_function_indentation": false, "space_before_conditional": true, "break_chained_methods": false, "eval_code": false, "end_with_newline": true }; console.log("Starting formatting."); var sources = path.join('src', 'languages', '*.js'); bluebird.map(glob(sources), function (name) { var basename = path.basename(name, '.js'); return readFile(name).then(function (blob) { return beautify(blob.toString(), beautify_options); }).then(function (blob) { return writeFile(name, blob).then(function () { console.log(" ✓ " + basename); }); }); }).then(function () { console.log("Finished formatting."); }); highlight.js-9.12.0/tools/cdn.js0000644000175000017500000000520213113427226017033 0ustar infinity0infinity0'use strict'; let path = require('path'); let browserBuild = require('./browser'); let registry = require('./tasks'); let utility = require('./utility'); let directory; function moveLanguages() { let input = path.join(directory.root, 'src', 'languages', '*.js'), output = path.join(directory.build, 'languages'), regex = utility.regex, replace = utility.replace, replaceArgs = replace(regex.header, ''), template = 'hljs.registerLanguage(\'<%= name %>\','+ ' <%= content %>);\n'; return { startLog: { task: ['log', 'Building language files.'] }, read: { requires: 'startLog', task: ['glob', utility.glob(input)] }, replace: { requires: 'read', task: ['replace', replaceArgs] }, template: { requires: 'replace', task: ['template', template] }, replace2: { requires: 'template', task: [ 'replaceSkippingStrings' , replace(regex.replaces, utility.replaceClassNames) ] }, replace3: { requires: 'replace2', task: ['replace', replace(regex.classname, '$1.className')] }, compressLog: { requires: 'replace3', task: ['log', 'Compressing languages files.'] }, minify: { requires: 'compressLog', task: 'jsminify' }, rename: { requires: 'minify', task: ['rename', { extname: '.min.js' }] }, writeLog: { requires: 'rename', task: ['log', 'Writing language files.'] }, write: { requires: 'writeLog', task: ['dest', output] } }; } function moveStyles() { const css = path.join(directory.root, 'src', 'styles', '*.css'), images = path.join(directory.root, 'src', 'styles', '*.{jpg,png}'), output = path.join(directory.build, 'styles'), options = { dir: output, encoding: 'binary' }; return { startLog: { task: ['log', 'Building style files.'] }, readCSS: { requires: 'startLog', task: ['glob', utility.glob(css)] }, readImages: { requires: 'startLog', task: ['glob', utility.glob(images, 'binary')] }, compressLog: { requires: 'readCSS', task: ['log', 'Compressing style files.'] }, minify: { requires: 'compressLog', task: 'cssminify' }, rename: { requires: 'minify', task: ['rename', { extname: '.min.css' }] }, writeLog: { requires: ['rename', 'readImages'], task: ['log', 'Writing style files.'] }, write: { requires: 'writeLog', task: ['dest', options] } }; } module.exports = function(commander, dir) { directory = dir; return utility.toQueue([moveLanguages(), moveStyles()], registry) .concat(browserBuild(commander, dir)); }; highlight.js-9.12.0/tools/developer.html0000644000175000017500000000574513113427226020620 0ustar infinity0infinity0 highlight.js developer

highlight.js developer

Language:

Rendered in ... ms [...]

...

Markup

...
highlight.js-9.12.0/tools/browser.js0000644000175000017500000001231613113427226017756 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let bluebird = require('bluebird'); let readFile = bluebird.promisify(require('fs').readFile); let path = require('path'); let registry = require('./tasks'); let utility = require('./utility'); let directory; function templateAllFunc(blobs) { const name = path.join('demo', 'index.html'); blobs = _.compact(blobs); return bluebird.join( readFile(name), utility.getStyleNames(), (template, styles) => ({ template, path, blobs, styles }) ); } function copyDocs() { const input = path.join(directory.root, 'docs', '*.rst'), output = path.join(directory.build, 'docs'); return { startLog: { task: ['log', 'Copying documentation.'] }, read: { requires: 'startLog', task: ['glob', utility.glob(input)] }, writeLog: { requires: 'read', task: ['log', 'Writing documentation.'] }, write: { requires: 'writeLog', task: ['dest', output] } }; } function generateDemo(filterCB, readArgs) { let styleDir = path.join('src', 'styles'), staticArgs = utility.glob(path.join('demo', '*.min.{js,css}')), imageArgs = utility.glob(path.join(styleDir, '*.{png,jpg}'), 'binary'), stylesArgs = utility.glob(path.join(styleDir, '*.css')), demoRoot = path.join(directory.build, 'demo'), templateArgs = { callback: templateAllFunc }, destArgs = { dir: path.join(demoRoot, 'styles'), encoding: 'binary' }; return { logStart: { task: ['log', 'Generating demo.'] }, readLanguages: { requires: 'logStart', task: ['glob', readArgs] }, filterSnippets: { requires: 'readLanguages', task: ['filter', filterCB] }, readSnippet: { requires: 'filterSnippets', task: 'readSnippet' }, template: { requires: 'readSnippet', task: ['templateAll', templateArgs] }, write: { requires: 'template', task: ['write', path.join(demoRoot, 'index.html')] }, readStatic: { requires: 'logStart', task: ['glob', staticArgs] }, writeStatic: { requires: 'readStatic', task: ['dest', demoRoot] }, readStyles: { requires: 'logStart', task: ['glob', stylesArgs] }, compressStyles: { requires: 'readStyles', task: 'cssminify' }, writeStyles: { requires: 'compressStyles', task: ['dest', destArgs] }, readImages: { requires: 'logStart', task: ['glob', imageArgs] }, writeImages: { requires:'readImages', task: ['dest', destArgs] }, readDemoJS: { requires: 'logStart', task: ['read', path.join('demo', 'demo.js')] }, minifyDemoJS: { requires: 'readDemoJS', task: 'jsminify' }, writeDemoJS: { requires: 'minifyDemoJS', task: ['dest', demoRoot] }, readDemoCSS: { requires: 'logStart', task: ['read', path.join('demo', 'style.css')] }, minifyDemoCSS: { requires: 'readDemoCSS', task: 'cssminify' }, writeDemoCSS: { requires: 'minifyDemoCSS', task: ['dest', demoRoot] } }; } module.exports = function(commander, dir) { directory = dir; let hljsExt, output, requiresTask, tasks, replace = utility.replace, regex = utility.regex, replaceClassNames = utility.replaceClassNames, coreFile = path.join('src', 'highlight.js'), languages = utility.glob(path.join('src', 'languages', '*.js')), filterCB = utility.buildFilterCallback(commander.args), replaceArgs = replace(regex.header, ''), templateArgs = 'hljs.registerLanguage(\'<%= name %>\', <%= content %>);\n'; tasks = { startLog: { task: ['log', 'Building highlight.js pack file.'] }, readCore: { requires: 'startLog', task: ['read', coreFile] }, read: { requires: 'startLog', task: ['glob', languages] }, filter: { requires: 'read', task: ['filter', filterCB] }, reorder: { requires: 'filter', task: 'reorderDeps' }, replace: { requires: 'reorder', task: ['replace', replaceArgs] }, template: { requires: 'replace', task: ['template', templateArgs] }, packageFiles: { requires: ['readCore', 'template'], task: 'packageFiles' } }; requiresTask = 'packageFiles'; if(commander.compress || commander.target === 'cdn') { tasks.compresslog = { requires: requiresTask, task: ['log', 'Compressing highlight.js pack file.'] }; tasks.replace2 = { requires: 'compresslog', task: [ 'replaceSkippingStrings' , replace(regex.replaces, replaceClassNames) ] }; tasks.replace3 = { requires: 'replace2', task: ['replace', replace(regex.classname, '$1.className')] }; tasks.minify = { requires: 'replace3', task: 'jsminify' }; requiresTask = 'minify'; } tasks.insertLicenseTag = { requires: requiresTask, task: 'insertLicenseTag' }; tasks.writelog = { requires: 'insertLicenseTag', task: ['log', 'Writing highlight.js pack file.'] }; hljsExt = commander.target === 'cdn' ? 'min' : 'pack'; output = path.join(directory.build, `highlight.${hljsExt}.js`); tasks.write = { requires: 'writelog', task: ['write', output] }; tasks = (commander.target === 'browser') ? [copyDocs(), generateDemo(filterCB, languages), tasks] : [tasks]; return utility.toQueue(tasks, registry); }; highlight.js-9.12.0/test/0000755000175000017500000000000013113427226015551 5ustar infinity0infinity0highlight.js-9.12.0/test/mocha.opts0000644000175000017500000000011613113427226017545 0ustar infinity0infinity0--require should --reporter spec --ui bdd --bail --check-leaks --inline-diffs highlight.js-9.12.0/test/utility.js0000644000175000017500000000146613113427226017621 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let bluebird = require('bluebird'); let readFile = bluebird.promisify(require('fs').readFile); let path = require('path'); // Build a path relative to `test/` exports.buildPath = function() { const args = _.slice(arguments, 0), paths = [__dirname].concat(args); return path.join.apply(this, paths); }; exports.numberToString = _.method('toString'); exports.expectedFile = function(filename, encoding, actual) { return readFile(filename, encoding) .then(expected => actual.trim().should.equal(expected.trim())); }; exports.setupFile = function(filename, encoding, that, testHTML) { return readFile(filename, encoding) .then(expected => { that.expected = expected.trim(); that.blocks = _.map(testHTML, 'innerHTML'); }); }; highlight.js-9.12.0/test/special/0000755000175000017500000000000013113427226017171 5ustar infinity0infinity0highlight.js-9.12.0/test/special/languageAlias.js0000644000175000017500000000106513113427226022266 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let utility = require('../utility'); describe('language alias', function() { before(function() { const testHTML = document.querySelectorAll('#language-alias .hljs'); this.blocks = _.map(testHTML, 'innerHTML'); }); it('should highlight as aliased language', function() { const filename = utility.buildPath('fixtures', 'expect', 'languagealias.txt'), actual = this.blocks[0]; return utility.expectedFile(filename, 'utf-8', actual); }); }); highlight.js-9.12.0/test/special/buildClassName.js0000644000175000017500000000173413113427226022422 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); describe('block class names', function() { before(function() { const testHTML = document.querySelectorAll('#build-classname .hljs'); this.blocks = _.map(testHTML, 'className'); }); it('should add language class name to block', function() { const expected = 'some-class hljs xml', actual = this.blocks[0]; actual.should.equal(expected); }); it('should not clutter block class (first)', function () { const expected = 'hljs some-class xml', actual = this.blocks[1]; actual.should.equal(expected); }); it('should not clutter block class (last)', function () { const expected = 'some-class hljs xml', actual = this.blocks[2]; actual.should.equal(expected); }); it('should not clutter block class (spaces around)', function () { const expected = 'hljs some-class xml', actual = this.blocks[3]; actual.should.equal(expected); }); }); highlight.js-9.12.0/test/special/noHighlight.js0000644000175000017500000000463713113427226022005 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); describe('no highlighting', function() { before(function() { const testHTML = document.querySelectorAll('#no-highlight pre'); this.blocks = _.map(testHTML, 'children[0].innerHTML'); this.expected = { html: '<div id="contents">\n ' + '<p>Hello, World!\n</div>', python: 'for x in [1, 2, 3]: count(x)', javascript: 'var x = ' + '\'foo\';' }; }); it('should keep block unchanged (nohighlight)', function() { const expected = this.expected.html, actual = this.blocks[0]; actual.should.equal(expected); }); it('should keep block unchanged (no-highlight)', function() { const expected = this.expected.html, actual = this.blocks[1]; actual.should.equal(expected); }); it('should keep block unchanged (plain)', function() { const expected = this.expected.html, actual = this.blocks[2]; actual.should.equal(expected); }); it('should keep block unchanged (text)', function() { const expected = this.expected.html, actual = this.blocks[3]; actual.should.equal(expected); }); it('should skip pre tags without a child code tag', function() { const expected = 'Computer output', actual = this.blocks[4]; actual.should.equal(expected); }); it('should keep block unchanged (unsupported language)', function() { const expected = this.expected.python, actual = this.blocks[5]; actual.should.equal(expected); }); it('should keep block unchanged (unsupported lang)', function() { const expected = this.expected.python, actual = this.blocks[6]; actual.should.equal(expected); }); it('should keep block unchanged (unsupported prefixed language)', function() { const expected = this.expected.python, actual = this.blocks[7]; actual.should.equal(expected); }); it('should highlight class names containing text at the start', function() { const expected = this.expected.javascript, actual = this.blocks[8]; actual.should.equal(expected); }); it('should highlight class names containing text at the end', function() { const expected = this.expected.javascript, actual = this.blocks[9]; actual.should.equal(expected); }); }); highlight.js-9.12.0/test/special/subLanguages.js0000644000175000017500000000073613113427226022155 0ustar infinity0infinity0'use strict'; let utility = require('../utility'); describe('sub-languages', function() { before(function() { this.block = document.querySelector('#sublanguages'); }); it('should highlight XML with PHP and JavaScript', function() { const filename = utility.buildPath('fixtures', 'expect', 'sublanguages.txt'), actual = this.block.innerHTML; return utility.expectedFile(filename, 'utf-8', actual); }); }); highlight.js-9.12.0/test/special/index.js0000644000175000017500000000244613113427226020644 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let bluebird = require('bluebird'); let hljs = require('../../build'); let jsdomEnv = bluebird.promisify(require('jsdom').env); let readFile = bluebird.promisify(require('fs').readFile); let utility = require('../utility'); describe('special cases tests', function() { before(function() { const filename = utility.buildPath('fixtures', 'index.html'); return readFile(filename, 'utf-8') .then(page => jsdomEnv(page)) .then(window => { let blocks; // Allows hljs to use document global.document = window.document; // Special language to test endsWithParentVariants hljs.registerLanguage('nested', require('../fixtures/nested.js')); // Setup hljs environment hljs.configure({ tabReplace: ' ' }); hljs.initHighlighting(); // Setup hljs for non-`
` tests
        hljs.configure({ useBR: true });

        blocks = document.querySelectorAll('.code');
        _.each(blocks, hljs.highlightBlock);
      });
  });

  require('./explicitLanguage');
  require('./customMarkup');
  require('./languageAlias');
  require('./noHighlight');
  require('./subLanguages');
  require('./buildClassName');
  require('./useBr');
  require('./endsWithParentVariants')
});
highlight.js-9.12.0/test/special/endsWithParentVariants.js0000644000175000017500000000077613113427226024210 0ustar  infinity0infinity0'use strict';

let utility = require('../utility');

describe('ends with parent variants', function() {
  before(function() {
    const filename = utility.buildPath('fixtures', 'expect', 'endsWithParentVariants.txt'),
          testHTML = document.querySelectorAll('#ends-with-parent-variants .hljs');

    return utility.setupFile(filename, 'utf-8', this, testHTML);
  });

  it('should end on all variants', function() {
    const actual = this.blocks[0];

    actual.should.equal(this.expected);
  });

});
highlight.js-9.12.0/test/special/useBr.js0000644000175000017500000000132513113427226020610 0ustar  infinity0infinity0'use strict';

let utility = require('../utility');

describe('use br', function() {
  before(function() {
    const filename = utility.buildPath('fixtures', 'expect', 'useBr.txt'),
          testHTML = document.querySelectorAll('#use-br .hljs');

    return utility.setupFile(filename, 'utf-8', this, testHTML);
  });

  it('should respect 
tags', function() { const actual = this.blocks[0]; actual.should.equal(this.expected); }); it('should ignore literal new lines', function() { const actual = this.blocks[1]; actual.should.equal(this.expected); }); it('should recognize xml-style
', function() { const actual = this.blocks[2]; actual.should.equal(this.expected); }); }); highlight.js-9.12.0/test/special/customMarkup.js0000644000175000017500000000254013113427226022222 0ustar infinity0infinity0'use strict'; let _ = require('lodash'); let utility = require('../utility'); describe('custom markup', function() { before(function() { const testHTML = document.querySelectorAll('#custom-markup .hljs'); this.blocks = _.map(testHTML, 'innerHTML'); }); it('should replace tabs', function() { const filename = utility.buildPath('fixtures', 'expect', 'tabreplace.txt'), actual = this.blocks[0]; return utility.expectedFile(filename, 'utf-8', actual); }); it('should keep custom markup', function() { const filename = utility.buildPath('fixtures', 'expect', 'custommarkup.txt'), actual = this.blocks[1]; return utility.expectedFile(filename, 'utf-8', actual); }); it('should keep custom markup and replace tabs', function() { const filename = utility.buildPath('fixtures', 'expect', 'customtabreplace.txt'), actual = this.blocks[2]; return utility.expectedFile(filename, 'utf-8', actual); }); it('should keep the same amount of void elements (
,
, ...)', function() { const filename = utility.buildPath('fixtures', 'expect', 'brInPre.txt'), actual = this.blocks[3]; return utility.expectedFile(filename, 'utf-8', actual); }); }); highlight.js-9.12.0/test/special/explicitLanguage.js0000644000175000017500000000245713113427226023024 0ustar infinity0infinity0'use strict'; let utility = require('../utility'); describe('explicit language class', function() { before(function() { const filename = utility.buildPath('fixtures', 'expect', 'explicit1.txt'), testHTML = document.querySelectorAll('#explicit-language .hljs'); return utility.setupFile(filename, 'utf-8', this, testHTML); }); it('should highlight block with language in code tag', function() { const actual = this.blocks[0]; actual.should.equal(this.expected); }); it('should highlight block with language in pre tag', function() { const actual = this.blocks[1]; actual.should.equal(this.expected); }); it('should highlight using html 5 style (language-*)', function() { const actual = this.blocks[2]; actual.should.equal(this.expected); }); it('should highlight with shortened prefix (lang-)', function() { const filename = utility.buildPath('fixtures', 'expect', 'explicit2.txt'), actual = this.blocks[3]; return utility.expectedFile(filename, 'utf-8', actual); }); it('should highlight if classname contains uppercase symbols', function() { const filename = utility.buildPath('fixtures', 'expect', 'explicit2.txt'), actual = this.blocks[4]; return utility.expectedFile(filename, 'utf-8', actual); }); }); highlight.js-9.12.0/test/fixtures/0000755000175000017500000000000013113427226017422 5ustar infinity0infinity0highlight.js-9.12.0/test/fixtures/index.html0000644000175000017500000001045113113427226021420 0ustar infinity0infinity0 highlight.js test
for x in [1, 2, 3]:
  count(x)
for x in [1, 2, 3]:
  count(x)
for x in [1, 2, 3]:
  count(x)
@import "compass/reset";
$colorGreenDark: darken($colorGreen, 10);
@import "compass/reset";
$colorGreenDark: darken($colorGreen, 10);
for x in [1, 2, 3]:
	count(x)
<div id="contents">
  <p>Hello, World!Goodbye, cruel world!
</div>
for x in [1, 2, 3]:
	count(x)
	if x == 3:
		count(x + 1)
>> '\x41\x42\x43'
'ABC'


>> '\x61\x62\x63'
'abc'
var x = '<p>this should <b>not</b> be highlighted as <em>HTML</em>';
<div id="contents">
  <p>Hello, World!
</div>
<div id="contents">
  <p>Hello, World!
</div>
<div id="contents">
  <p>Hello, World!
</div>
<div id="contents">
  <p>Hello, World!
</div>
Computer output
for x in [1, 2, 3]: count(x)
for x in [1, 2, 3]: count(x)
for x in [1, 2, 3]: count(x)
var x = 'foo';
var x = 'foo';
<? echo 'php'; /* ?> */ ?>
<body>
<script>document.write('Legacy code');</script>
</body>
<?xml version="1.0"?>
    <response value="ok" xml:lang="en"></response>
<?xml version="1.0"?>
    <response value="ok" xml:lang="en"></response>
<?xml version="1.0"?>
    <response value="ok" xml:lang="en"></response>
<?xml version="1.0"?>
    <response value="ok" xml:lang="en"></response>
<head>
<meta charset="utf-8">
<title></title>
</head>
<head>
<meta charset="utf-8">
<title></title>
</head>
<head>
<meta charset="utf-8">
<title></title>
</head>
( [ ( ) ] )
highlight.js-9.12.0/test/fixtures/expect/0000755000175000017500000000000013113427226020712 5ustar infinity0infinity0highlight.js-9.12.0/test/fixtures/expect/sublanguages.txt0000644000175000017500000000121713113427226024134 0ustar infinity0infinity0<? echo 'php'; /* ?> */ ?> <body> <script>document.write('Legacy code');</script> </body> highlight.js-9.12.0/test/fixtures/expect/languagealias.txt0000644000175000017500000000024513113427226024251 0ustar infinity0infinity0var x = '<p>this should <b>not</b> be highlighted as <em>HTML</em>';highlight.js-9.12.0/test/fixtures/expect/explicit2.txt0000644000175000017500000000035513113427226023361 0ustar infinity0infinity0@import "compass/reset"; $colorGreenDark: darken($colorGreen, 10); highlight.js-9.12.0/test/fixtures/expect/custommarkup.txt0000644000175000017500000000074713113427226024215 0ustar infinity0infinity0<div id="contents"> <p>Hello, World!Goodbye, cruel world! </div> highlight.js-9.12.0/test/fixtures/expect/tabreplace.txt0000644000175000017500000000030713113427226023555 0ustar infinity0infinity0for x in [1, 2, 3]: count(x)highlight.js-9.12.0/test/fixtures/expect/explicit1.txt0000644000175000017500000000030513113427226023353 0ustar infinity0infinity0for x in [1, 2, 3]: count(x)highlight.js-9.12.0/test/fixtures/expect/customtabreplace.txt0000644000175000017500000000063513113427226025014 0ustar infinity0infinity0for x in [1, 2, 3]: count(x) if x == 3: count(x + 1)highlight.js-9.12.0/test/fixtures/expect/endsWithParentVariants.txt0000644000175000017500000000030613113427226026121 0ustar infinity0infinity0( [ ( ) ] ) highlight.js-9.12.0/test/fixtures/expect/useBr.txt0000644000175000017500000000072213113427226022534 0ustar infinity0infinity0<head>
<meta charset="utf-8">
<title></title>
</head> highlight.js-9.12.0/test/fixtures/expect/brInPre.txt0000644000175000017500000000032113113427226023010 0ustar infinity0infinity0>> '\x41\x42\x43'
'ABC'


>> '\x61\x62\x63'
'abc' highlight.js-9.12.0/test/fixtures/nested.js0000644000175000017500000000047113113427226021244 0ustar infinity0infinity0module.exports = function(hljs) { var BODY = { className: 'body', endsWithParent: true }; var LIST = { className: 'list', variants: [ {begin: /\(/, end: /\)/}, {begin: /\[/, end: /\]/} ], contains: [BODY] }; BODY.contains = [LIST]; return { contains: [LIST] } }; highlight.js-9.12.0/test/detect/0000755000175000017500000000000013113427226017021 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/dns/0000755000175000017500000000000013113427226017605 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/dns/default.txt0000644000175000017500000000300413113427226021767 0ustar infinity0infinity0$ORIGIN example.com. ; designates the start of this zone file in the namespace $TTL 1h ; default expiration time of all resource records without their own TTL value example.com. IN SOA ns.example.com. username.example.com. ( 2007120710 1d 2h 4w 1h ) example.com. IN NS ns ; ns.example.com is a nameserver for example.com example.com. IN NS ns.somewhere.example. ; ns.somewhere.example is a backup nameserver for example.com example.com. IN MX 10 mail.example.com. ; mail.example.com is the mailserver for example.com @ IN MX 20 mail2.example.com. ; equivalent to above line, "@" represents zone origin @ IN MX 50 mail3 ; equivalent to above line, but using a relative host name example.com. IN A 192.0.2.1 ; IPv4 address for example.com IN AAAA 2001:db8:10::1 ; IPv6 address for example.com ns IN A 192.0.2.2 ; IPv4 address for ns.example.com IN AAAA 2001:db8:10::2 ; IPv6 address for ns.example.com www IN CNAME example.com. ; www.example.com is an alias for example.com wwwtest IN CNAME www ; wwwtest.example.com is another alias for www.example.com mail IN A 192.0.2.3 ; IPv4 address for mail.example.com mail2 IN A 192.0.2.4 ; IPv4 address for mail2.example.com mail3 IN A 192.0.2.5 ; IPv4 address for mail3.example.com highlight.js-9.12.0/test/detect/tex/0000755000175000017500000000000013113427226017621 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/tex/default.txt0000644000175000017500000000066213113427226022012 0ustar infinity0infinity0\documentclass{article} \usepackage[koi8-r]{inputenc} \hoffset=0pt \voffset=.3em \tolerance=400 \newcommand{\eTiX}{\TeX} \begin{document} \section*{Highlight.js} \begin{table}[c|c] $\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $ \end{table} Ch\'erie, \c{c}a ne me pla\^\i t pas! % comment \b G\"otterd\"ammerung~45\%=34. $$ \int\limits_{0}^{\pi}\frac{4}{x-7}=3 $$ \end{document} highlight.js-9.12.0/test/detect/dockerfile/0000755000175000017500000000000013113427226021130 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/dockerfile/default.txt0000644000175000017500000000240213113427226023313 0ustar infinity0infinity0# Example instructions from https://docs.docker.com/reference/builder/ FROM ubuntu:14.04 MAINTAINER example@example.com ENV foo /bar WORKDIR ${foo} # WORKDIR /bar ADD . $foo # ADD . /bar COPY \$foo /quux # COPY $foo /quux ARG VAR=FOO RUN apt-get update && apt-get install -y software-properties-common\ zsh curl wget git htop\ unzip vim telnet RUN ["/bin/bash", "-c", "echo hello ${USER}"] CMD ["executable","param1","param2"] CMD command param1 param2 EXPOSE 1337 ENV myName="John Doe" myDog=Rex\ The\ Dog \ myCat=fluffy ENV myName John Doe ENV myDog Rex The Dog ENV myCat fluffy ADD hom* /mydir/ # adds all files starting with "hom" ADD hom?.txt /mydir/ # ? is replaced with any single character COPY hom* /mydir/ # adds all files starting with "hom" COPY hom?.txt /mydir/ # ? is replaced with any single character COPY --from=foo / . ENTRYPOINT ["executable", "param1", "param2"] ENTRYPOINT command param1 param2 VOLUME ["/data"] USER daemon LABEL com.example.label-with-value="foo" LABEL version="1.0" LABEL description="This text illustrates \ that label-values can span multiple lines." WORKDIR /path/to/workdir ONBUILD ADD . /app/src STOPSIGNAL SIGKILL HEALTHCHECK --retries=3 cat /health SHELL ["/bin/bash", "-c"] highlight.js-9.12.0/test/detect/go/0000755000175000017500000000000013113427226017426 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/go/swift-like.txt0000644000175000017500000000065313113427226022251 0ustar infinity0infinity0func makeRequest(method string, url string, cb func(error, io.ReadCloser)) { req, _ := http.NewRequest(method, url, nil) resp, err := http.DefaultClient.Do(req) if err != nil { cb(err, nil) } else { cb(err, resp.Body) } } func main() { makeRequest("GET", "http://ipinfo.io/json", func(err error, body io.ReadCloser) { defer body.Close() io.Copy(os.Stdout, body) }) } highlight.js-9.12.0/test/detect/go/default.txt0000644000175000017500000000032613113427226021614 0ustar infinity0infinity0package main import "fmt" func main() { ch := make(chan float64) ch <- 1.0e10 // magic number x, ok := <- ch defer fmt.Println(`exitting now\`) go println(len("hello world!")) return } highlight.js-9.12.0/test/detect/dts/0000755000175000017500000000000013113427226017613 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/dts/default.txt0000644000175000017500000000332113113427226021777 0ustar infinity0infinity0/* * Copyright (C) 2011 - 2014 Xilinx * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ /include/ "skeleton.dtsi" / { compatible = "xlnx,zynq-7000"; pmu { compatible = "arm,cortex-a9-pmu"; interrupts = <0 5 4>, <0 6 4>; interrupt-parent = <&intc>; reg = < 0xf8891000 0x1000 0xf8893000 0x1000 >; }; regulator_vccpint: fixedregulator@0 { compatible = "regulator-fixed"; regulator-name = "VCCPINT"; regulator-min-microvolt = <1000000>; regulator-max-microvolt = <1000000>; regulator-boot-on; regulator-always-on; }; amba: amba { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; interrupt-parent = <&intc>; ranges; adc: adc@f8007100 { compatible = "xlnx,zynq-xadc-1.00.a"; reg = <0xf8007100 0x20>; interrupts = <0 7 4>; interrupt-parent = <&intc>; clocks = <&clkc 12>; }; i2c0: i2c@e0004000 { compatible = "cdns,i2c-r1p10"; status = "disabled"; clocks = <&clkc 38>; interrupt-parent = <&intc>; interrupts = <0 25 4>; reg = <0xe0004000 0x1000>; #address-cells = <1>; #size-cells = <0>; }; L2: cache-controller@f8f02000 { compatible = "arm,pl310-cache"; reg = <0xF8F02000 0x1000>; interrupts = <0 2 4>; arm,data-latency = <3 2 2>; arm,tag-latency = <2 2 2>; cache-unified; cache-level = <2>; }; }; }; highlight.js-9.12.0/test/detect/flix/0000755000175000017500000000000013113427226017763 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/flix/default.txt0000644000175000017500000000225213113427226022151 0ustar infinity0infinity0/** * An example of Flix for syntax highlighting. */ // Here is a namespace. namespace a.b.c { // Here are some literals. def b: Bool = true def c: Char = 'a' def f: Float = 1.23 def i: Int = 42 def s: Str = "string" // Here are some relations. rel LitStm(r: Str, c: Int) rel AddStm(r: Str, x: Str, y: Str) rel DivStm(r: Str, x: Str, y: Str) // Here is a lattice. lat LocalVar(k: Str, v: Constant) // Here is an index. index LitStm{{r}, {r, c}} // Here is an enum. enum Constant { case Top, case Cst(Int), case Bot } // Here is a function. def leq(e1: Constant, e2: Constant): Bool = match (e1, e2) with { case (Constant.Bot, _) => true case (Constant.Cst(n1), Constant.Cst(n2)) => n1 == n2 case (_, Constant.Top) => true case _ => false } // Here are some rules. LocalVar(r, alpha(c)) :- LitStm(r, c). LocalVar(r, sum(v1, v2)) :- AddStm(r, x, y), LocalVar(x, v1), LocalVar(y, v2). } highlight.js-9.12.0/test/detect/haxe/0000755000175000017500000000000013113427226017746 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/haxe/default.txt0000644000175000017500000000532613113427226022141 0ustar infinity0infinity0package my.package; #if js import js.Browser; #elseif sys import Sys; #else import Date; #end import Lambda; using Main.IntExtender; extern class Math { static var PI(default,null) : Float; static function floor(v:Float):Int; } /** * Abstract forwarding */ abstract MyAbstract(Int) from Int to Int { inline function new(i:Int) { this = i; } @:op(A * B) public function multiply(rhs:MyAbstract) { return this * rhs; } } // an enum enum Color { Red; Green; Blue; Rgb(r:Int, g:Int, b:Int); } @:generic class Gen { var v:T; public function new(v:T) { this.v = v; } public var x(get, set):T; private inline function get_x():T return v; private inline function set_x(x:T):T return v = x; } class Main extends BaseClass implements SomeFunctionality { var callback:Void->Void = null; var myArray:Array = new Array(); var arr = [4,8,0,3,9,1,5,2,6,7]; public function new(x) { super(x); } public static function main() { trace('What\'s up?'); trace('Hi, ${name}!'); // switch statements! var c:Color = Color.Green; var x:Int = switch(c) { case Red: 0; case Green: 1; case Blue: 2; case Rgb(r, g, b): 3; case _: -1; } for(i in 0...3) { trace(i); continue; break; } do { trace("Hey-o!"); } while(false); var done:Bool = false; while(!done) { done = true; } var H:Int = cast new MyAbstract(42); var h:Int = cast(new MyAbstract(31), Int); try { throw "error"; } catch(err:String) { trace(err); } var map = new haxe.ds.IntMap(); var f = map.set.bind(_, "12"); } function nothing():Void trace("nothing!"); private inline function func(a:Int, b:Float, ?c:String, d:Bool=false):Dynamic { return { x: 0, y: true, z: false, a: 1.53, b: 5e10, c: -12, h: null }; } override function quicksort( lo : Int, hi : Int ) : Void { var i = lo; var j = hi; var buf = arr; var p = buf[(lo+hi)>>1]; while( i <= j ) { while( arr[i] > p ) i++; while( arr[j] < p ) j--; if( i <= j ) { var t = buf[i]; buf[i++] = buf[j]; buf[j--] = t; } } if( lo < j ) quicksort( lo, j ); if( i < hi ) quicksort( i, hi ); } }highlight.js-9.12.0/test/detect/mathematica/0000755000175000017500000000000013113427226021276 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/mathematica/default.txt0000644000175000017500000000035113113427226023462 0ustar infinity0infinity0(* ::Package:: *) (* Mathematica Package *) BeginPackage["SomePkg`"] Begin["`Private`"] SomeFn[ns_List] := Fold[Function[{x, y}, x + y], 0, Map[# * 2 &, ns]]; Print[$ActivationKey]; End[] (* End Private Context *) EndPackage[] highlight.js-9.12.0/test/detect/oxygene/0000755000175000017500000000000013113427226020477 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/oxygene/default.txt0000644000175000017500000000167113113427226022671 0ustar infinity0infinity0namespace LinkedList; interface uses System.Text; type List = public class where T is Object; private method AppendToString(aBuilder: StringBuilder); public constructor(aData: T); constructor(aData: T; aNext: List); property Next: List; property Data: T; method ToString: string; override; end; implementation constructor List(aData: T); begin Data := aData; end; constructor List(aData: T; aNext: List); begin constructor(aData); Next := aNext; end; method List.ToString: string; begin with lBuilder := new StringBuilder do begin AppendToString(lBuilder); result := lBuilder.ToString(); end; end; method List.AppendToString(aBuilder: StringBuilder); begin if assigned(Data) then aBuilder.Append(Data.ToString) else aBuilder.Append('nil'); if assigned(Next) then begin aBuilder.Append(', '); Next.AppendToString(aBuilder); end; end; end. highlight.js-9.12.0/test/detect/perl/0000755000175000017500000000000013113427226017763 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/perl/default.txt0000644000175000017500000000150013113427226022144 0ustar infinity0infinity0# loads object sub load { my $flds = $c->db_load($id,@_) || do { Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef }; my $o = $c->_perl_new(); $id12 = $id / 24 / 3600; $o->{'ID'} = $id12 + 123; #$o->{'SHCUT'} = $flds->{'SHCUT'}; my $p = $o->props; my $vt; $string =~ m/^sought_text$/; $items = split //, 'abc'; $string //= "bar"; for my $key (keys %$p) { if(${$vt.'::property'}) { $o->{$key . '_real'} = $flds->{$key}; tie $o->{$key}, 'CMSBuilder::Property', $o, $key; } } $o->save if delete $o->{'_save_after_load'}; # GH-117 my $g = glob("/usr/bin/*"); return $o; } __DATA__ @@ layouts/default.html.ep <%= title %> <%= content %> __END__ =head1 NAME POD till the end of file highlight.js-9.12.0/test/detect/rib/0000755000175000017500000000000013113427226017575 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/rib/default.txt0000644000175000017500000000121513113427226021761 0ustar infinity0infinity0FrameBegin 0 Display "Scene" "framebuffer" "rgb" Option "searchpath" "shader" "+&:/home/kew" Option "trace" "int maxdepth" [4] Attribute "visibility" "trace" [1] Attribute "irradiance" "maxerror" [0.1] Attribute "visibility" "transmission" "opaque" Format 640 480 1.0 ShadingRate 2 PixelFilter "catmull-rom" 1 1 PixelSamples 4 4 Projection "perspective" "fov" 49.5502811377 Scale 1 1 -1 WorldBegin ReadArchive "Lamp.002_Light/instance.rib" Surface "plastic" ReadArchive "Cube.004_Mesh/instance.rib" # ReadArchive "Sphere.010_Mesh/instance.rib" # ReadArchive "Sphere.009_Mesh/instance.rib" ReadArchive "Sphere.006_Mesh/instance.rib" WorldEnd FrameEnd highlight.js-9.12.0/test/detect/mercury/0000755000175000017500000000000013113427226020507 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/mercury/default.txt0000644000175000017500000000100313113427226022666 0ustar infinity0infinity0% "Hello World" in Mercury. :- module hello. :- interface. :- import_module io. :- pred main(io::di, io::uo) is det. :- implementation. main(!IO) :- io.write_string("Hello, world\n", !IO). :- pred filter(pred(T), list(T), list(T), list(T) ). :- mode filter(in(pred(in) is semidet), in, out, out ) is det. filter(_, [], [], []). filter(P, [X | Xs], Ys, Zs) :- filter(P, Xs, Ys0, Zs0), ( if P(X) then Ys = [X | Ys0], Zs = Zs0 else Ys = Ys0 , Zs = [X | Zs0] ). highlight.js-9.12.0/test/detect/inform7/0000755000175000017500000000000013113427226020402 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/inform7/default.txt0000644000175000017500000000130613113427226022567 0ustar infinity0infinity0Book 1 - Language Definition Testing File [Comments in Inform 7 can be [nested] inside one another] Syntax highlighting is an action applying to one thing. Understand "highlight [something preferably codeish]" as syntax highlighting. Code is a kind of thing. Code is usually plural-named. Code can be highlighted. Code is usually not highlighted. Check syntax highlighting: unless the noun is code: say "[The noun] isn't source code you can highlight."; rule fails. Carry out syntax highlighting: now the noun is highlighted. Table of Programming Languages language utility ruby "Web back-end development" lua "Embedded scripting" erlang "High-concurrency server applications"highlight.js-9.12.0/test/detect/tap/0000755000175000017500000000000013113427226017605 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/tap/default.txt0000644000175000017500000000131213113427226021767 0ustar infinity0infinity0# Hardware architecture: x86_64 # Timestamp: 2016-06-16 06:23 (GMT+1) # TAP version 13 1..19 ok 1 - zdtm/static/conntracks # SKIP manual run only ok 2 - zdtm/static/maps03 # SKIP manual run only ok 3 - zdtm/static/mlock_setuid ok 4 - zdtm/static/groups ok 5 - zdtm/static/maps05 ok 6 - zdtm/static/pdeath_sig ok 7 - zdtm/static/xids00 ok 8 - zdtm/static/proc-self ok 9 - zdtm/static/file_fown ok 10 - zdtm/static/eventfs00 ok 11 - zdtm/static/uptime_grow # SKIP manual run only ok 12 - zdtm/static/signalfd00 ok 13 - zdtm/static/inotify_irmap ok 14 - zdtm/static/fanotify00 ok 15 - zdtm/static/session00 ok 16 - zdtm/static/rlimits00 ok 17 - zdtm/static/maps04 ok 18 - zdtm/static/pty03 ok 19 - zdtm/static/pty02 highlight.js-9.12.0/test/detect/r/0000755000175000017500000000000013113427226017262 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/r/default.txt0000644000175000017500000000236313113427226021453 0ustar infinity0infinity0library(ggplot2) centre <- function(x, type, ...) { switch(type, mean = mean(x), median = median(x), trimmed = mean(x, trim = .1)) } myVar1 myVar.2 data$x foo "bar" baz # test "test" "test # test" (123) (1) (10) (0.1) (.2) (1e-7) (1.2e+7) (2e) (3e+10) (0x0) (0xa) (0xabcdef1234567890) (123L) (1L) (0x10L) (10000000L) (1e6L) (1.1L) (1e-3L) (4123.381E-10i) (3.) (3.E10) # BUG: .E10 should be part of number # Numbers in some different contexts 1L 0x40 .234 3. 1L + 30 plot(cars, xlim=20) plot(cars, xlim=0x20) foo<-30 my.data.3 <- read() # not a number c(1,2,3) 1%%2 "this is a quote that spans multiple lines \" is this still a quote? it should be. # even still! " # now we're done. 'same for single quotes #' # keywords NULL, NA, TRUE, FALSE, Inf, NaN, NA_integer_, NA_real_, NA_character_, NA_complex_, function, while, repeat, for, if, in, else, next, break, ..., ..1, ..2 # not keywords the quick brown fox jumped over the lazy dogs null na true false inf nan na_integer_ na_real_ na_character_ na_complex_ Function While Repeat For If In Else Next Break .. .... "NULL" `NULL` 'NULL' # operators +, -, *, /, %%, ^, >, >=, <, <=, ==, !=, !, &, |, ~, ->, <-, <<-, $, :, :: # infix operator foo %union% bar %"test"% `"test"` highlight.js-9.12.0/test/detect/llvm/0000755000175000017500000000000013113427226017773 5ustar infinity0infinity0highlight.js-9.12.0/test/detect/llvm/default.txt0000644000175000017500000001732313113427226022166 0ustar infinity0infinity0; ModuleID = 'test.c' target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] } %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } %struct.what = type { i8, i16 } @.str = private unnamed_addr constant [6 x i8] c"foo()\00", align 1 @e_long = common global i64 0, align 8 @g_double = common global double 0.000000e+00, align 8 @.str.1 = private unnamed_addr constant [7 x i8] c"oooooh\00", align 1 @func_ptr = common global i32 (...)* null, align 8 @.str.2 = private unnamed_addr constant [8 x i8] c"success\00", align 1 @.str.3 = private unnamed_addr constant [9 x i8] c"FizzBuzz\00", align 1 @.str.4 = private unnamed_addr constant [5 x i8] c"Fizz\00", align 1 @.str.5 = private unnamed_addr constant [5 x i8] c"Buzz\00", align 1 @.str.6 = private unnamed_addr constant [4 x i8] c"%zd\00", align 1 @.str.7 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @.str.8 = private unnamed_addr constant [12 x i8] c"%d, %c, %d\0A\00", align 1 @.str.9 = private unnamed_addr constant [11 x i8] c"need args!\00", align 1 @stderr = external global %struct._IO_FILE*, align 8 ; Function Attrs: nounwind uwtable define i32 @foo() #0 { %1 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0)) ret i32 0 } declare i32 @puts(i8*) #1 ; Function Attrs: nounwind uwtable define i32 @main(i32 %argc, i8** %argv) #0 { %1 = alloca i32, align 4 %2 = alloca i32, align 4 %3 = alloca i8**, align 8 %b_char = alloca i8, align 1 %d_int = alloca i32, align 4 %cp_char_ptr = alloca i8*, align 8 %X = alloca %struct.what, align 2 %i = alloca i64, align 8 store i32 0, i32* %1, align 4 store i32 %argc, i32* %2, align 4 store i8** %argv, i8*** %3, align 8 %4 = load i8**, i8*** %3, align 8 %5 = load i32, i32* %2, align 4 %6 = icmp eq i32 %5, 1 br i1 %6, label %7, label %11 ;