From: <var...@us...> - 2016-10-14 15:39:24
|
Revision: 9971 http://sourceforge.net/p/phpwiki/code/9971 Author: vargenau Date: 2016-10-14 15:39:20 +0000 (Fri, 14 Oct 2016) Log Message: ----------- Update highlight.js to version 9.7.0 Modified Paths: -------------- trunk/pgsrc/ReleaseNotes trunk/themes/default/highlight.js/CHANGES.md trunk/themes/default/highlight.js/README.md trunk/themes/default/highlight.js/README.ru.md trunk/themes/default/highlight.js/highlight.pack.js trunk/themes/default/highlight.js/styles/arta.css trunk/themes/default/highlight.js/styles/ascetic.css trunk/themes/default/highlight.js/styles/dark.css trunk/themes/default/highlight.js/styles/default.css trunk/themes/default/highlight.js/styles/docco.css trunk/themes/default/highlight.js/styles/far.css trunk/themes/default/highlight.js/styles/foundation.css trunk/themes/default/highlight.js/styles/github.css trunk/themes/default/highlight.js/styles/googlecode.css trunk/themes/default/highlight.js/styles/idea.css trunk/themes/default/highlight.js/styles/magula.css trunk/themes/default/highlight.js/styles/mono-blue.css trunk/themes/default/highlight.js/styles/monokai.css trunk/themes/default/highlight.js/styles/obsidian.css trunk/themes/default/highlight.js/styles/pojoaque.css trunk/themes/default/highlight.js/styles/railscasts.css trunk/themes/default/highlight.js/styles/rainbow.css trunk/themes/default/highlight.js/styles/sunburst.css trunk/themes/default/highlight.js/styles/tomorrow-night-blue.css trunk/themes/default/highlight.js/styles/tomorrow-night-bright.css trunk/themes/default/highlight.js/styles/tomorrow-night-eighties.css trunk/themes/default/highlight.js/styles/tomorrow-night.css trunk/themes/default/highlight.js/styles/tomorrow.css trunk/themes/default/highlight.js/styles/vs.css trunk/themes/default/highlight.js/styles/xcode.css trunk/themes/default/highlight.js/styles/zenburn.css Added Paths: ----------- trunk/themes/default/highlight.js/styles/agate.css trunk/themes/default/highlight.js/styles/androidstudio.css trunk/themes/default/highlight.js/styles/arduino-light.css trunk/themes/default/highlight.js/styles/atelier-cave-dark.css trunk/themes/default/highlight.js/styles/atelier-cave-light.css trunk/themes/default/highlight.js/styles/atelier-dune-dark.css trunk/themes/default/highlight.js/styles/atelier-dune-light.css trunk/themes/default/highlight.js/styles/atelier-estuary-dark.css trunk/themes/default/highlight.js/styles/atelier-estuary-light.css trunk/themes/default/highlight.js/styles/atelier-forest-dark.css trunk/themes/default/highlight.js/styles/atelier-forest-light.css trunk/themes/default/highlight.js/styles/atelier-heath-dark.css trunk/themes/default/highlight.js/styles/atelier-heath-light.css trunk/themes/default/highlight.js/styles/atelier-lakeside-dark.css trunk/themes/default/highlight.js/styles/atelier-lakeside-light.css trunk/themes/default/highlight.js/styles/atelier-plateau-dark.css trunk/themes/default/highlight.js/styles/atelier-plateau-light.css trunk/themes/default/highlight.js/styles/atelier-savanna-dark.css trunk/themes/default/highlight.js/styles/atelier-savanna-light.css trunk/themes/default/highlight.js/styles/atelier-seaside-dark.css trunk/themes/default/highlight.js/styles/atelier-seaside-light.css trunk/themes/default/highlight.js/styles/atelier-sulphurpool-dark.css trunk/themes/default/highlight.js/styles/atelier-sulphurpool-light.css trunk/themes/default/highlight.js/styles/atom-one-dark.css trunk/themes/default/highlight.js/styles/atom-one-light.css trunk/themes/default/highlight.js/styles/brown-paper.css trunk/themes/default/highlight.js/styles/brown-papersq.png trunk/themes/default/highlight.js/styles/codepen-embed.css trunk/themes/default/highlight.js/styles/color-brewer.css trunk/themes/default/highlight.js/styles/darcula.css trunk/themes/default/highlight.js/styles/darkula.css trunk/themes/default/highlight.js/styles/dracula.css trunk/themes/default/highlight.js/styles/github-gist.css trunk/themes/default/highlight.js/styles/grayscale.css trunk/themes/default/highlight.js/styles/gruvbox-dark.css trunk/themes/default/highlight.js/styles/gruvbox-light.css trunk/themes/default/highlight.js/styles/hopscotch.css trunk/themes/default/highlight.js/styles/hybrid.css trunk/themes/default/highlight.js/styles/ir-black.css trunk/themes/default/highlight.js/styles/kimbie.dark.css trunk/themes/default/highlight.js/styles/kimbie.light.css trunk/themes/default/highlight.js/styles/monokai-sublime.css trunk/themes/default/highlight.js/styles/ocean.css trunk/themes/default/highlight.js/styles/paraiso-dark.css trunk/themes/default/highlight.js/styles/paraiso-light.css trunk/themes/default/highlight.js/styles/purebasic.css trunk/themes/default/highlight.js/styles/qtcreator_dark.css trunk/themes/default/highlight.js/styles/qtcreator_light.css trunk/themes/default/highlight.js/styles/school-book.css trunk/themes/default/highlight.js/styles/school-book.png trunk/themes/default/highlight.js/styles/solarized-dark.css trunk/themes/default/highlight.js/styles/solarized-light.css trunk/themes/default/highlight.js/styles/xt256.css Modified: trunk/pgsrc/ReleaseNotes =================================================================== --- trunk/pgsrc/ReleaseNotes 2016-10-14 11:00:13 UTC (rev 9970) +++ trunk/pgsrc/ReleaseNotes 2016-10-14 15:39:20 UTC (rev 9971) @@ -1,4 +1,4 @@ -Date: Fri, 14 Oct 2016 12:59:38 +0000 +Date: Fri, 14 Oct 2016 17:38:47 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0) Content-Type: application/x-phpwiki; pagename=ReleaseNotes; @@ -21,6 +21,7 @@ * Replace ##ereg## functions * Update Adodb to version 5.20.7 * Update ASCIIMathPHP to version 2.1 (from Zefling/ASCIIMathPHP on github.com) +* Update highlight.js to version 9.7.0 * Allow Wikicreole syntax for plugins in theme templates * Valid HTML5 and CSS3 logos (in debug mode) * Better is_localhost() function (allow IPv6, allow Windows IIS). Patch by Thierry Nabeth. Modified: trunk/themes/default/highlight.js/CHANGES.md =================================================================== --- trunk/themes/default/highlight.js/CHANGES.md 2016-10-14 11:00:13 UTC (rev 9970) +++ trunk/themes/default/highlight.js/CHANGES.md 2016-10-14 15:39:20 UTC (rev 9971) @@ -1,5 +1,675 @@ -## Version 8.0 beta +## 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 `<tag/>` 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 <https://highlightjs.org>. +- 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 `<script>` tag now allows any language, not just JavaScript. +- Multi-line comments are supported now in MatLab. + +[Taufik Nurrohman]: https://github.com/tovic +[Jet Brains]: https://www.jetbrains.com/ +[Peter Piwowarski]: https://github.com/oldlaptop +[Kenta Sato]: https://github.com/bicycle1885 +[Bram de Haan]: https://github.com/atelierbram +[Raivo Laanemets]: https://github.com/rla +[Alexis Hénaut]: https://github.com/AlexisNo +[Anthony Scemama]: https://github.com/scemama +[Pedro Oliveira]: https://github.com/kanytu +[Gu Yiling]: https://github.com/Justineo +[Sergey Mashkov]: https://github.com/cy6erGn0m +[Thomas Applencourt]: https://github.com/TApplencourt + + +## Version 8.4 + +We've got the new [demo page][]! The obvious new feature is the new look, but +apart from that it's got smarter: by presenting languages in groups it avoids +running 10000 highlighting attempts after first load which was slowing it down +and giving bad overall impression. It is now also being generated from test +code snippets so the authors of new languages don't have to update both tests +and the demo page with the same thing. + +Other notable changes: + +- The `template_comment` class is gone in favor of the more general `comment`. +- Number parsing unified and improved across languages. +- C++, Java and C# now use unified grammar to highlight titles in + function/method definitions. +- The browser build is now usable as an AMD module, there's no separate build + target for that anymore. +- OCaml has got a [comprehensive overhaul][ocaml] by [Mickaël Delahaye][]. +- Clojure's data structures and literals are now highlighted outside of lists + and we can now highlight Clojure's REPL sessions. + +New languages: + +- *AspectJ* by [Hakan Özler][] +- *STEP Part 21* by [Adam Joseph Cook][] +- *SML* derived by [Edwin Dalorzo][] from OCaml definition +- *Mercury* by [mucaho][] +- *Smali* by [Dennis Titze][] +- *Verilog* by [Jon Evans][] +- *Stata* by [Brian Quistorff][] + +[Hakan Özler]: https://github.com/ozlerhakan +[Adam Joseph Cook]: https://github.com/adamjcook +[demo page]: https://highlightjs.org/static/demo/ +[Ivan Sagalaev]: https://github.com/isagalaev +[Edwin Dalorzo]: https://github.com/edalorzo +[mucaho]: https://github.com/mucaho +[Dennis Titze]: https://github.com/titze +[Jon Evans]: https://github.com/craftyjon +[Brian Quistorff]: https://github.com/bquistorff +[ocaml]: https://github.com/isagalaev/highlight.js/pull/608#issue-46190207 +[Mickaël Delahaye]: https://github.com/polazarus + + +## Version 8.3 + +We streamlined our tool chain, it is now based entirely on node.js instead of +being a mix of node.js, Python and Java. The build script options and arguments +remained the same, and we've noted all the changes in the [documentation][b]. +Apart from reducing complexity, the new build script is also faster from not +having to start Java machine repeatedly. The credits for the work go to [Jeremy +Hull][]. + +Some notable fixes: + +- PHP and JavaScript mixed in HTML now live happily with each other. +- JavaScript regexes now understand ES6 flags "u" and "y". +- `throw` keyword is no longer detected as a method name in Java. +- Fixed parsing of numbers and symbols in Clojure thanks to [input from Ivan + Kleshnin][ik]. + +New languages in this release: + +- *Less* by [Max Mikhailov][] +- *Stylus* by [Bryant Williams][] +- *Tcl* by [Radek Liska][] +- *Puppet* by [Jose Molina Colmenero][] +- *Processing* by [Erik Paluka][] +- *Twig* templates by [Luke Holder][] +- *PowerShell* by [David Mohundro][], based on [the work of Nicholas Blumhardt][ps] +- *XL* by [Christophe de Dinechin][] +- *LiveScript* by [Taneli Vatanen][] and [Jen Evers-Corvina][] +- *ERB* (Ruby in HTML) by [Lucas Mazza][] +- *Roboconf* by [Vincent Zurczak][] + +[b]: http://highlightjs.readthedocs.org/en/latest/building-testing.html +[Jeremy Hull]: https://github.com/sourrust +[ik]: https://twitter.com/IvanKleshnin/status/514041599484231680 +[Max Mikhailov]: https://github.com/seven-phases-max +[Bryant Williams]: https://github.com/scien +[Radek Liska]: https://github.com/Nindaleth +[Jose Molina Colmenero]: https://github.com/Moliholy +[Erik Paluka]: https://github.com/paluka +[Luke Holder]: https://github.com/lukeholder +[David Mohundro]: https://github.com/drmohundro +[ps]: https://github.com/OctopusDeploy/Library/blob/master/app/shared/presentation/highlighting/powershell.js +[Christophe de Dinechin]: https://github.com/c3d +[Taneli Vatanen]: https://github.com/Daiz- +[Jen Evers-Corvina]: https://github.com/sevvie +[Lucas Mazza]: https://github.com/lucasmazza +[Vincent Zurczak]: https://github.com/vincent-zurczak + + +## Version 8.2 + +We've finally got [real tests][test] and [continuous testing on Travis][ci] +thanks to [Jeremy Hull][] and [Chris Eidhof][]. The tests designed to cover +everything: language detection, correct parsing of individual language features +and various special cases. This is a very important change that gives us +confidence in extending language definitions and refactoring library core. + +We're going to redesign the old [demo/test suite][demo] into an interactive +demo web app. If you're confident front-end developer or designer and want to +help us with it, drop a comment into [the issue][#542] on GitHub. + +[test]: https://github.com/isagalaev/highlight.js/tree/master/test +[demo]: https://highlightjs.org/static/test.html +[#542]: https://github.com/isagalaev/highlight.js/issues/542 +[ci]: https://travis-ci.org/isagalaev/highlight.js +[Jeremy Hull]: https://github.com/sourrust +[Chris Eidhof]: https://github.com/chriseidhof + +As usually there's a handful of new languages in this release: + +- *Groovy* by [Guillaume Laforge][] +- *Dart* by [Maxim Dikun][] +- *Dust* by [Michael Allen][] +- *Scheme* by [JP Verkamp][] +- *G-Code* by [Adam Joseph Cook][] +- *Q* from Kx Systems by [Sergey Vidyuk][] + +[Guillaume Laforge]: https://github.com/glaforge +[Maxim Dikun]: https://github.com/dikmax +[Michael Allen]: https://github.com/bfui +[JP Verkamp]: https://github.com/jpverkamp +[Adam Joseph Cook]: https://github.com/adamjcook +[Sergey Vidyuk]: https://github.com/sv + +Other improvements: + +- [Erik Osheim][] heavily reworked Scala definitions making it richer. +- [Lucas Mazza][] fixed Ruby hashes highlighting +- Lisp variants (Lisp, Clojure and Scheme) are unified in regard to naming + the first symbol in parentheses: it's "keyword" in general case and also + "built_in" for built-in functions in Clojure and Scheme. + +[Erik Osheim]: https://github.com/non +[Lucas Mazza]: https://github.com/lucasmazza + + +## Version 8.1 + +New languages: + +- *Gherkin* by [Sam Pikesley][] +- *Elixir* by [Josh Adams][] +- *NSIS* by [Jan T. Sott][] +- *VIM script* by [Jun Yang][] +- *Protocol Buffers* by [Dan Tao][] +- *Nix* by [Domen Kožar][] +- *x86asm* by [innocenat][] +- *Cap’n Proto* and *Thrift* by [Oleg Efimov][] +- *Monkey* by [Arthur Bikmullin][] +- *TypeScript* by [Panu Horsmalahti][] +- *Nimrod* by [Flaviu Tamas][] +- *Gradle* by [Damian Mee][] +- *Haxe* by [Christopher Kaster][] +- *Swift* by [Chris Eidhof][] and [Nate Cook][] + +New styles: + +- *Kimbie*, light and dark variants by [Jan T. Sott][] +- *Color brewer* by [Fabrício Tavares de Oliveira][] +- *Codepen.io embed* by [Justin Perry][] +- *Hybrid* by [Nic West][] + +[Sam Pikesley]: https://github.com/pikesley +[Sindre Sorhus]: https://github.com/sindresorhus +[Josh Adams]: https://github.com/knewter +[Jan T. Sott]: https://github.com/idleberg +[Jun Yang]: https://github.com/harttle +[Dan Tao]: https://github.com/dtao +[Domen Kožar]: https://github.com/iElectric +[innocenat]: https://github.com/innocenat +[Oleg Efimov]: https://github.com/Sannis +[Arthur Bikmullin]: https://github.com/devolonter +[Panu Horsmalahti]: https://github.com/panuhorsmalahti +[Flaviu Tamas]: https://github.com/flaviut +[Damian Mee]: https://github.com/chester1000 +[Christopher Kaster]: http://christopher.kaster.ws +[Fabrício Tavares de Oliveira]: https://github.com/fabriciotav +[Justin Perry]: https://github.com/ourmaninamsterdam +[Nic West]: https://github.com/nicwest +[Chris Eidhof]: https://github.com/chriseidhof +[Nate Cook]: https://github.com/natecook1000 + +Other improvements: + +- The README is heavily reworked and brought up to date by [Jeremy Hull][]. +- Added [`listLanguages()`][ll] method in the API. +- Improved C/C++/C# detection. +- Added a bunch of new language aliases, documented the existing ones. Thanks to + [Sindre Sorhus][] for background research. +- Added phrasal English words to boost relevance in comments. +- Many improvements to SQL definition made by [Heiko August][], + [Nikolay Lisienko][] and [Travis Odom][]. +- The shorter `lang-` prefix for language names in HTML classes supported + alongside `language-`. Thanks to [Jeff Escalante][]. +- Ruby's got support for interactive console sessions. Thanks to + [Pascal Hurni][]. +- Added built-in functions for R language. Thanks to [Artem A. Klevtsov][]. +- Rust's got definition for lifetime parameters and improved string syntax. + Thanks to [Roman Shmatov][]. +- Various improvements to Objective-C definition by [Matt Diephouse][]. +- Fixed highlighting of generics in Java. + +[ll]: http://highlightjs.readthedocs.org/en/latest/api.html#listlanguages +[Sindre Sorhus]: https://github.com/sindresorhus +[Heiko August]: https://github.com/auge8472 +[Nikolay Lisienko]: https://github.com/neor-ru +[Travis Odom]: https://github.com/Burstaholic +[Jeff Escalante]: https://github.com/jenius +[Pascal Hurni]: https://github.com/phurni +[Jiyin Yiyong]: https://github.com/jiyinyiyong +[Artem A. Klevtsov]: https://github.com/unikum +[Roman Shmatov]: https://github.com/shmatov +[Jeremy Hull]: https://github.com/sourrust +[Matt Diephouse]: https://github.com/mdiep + + +## Version 8.0 + This new major release is quite a big overhaul bringing both new features and some backwards incompatible changes. However, chances are that the majority of users won't be affected by the latter: the basic scenario described in the @@ -47,7 +717,7 @@ 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][]. + [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 @@ -68,7 +738,7 @@ - *Atelier* family of styles in 10 variants by [Bram de Haan][] - *Paraíso* styles by [Jan T. Sott][] -Miscelleanous improvements: +Miscellaneous improvements: - Highlighting `=>` prompts in Clojure. - [Jeremy Hull][] fixed a lot of styles for consistency. @@ -77,6 +747,8 @@ - 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 @@ -118,7 +790,7 @@ - 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. -- Miscelleanous fixes in PHP, Brainfuck, SCSS, Asciidoc, CMake, Python and F#. +- Miscellaneous fixes in PHP, Brainfuck, SCSS, Asciidoc, CMake, Python and F#. [mehdid]: https://github.com/mehdid [nbraud]: https://github.com/nbraud @@ -156,7 +828,7 @@ 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 -<http://highlightjs.org/>, moving from its craddle on Software Maniacs which it +<http://highlightjs.org/>, moving from its cradle on Software Maniacs which it outgrew a long time ago. Be sure to report any bugs about the site to <mailto:in...@hi...>. @@ -395,7 +1067,7 @@ [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 +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/ @@ -422,7 +1094,7 @@ - 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. +- [Igor Kalnitsky][ik] has sent two new language descriptions: CMake & VHDL. This makes total number of languages supported by highlight.js to reach 35. @@ -562,7 +1234,8 @@ ## Version 5.2 -- at last it's possible to replace indentation TABs with something sensible (e.g. 2 or 4 spaces) +- 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 Modified: trunk/themes/default/highlight.js/README.md =================================================================== --- trunk/themes/default/highlight.js/README.md 2016-10-14 11:00:13 UTC (rev 9970) +++ trunk/themes/default/highlight.js/README.md 2016-10-14 15:39:20 UTC (rev 9971) @@ -1,167 +1,150 @@ # Highlight.js -Highlight.js highlights syntax in code examples on blogs, forums and, -in fact, on any web page. It's very easy to use because it works -automatically: finds blocks of code, detects a language, highlights it. +[](https://travis-ci.org/isagalaev/highlight.js) -Autodetection can be fine tuned when it fails by itself (see "Heuristics"). +Highlight.js is a syntax highlighter written in JavaScript. It works in +the browser as well as on the server. It works with pretty much any +markup, doesn’t depend on any framework and has automatic language +detection. +## Getting Started -## Basic usage +The bare minimum for using highlight.js on a web page is linking to the +library along with one of the styles and calling +[`initHighlightingOnLoad`][1]: -Link the library and a stylesheet from your page and hook highlighting to -the page load event: - ```html -<link rel="stylesheet" href="styles/default.css"> -<script src="highlight.pack.js"></script> +<link rel="stylesheet" href="/path/to/styles/default.css"> +<script src="/path/to/highlight.pack.js"></script> <script>hljs.initHighlightingOnLoad();</script> ``` -This will highlight all code on the page marked up as `<pre><code> .. </code></pre>`. -If you use different markup or need to apply highlighting dynamically, read -"Custom initialization" below. +This will find and highlight code inside of `<pre><code>` 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: -- You can download your own customized version of "highlight.pack.js" or - use the hosted one as described on the download page: - <http://highlightjs.org/download/> +```html +<pre><code class="html">...</code></pre> +``` -- Style themes are available in the download package or as hosted files. - To create a custom style for your site see the class reference in the file - [CSS classes reference][cr] from the downloaded package. +The list of supported language classes is available in the [class +reference][2]. Classes can also be prefixed with either `language-` or +`lang-`. -[cr]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html +To disable highlighting altogether use the `nohighlight` class: +```html +<pre><code class="nohighlight">...</code></pre> +``` -## node.js +## Custom Initialization -Highlight.js can be used under node.js. The package with all supported languages is -installable from NPM: +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*. - npm install highlight.js +Here’s an equivalent way to calling [`initHighlightingOnLoad`][1] using +jQuery: -Alternatively, you can build it from the source with only languages you need: - - python3 tools/build.py -tnode lang1 lang2 .. - -Using the library: - ```javascript -var hljs = require('highlight.js'); - -// If you know the language -hljs.highlight(lang, code).value; - -// Automatic language detection -hljs.highlightAuto(code).value; +$(document).ready(function() { + $('pre code').each(function(i, block) { + hljs.highlightBlock(block); + }); +}); ``` +You can use any tags instead of `<pre><code>` 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 `<br>` tag: -## AMD - -Highlight.js can be used with an AMD loader. You will need to build it from -source in order to do so: - -```bash -$ python3 tools/build.py -tamd lang1 lang2 .. -``` - -Which will generate a `build/highlight.pack.js` which will load as an AMD -module with support for the built languages and can be used like so: - ```javascript -require(["highlight.js/build/highlight.pack"], function(hljs){ +hljs.configure({useBR: true}); - // If you know the language - hljs.highlight(lang, code).value; - - // Automatic language detection - hljs.highlightAuto(code).value; +$('div.code').each(function(i, block) { + hljs.highlightBlock(block); }); ``` +For other options refer to the documentation for [`configure`][4]. -## Tab replacement -You can replace TAB ('\x09') characters used for indentation in your code -with some fixed number of spaces or with a `<span>` to give them special -styling: +## Web Workers -```html -<script type="text/javascript"> - hljs.configure({tabReplace: ' '}); // 4 spaces - // ... or - hljs.configure({tabReplace: '<span class="indent">\t</span>'}); +You can run highlighting inside a web worker to avoid freezing the browser +window while dealing with very big chunks of code. - hljs.initHighlightingOnLoad(); -</script> -``` +In your main script: -## Custom initialization - -If you use different markup for code blocks you can initialize them manually -with `highlightBlock(code)` function. It takes a DOM element containing the -code to highlight and optionally a string with which to replace TAB -characters. - -Initialization using, for example, jQuery might look like this: - ```javascript -$(document).ready(function() { - $('pre code').each(function(i, e) {hljs.highlightBlock(e)}); -}); +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); +}) ``` -You can use `highlightBlock` to highlight blocks dynamically inserted into -the page. Just make sure you don't do it twice for already highlighted -blocks. +In worker.js: -If your code container relies on `<br>` tags instead of line breaks (i.e. if -it's not `<pre>`) set the `useBR` option to `true`: - ```javascript -hljs.configure({useBR: true}); -$('div.code').each(function(i, e) {hljs.highlightBlock(e)}); +onmessage = function(event) { + importScripts('<path>/highlight.pack.js'); + var result = self.hljs.highlightAuto(event.data); + postMessage(result.value); +} ``` -## Heuristics +## Getting the Library -Autodetection of a code's language is done using a simple heuristic: -the program tries to highlight a fragment with all available languages and -counts all syntactic structures that it finds along the way. The language -with greatest count wins. +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. -This means that in short fragments the probability of an error is high -(and it really happens sometimes). In this cases you can set the fragment's -language explicitly by assigning a class to the `<code>` element: +**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 -<pre><code class="html">...</code></pre> +<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/languages/go.min.js"></script> ``` -You can use class names recommended in HTML5: "language-html", -"language-php". Classes also can be assigned to the `<pre>` element. +**On Almond.** You need to use the optimizer to give the module a name. For +example: -To disable highlighting of a fragment altogether use "no-highlight" class: - -```html -<pre><code class="no-highlight">...</code></pre> ``` +r.js -o name=hljs paths.hljs=/path/to/highlight out=highlight.js +``` -## Export +## License -File export.html contains a little program that allows you to paste in a code -snippet and then copy and paste the resulting HTML code generated by the -highlighter. This is useful in situations when you can't use the script itself -on a site. +Highlight.js is released under the BSD License. See [LICENSE][7] file +for details. +## Links -## Meta +The official site for the library is at <https://highlightjs.org/>. -- Version: 8.0 -- URL: http://highlightjs.org/ +Further in-depth documentation for the API and other topics is at +<http://highlightjs.readthedocs.io/>. -For the license terms see LICENSE files. -For authors and contributors see AUTHORS.en.txt file. +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 Modified: trunk/themes/default/highlight.js/README.ru.md =================================================================== --- trunk/themes/default/highlight.js/README.ru.md 2016-10-14 11:00:13 UTC (rev 9970) +++ trunk/themes/default/highlight.js/README.ru.md 2016-10-14 15:39:20 UTC (rev 9971) @@ -1,171 +1,142 @@ # Highlight.js -Highlight.js нужен для подсветки синтаксиса в примерах кода в блогах, -форумах и вообще на любых веб-страницах. Пользоваться им очень просто, -потому что работает он автоматически: сам находит блоки кода, сам -определяет язык, сам подсвечивает. +Highlight.js — это инструмент для подсветки синтаксиса, написанный на JavaScript. Он работает +и в браузере, и на сервере. Он работает с практически любой HTML разметкой, не +зависит от каких-либо фреймворков и умеет автоматически определять язык. -Автоопределением языка можно управлять, когда оно не справляется само (см. -дальше "Эвристика"). +## Начало работы -## Простое использование +Минимум, что нужно сделать для использования highlight.js на веб-странице — это +подключить библиотеку, CSS-стили и вызывать [`initHighlightingOnLoad`][1]: -Подключите библиотеку и стиль на страницу и повесть вызов подсветки на -загрузку страницы: - ```html -<link rel="stylesheet" href="styles/default.css"> -<script src="highlight.pack.js"></script> +<link rel="stylesheet" href="/path/to/styles/default.css"> +<script src="/path/to/highlight.pack.js"></script> <script>hljs.initHighlightingOnLoad();</script> ``` -Весь код на странице, обрамлённый в теги `<pre><code> .. </code></pre>` -будет автоматически подсвечен. Если вы используете другие теги или хотите -подсвечивать блоки кода динамически, читайте "Инициализацию вручную" ниже. +Библиотека найдёт и раскрасит код внутри тегов `<pre><code>`, попытавшись +автоматически определить язык. Когда автоопределение не срабатывает, можно явно +указать язык в атрибуте class: -- Вы можете скачать собственную версию "highlight.pack.js" или сослаться - на захостенный файл, как описано на странице загрузки: - <http://highlightjs.org/download/> +```html +<pre><code class="html">...</code></pre> +``` -- Стилевые темы можно найти в загруженном архиве или также использовать - захостенные. Чтобы сделать собственный стиль для своего сайта, вам - будет полезен [CSS classes reference][cr], который тоже есть в архиве. +Список поддерживаемых классов языков доступен в [справочнике по классам][2]. +Класс также можно предварить префиксами `language-` или `lang-`. -[cr]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html +Чтобы отключить подсветку для какого-то блока, используйте класс `nohighlight`: +```html +<pre><code class="nohighlight">...</code></pre> +``` -## node.js +## Инициализация вручную -Highlight.js можно использовать в node.js. Библиотеку со всеми возможными языками можно -установить с NPM: +Чтобы иметь чуть больше контроля за инициализацией подсветки, вы можете +использовать функции [`highlightBlock`][3] и [`configure`][4]. Таким образом +можно управлять тем, *что* и *когда* подсвечивать. - npm install highlight.js +Вот пример инициализации, эквивалентной вызову [`initHighlightingOnLoad`][1], но +с использованием jQuery: -Также её можно собрать из исходников с только теми языками, которые нужны: - - python3 tools/build.py -tnode lang1 lang2 .. - -Использование библиотеки: - ```javascript -var hljs = require('highlight.js'); - -// Если вы знаете язык -hljs.highlight(lang, code).value; - -// Автоопределение языка -hljs.highlightAuto(code).value; +$(document).ready(function() { + $('pre code').each(function(i, block) { + hljs.highlightBlock(block); + }); +}); ``` +Вы можете использовать любые теги разметки вместо `<pre><code>`. Если +используете контейнер, не сохраняющий переводы строк, вам нужно сказать +highlight.js использовать для них тег `<br>`: -## AMD - -Highlight.js можно использовать с загрузчиком AMD-модулей. Для этого его -нужно собрать из исходников следующей командой: - -```bash -$ python3 tools/build.py -tamd lang1 lang2 .. -``` - -Она создаст файл `build/highlight.pack.js`, который является загружаемым -AMD-модулем и содержит все выбранные при сборке языки. Используется он так: - ```javascript -require(["highlight.js/build/highlight.pack"], function(hljs){ +hljs.configure({useBR: true}); - // Если вы знаете язык - hljs.highlight(lang, code).value; - - // Автоопределение языка - hljs.highlightAuto(code).value; +$('div.code').each(function(i, block) { + hljs.highlightBlock(block); }); ``` +Другие опции можно найти в документации функции [`configure`][4]. -## Замена TABов -Также вы можете заменить символы TAB ('\x09'), используемые для отступов, на -фиксированное количество пробелов или на отдельный `<span>`, чтобы задать ему -какой-нибудь специальный стиль: +## Web Workers -```html -<script type="text/javascript"> - hljs.configure({tabReplace: ' '}); // 4 spaces - // ... or - hljs.configure({tabReplace: '<span class="indent">\t</span>'}); +Подсветку можно запустить внутри web worker'а, чтобы окно +браузера не подтормаживало при работе с большими кусками кода. - hljs.initHighlightingOnLoad(); -</script> -``` +В основном скрипте: - -## Инициализация вручную - -Если вы используете другие теги для блоков кода, вы можете инициализировать их -явно с помощью функции `highlightBlock(code)`. Она принимает DOM-элемент с -текстом расцвечиваемого кода и опционально - строчку для замены символов TAB. - -Например с использованием jQuery код инициализации может выглядеть так: - ```javascript -$(document).ready(function() { - $('pre code').each(function(i, e) {hljs.highlightBlock(e)}); -}); +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); +}) ``` -`highlightBlock` можно также использовать, чтобы подсветить блоки кода, -добавленные на страницу динамически. Только убедитесь, что вы не делаете этого -повторно для уже раскрашенных блоков. +В worker.js: -Если ваш блок кода использует `<br>` вместо переводов строки (т.е. если это не -`<pre>`), включите опцию `useBR`: - ```javascript -hljs.configure({useBR: true}); -$('div.code').each(function(i, e) {hljs.highlightBlock(e)}); +onmessage = function(event) { + importScripts('<path>/highlight.pack.js'); + var result = self.hljs.highlightAuto(event.data); + postMessage(result.value); +} ``` -## Эвристика +## Установка библиотеки -Определение языка, на котором написан фрагмент, делается с помощью -довольно простой эвристики: программа пытается расцветить фрагмент всеми -языками подряд, и для каждого языка считает количество подошедших -синтаксически конструкций и ключевых слов. Для какого языка нашлось больше, -тот и выбирается. +Highlight.js можно использовать в браузере прямо с CDN хостинга или скачать +индивидуальную сборку, а также установив модуль на сервере. На +[странице загрузки][5] подробно описаны все варианты. -Это означает, что в коротких фрагментах высока вероятность ошибки, что -периодически и случается. Чтобы указать язык фрагмента явно, надо написать -его название в виде класса к элементу `<code>`: +**Не подключайте GitHub напрямую.** Библиотека не предназначена для +использования в виде исходного кода, а требует отдельной сборки. Если вам не +подходит ни один из готовых вариантов, читайте [документацию по сборке][6]. +**Файл на CDN содержит не все языки.** Иначе он будет слишком большого размера. +Если нужного вам языка нет в [категории "Common"][5], можно дообавить его +вручную: + ```html -<pre><code class="html">...</code></pre> +<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/languages/go.min.js"></script> ``` -Можно использовать рекомендованные в HTML5 названия классов: -"language-html", "language-php". Также можно назначать классы на элемент -`<pre>`. +**Про Almond.** Нужно задать имя модуля в оптимизаторе, например: -Чтобы запретить расцветку фрагмента вообще, используется класс "no-highlight": - -```html -<pre><code class="no-highlight">...</code></pre> ``` +r.js -o name=hljs paths.hljs=/path/to/highlight out=highlight.js +``` -## Экспорт +## Лицензия -В файле export.html находится небольшая программка, которая показывает и дает -скопировать непосредственно HTML-код подсветки для любого заданного фрагмента кода. -Это может понадобится например на сайте, на котором нельзя подключить сам скрипт -highlight.js. +Highlight.js распространяется под лицензией BSD. Подробнее читайте файл +[LICENSE][7]. -## Координаты +## Ссылки -- Версия: 8.0 -- URL: http://highlightjs.org/ +Официальный сайт билиотеки расположен по адресу <https://highlightjs.org/>. -Лицензионное соглашение читайте в файле LICENSE. -Список авторов и соавторов читайте в файле AUTHORS.ru.txt +Более подробная документация по API и другим темам расположена на +<http://highlightjs.readthedocs.io/>. + +Авторы и контрибьюторы перечислены в файле [AUTHORS.ru.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.ru.txt Modified: trunk/themes/default/highlight.js/highlight.pack.js =================================================================== --- trunk/themes/default/highlight.js/highlight.pack.js 2016-10-14 11:00:13 UTC (rev 9970) +++ trunk/themes/default/highlight.js/highlight.pack.js 2016-10-14 15:39:20 UTC (rev 9971) @@ -1 +1,2 @@ -var hljs=new function(){function k(v){return v.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(v){return v.nodeName.toLowerCase()}function i(w,x){var v=w&&w.exec(x);return v&&v.index==0}function d(v){return Array.prototype.map.call(v.childNodes,function(w){if(w.nodeType==3){return b.useBR?w.nodeValue.replace(/\n/g,""):w.nodeValue}if(t(w)=="br"){return"\n"}return d(w)}).join("")}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^language-/,"")});return v.filter(function(x){return j(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+k(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=k(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+k(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};function E(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})}if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b=D.bK.split(" ").join("|")}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?\\b("+F.b+")\\b\\.?":F.b}).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(i(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(i(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&i(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){var U=k(C);if(!I.k){return U}var T="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(U);while(V){T+=U.substr(X,V.index-X);var W=E(I,V);if(W){H+=W[1];T+=w(W[0],V[0])}else{T+=V[0]}X=I.lR.lastIndex;V=I.lR.exec(U)}return T+U.substr(X)}function F(){if(I.sL&&!f[I.sL]){return k(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):g(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=k(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=k(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=j(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:k(L)}}else{throw O}}}function g(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:k(y)};var w=v;x.forEach(function(z){if(!j(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function h(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=d(z);var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):g(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=h(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function e(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function j(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=g;this.fixMarkup=h;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=e;this.getLanguage=j;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b... [truncated message content] |