diff --git a/exemple/box-sizing/index.html b/exemple/box-sizing/index.html new file mode 100644 index 0000000000000000000000000000000000000000..7732fee384fd79b07020d92b04dd4f920a6921a0 --- /dev/null +++ b/exemple/box-sizing/index.html @@ -0,0 +1,35 @@ + + + + + + + + + + + Box-sizing + + +

Box-sizing

+ +
+ Box 1 +
+ +
+ Box 2 +
+ +
+ Box 3 +
+ + + + + diff --git a/exemple/css/style.css b/exemple/css/style.css new file mode 100644 index 0000000000000000000000000000000000000000..1e5b35be9504c08fb850a3992f4878d42b60bb2c --- /dev/null +++ b/exemple/css/style.css @@ -0,0 +1,68 @@ +body { + margin:0; + padding:10px 40px; + background:#fff; + font-size: 1.4em; + font-family: helvetica, arial, serif; +} + h1 { + font-size:1.8em; +} + h2 { + font-size:1.1em; + text-decoration: underline; +} + +h3 { + color: gray; + font-size:1.0em; + text-decoration: underline; +} + + .parent { + border: 5px solid #000; + width: 80%; + outline: 1px solid #333; + background: #eee; + margin: 0; + padding: 0; + display: -webkit-flex; + /* OK chrome 21 */ + display: flex; +} + li { + color: #fff; + padding: 10px; + list-style: none; + background: purple; +} + li:nth-child(2) { + background: indigo; +} + li:nth-child(3) { + background: blue; +} +li:nth-child(4) { + background: green; +} +li:nth-child(5) { + background: yellow; +} + +.box { + border: solid blue; + width: 33%; + box-sizing: border-box; +} + +.box:nth-child(1) { + padding: 10px; +} + +.box:nth-child(2) { + border: 1px; +} + +.box:nth-child(3) { + padding-left: 2em; +} diff --git a/exemple/flexbox/flextest01.html b/exemple/flexbox/flextest01.html new file mode 100644 index 0000000000000000000000000000000000000000..5af41e2afabfa47dd21be1c9c8f70743e59617a8 --- /dev/null +++ b/exemple/flexbox/flextest01.html @@ -0,0 +1,50 @@ + + + + + + + + + Mise en page CSS avec Flexbox + + +

Mise en page CSS avec Flexbox

+

1 : display: flex

+ +
+        
+            
+        
+    
+ +
+        
+            .parent {
+                border: 5px solid #000;
+                display: flex;
+            }
+        
+    
+ + + + + diff --git a/exemple/flexbox/flextest02.html b/exemple/flexbox/flextest02.html new file mode 100644 index 0000000000000000000000000000000000000000..4ee6ca6d728394bf26d44d241e60504bac8ae0c9 --- /dev/null +++ b/exemple/flexbox/flextest02.html @@ -0,0 +1,54 @@ + + + + + + + + + Mise en page CSS avec Flexbox + + +

Mise en page CSS avec Flexbox

+

2 : flex-direction: column

+ + +
+        
+            
+        
+    
+ +
+        
+            .parent {
+                border: 5px solid #000;
+                display: flex;
+                flex-direction: column;
+            }
+        
+    
+ + + + + diff --git a/exemple/flexbox/flextest03.html b/exemple/flexbox/flextest03.html new file mode 100644 index 0000000000000000000000000000000000000000..837e8700bceebb39bcbcf7723faac6e7a8e6750f --- /dev/null +++ b/exemple/flexbox/flextest03.html @@ -0,0 +1,48 @@ + + + + + + + + + + Mise en page CSS avec Flexbox + + +

Mise en page CSS avec Flexbox

+

3 : flex-wrap: ... (resize browser)

+ +

3.1 : flex-wrap: nowrap

+ + +

3.2 : flex-wrap: wrap

+ + + + + + diff --git a/exemple/flexbox/flextest04.html b/exemple/flexbox/flextest04.html new file mode 100644 index 0000000000000000000000000000000000000000..f21c2365f63a91877cd365b8f97b67cb84dc01d4 --- /dev/null +++ b/exemple/flexbox/flextest04.html @@ -0,0 +1,84 @@ + + + + + + + + + + Mise en page CSS avec Flexbox + + +

Mise en page CSS avec Flexbox

+

4 : justify-content

+ +

4.1 : flex-start

+ + +

4.2 : flex-end

+ + +

4.3 : center

+ + +

4.4 : space-between

+ + +

4.5 space-around

+ + + + diff --git a/exemple/flexbox/flextest05.html b/exemple/flexbox/flextest05.html new file mode 100644 index 0000000000000000000000000000000000000000..b60b64c69564c63cc742d9dc38f5e46233b9a74d --- /dev/null +++ b/exemple/flexbox/flextest05.html @@ -0,0 +1,94 @@ + + + + + + + + + + Mise en page CSS avec Flexbox + + +

Mise en page CSS avec Flexbox

+

5 : align-items

+ +

5.1 :flex-start

+ + +

5.2 : flex-end

+ + +

5.3 : center

+ + +

5.4 : baseline

+ + +

5.5 : stretch

+ + +
+        
+            
+        
+    
+ + diff --git a/exemple/flexbox/flextest06.html b/exemple/flexbox/flextest06.html new file mode 100644 index 0000000000000000000000000000000000000000..9e04170914845dea71db18a8ab9c056dbcfd891b --- /dev/null +++ b/exemple/flexbox/flextest06.html @@ -0,0 +1,70 @@ + + + + + + + + + + Mise en page CSS avec Flexbox + + +

Mise en page CSS avec Flexbox

+

6 : flex

+

6.1 : flex: initial

+ + +

6.2 : flex: 1 (dernier enfant)

+ + +

6.3 : flex: 1 (4è et 5è enfant)

+ + +

6.4 : flex: 1 (tous)

+ + + + diff --git a/exemple/flexbox/flextest07.html b/exemple/flexbox/flextest07.html new file mode 100644 index 0000000000000000000000000000000000000000..493c03e6a6c942a11d9f63878c244c285a80bf16 --- /dev/null +++ b/exemple/flexbox/flextest07.html @@ -0,0 +1,44 @@ + + + + + + + + + + Mise en page CSS avec Flexbox + + +

Mise en page CSS avec Flexbox

+

7 : order

+ + + +
+        
+            li:nth-of-type(3) {
+        		-webkit-order: 1;
+        		order: 1;
+        	}
+        
+    
+ + diff --git a/exemple/grid-and-flex/index.html b/exemple/grid-and-flex/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e8ea6755b29867831b024769c697db80a5bc652 --- /dev/null +++ b/exemple/grid-and-flex/index.html @@ -0,0 +1,100 @@ + + + + + + + + + + +
+
+ + + +
+
+ + +
+ +

Flexbox and CSS Grid Layout

+ +

It's okay to combine CSS Grid Layout and Flexbox.

+ +

Is the content in a straight line or column (cards, navigation items, or other content blocks)? For occasions that require elements to line up in one direction, meaning it is more “one-dimensional”, typically Flexbox is the better option. Also, Flexbox is good at dynamically scaling elements. Maybe you’ve tried this in a row of boxes, by adding display:flex; on a parent element and flex properties on the child elements, there’s a nice line formed and this is an efficient way to make sure they are all the same height.

+ +

**If things do not look right, make sure your browser is in "Experimental Mode". +

+ +
+
+
+

View Grid Help

+

See tips and tricks for CSS Grid Layouts...

+ +
+
+

View Flexbox Help

+

See tips and tricks for Flexbox layouts...

+ +
+
+

View Combined Help

+

See tips and tricks for combined layouts...

+ +
+
+ + + + +
+ + diff --git a/exemple/grid-and-flex/style.css b/exemple/grid-and-flex/style.css new file mode 100644 index 0000000000000000000000000000000000000000..b2441c7c535bd9e5457bb32c28a33c25d3ec50a0 --- /dev/null +++ b/exemple/grid-and-flex/style.css @@ -0,0 +1,220 @@ +@import url('//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css'); +@import url('https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700'); + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +a { + color: inherit; + text-decoration: none; +} + +body { + background-color: #eee; + color: #434344; + font-family: "Montserrat", sans-serif; + font-weight: 400; +} + +p { + font-size: 1.5rem; +} + +.container { + max-width: 1250px; + margin: 0 auto; + padding: 0 60px; + display: grid; + grid-template-columns: 0.4fr 0.3fr 0.3fr; + grid-column-gap: 10px; + grid-row-gap: 15px; + background-color: #fff; +} + +.grid { +} + +.header { + grid-column: 1 / 4; + grid-row: 1 / 2; + color: #9f9c9c; + text-transform: uppercase; + border-bottom: 2px solid #b0e0ea; + padding: 20px 0; + display: flex; + justify-content: space-between; + align-items: center; +} + +.header nav { + +} + +.header nav ul { + display: flex; +/* align-items: baseline; */ + list-style-type: none; +} + +.header nav li { + margin-right: 15px; +} + +.header button { + border: none; + padding: 8px 25px; + color: #fff; + font-weight: 600; + cursor: pointer; + border-radius: 1.25rem; + background-color: #51bb7b; +} + +.logo { + font-size: 2rem; + margin-right: 1.5rem; + color: #50c6db; +} + +.hero { + grid-column: 1 / 2; + grid-row-start: 2 / 3; + background-color: #d5c9e2; + min-height: 300px; + background-image: url("http://abbeyjfitzgerald.com/wp-content/uploads/2017/06/combined-layout-hero-1.jpg"); +} + +.hero-unit img { + width: 100%; + height: auto; +} + +.sidebar { + grid-column: 1 / 2; + grid-row: 3 / 5; + padding: 20px; + border-top: 3px solid #693f7e; + background-color: #f9f9f9; +} + +.sidebar h3 { + margin-top: .75rem; +} + +.sidebar ul { + list-style-type: none; + margin-top: 1rem; + font-size: .75rem; +} + +.sidebar ul > li { + padding: .25rem 0; +} + +.sidebar img { + max-width: 100%; +} + +.main { + grid-column: 2 / 4; + grid-row: 2 / 4; +/* min-height: 500px; */ +} + +.main h2 { + font-size: 32px; + margin-bottom: 1rem; + color: #50c6db; +} + +.main p { + font-size: 1rem; + margin-bottom: .75rem; +} + +.main img { + width: 100%; +} + +.extra { + grid-column: 2 / 4; + grid-row: 4 / 5; + padding: 1rem; + display: flex; + flex-wrap: wrap; + border: 1px solid #ececec; + justify-content: space-between; +} + +.extra h3 { + font-weight: 500; + margin-bottom: .5rem; + flex: 1 0 auto; +} + +.extra p { + font-size: .75rem; + margin-bottom: .75rem; +} + +.extra button { + background-color: white; + border: 2px solid #50c6db; + color: #50c6db; + padding: .5rem; +} +.content-block-info { + flex: 0 1 calc(33% - .5rem); +} + +.related-images { + grid-column: 1 / 3; + grid-row: 5 / 6; + display: grid; + grid-template-columns: repeat(4,1fr); + grid-gap: 1rem; +} + +.related-images .icon { + background-color: white; + flex: 1 1 150px; +} + +.related-images .icon img { + max-width: 100%; +} + +.related-posts { + grid-column: 3 / 4; + grid-row: 5 / 6; + padding: 0 2rem; +} + +.related-posts h4 { + margin-bottom: .5rem; + padding-bottom: .5rem; + font-size: 1.5rem; + border-bottom: 1px solid #ececec; +} + +.related-posts ul { + margin-left: 1.5rem; +} + +footer { + grid-column: 1 / 4; + grid-row: 6 / 7; + color: #fff; + text-align: center; + padding: 20px 0; + background-color: #9f9c9c; +} + +footer p { + color: #434344; + font-size: 12px; + padding: 10px; +} diff --git a/exemple/grid/4colonne.html b/exemple/grid/4colonne.html new file mode 100644 index 0000000000000000000000000000000000000000..ba0a09298d36062437f2dee0f8fd6f5575e6d589 --- /dev/null +++ b/exemple/grid/4colonne.html @@ -0,0 +1,39 @@ + + + + + + + + + + + Grid layout + + + +
Section
+
Article
+ + + diff --git a/exemple/grid/centrage.html b/exemple/grid/centrage.html new file mode 100644 index 0000000000000000000000000000000000000000..1da6533c2f74e71d59509024f30dd94fac2647e3 --- /dev/null +++ b/exemple/grid/centrage.html @@ -0,0 +1,85 @@ + + + + + + + + + + + Grid layout + + + + +
+
header
+ +
article
+ +
+ + diff --git a/exemple/grid/index.html b/exemple/grid/index.html new file mode 100644 index 0000000000000000000000000000000000000000..7e7830227483f6e6a5876d2e05e7895ed5d584da --- /dev/null +++ b/exemple/grid/index.html @@ -0,0 +1,30 @@ + + + + + + + + + + + Grid layout + + + +
Section
+ + diff --git a/exemple/node_modules/.yarn-integrity b/exemple/node_modules/.yarn-integrity new file mode 100644 index 0000000000000000000000000000000000000000..1a3ca9961c96c028cb6bd2f94a2992f4982d0d71 --- /dev/null +++ b/exemple/node_modules/.yarn-integrity @@ -0,0 +1,16 @@ +{ + "systemParams": "darwin-x64-64", + "modulesFolders": [ + "node_modules" + ], + "flags": [], + "linkedModules": [], + "topLevelPatterns": [ + "highlight.js@^9.12.0" + ], + "lockfileEntries": { + "highlight.js@^9.12.0": "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" + }, + "files": [], + "artifacts": {} +} \ No newline at end of file diff --git a/exemple/node_modules/highlight.js/LICENSE b/exemple/node_modules/highlight.js/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..422deb7350fe14c2cefdc65d0689f214b45c4764 --- /dev/null +++ b/exemple/node_modules/highlight.js/LICENSE @@ -0,0 +1,24 @@ +Copyright (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. diff --git a/exemple/node_modules/highlight.js/README.md b/exemple/node_modules/highlight.js/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9f76e6bd56ef40ff28f3f282cfbeb4c631e59332 --- /dev/null +++ b/exemple/node_modules/highlight.js/README.md @@ -0,0 +1,150 @@ +# Highlight.js + +[![Build Status](https://travis-ci.org/isagalaev/highlight.js.svg?branch=master)](https://travis-ci.org/isagalaev/highlight.js) + +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 + +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]: + +```html + + + +``` + +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 diff --git a/exemple/node_modules/highlight.js/docs/api.rst b/exemple/node_modules/highlight.js/docs/api.rst new file mode 100644 index 0000000000000000000000000000000000000000..d8039539d3f865738872a6bcecf8d7034f4bc956 --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/api.rst @@ -0,0 +1,120 @@ +Library 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. diff --git a/exemple/node_modules/highlight.js/docs/building-testing.rst b/exemple/node_modules/highlight.js/docs/building-testing.rst new file mode 100644 index 0000000000000000000000000000000000000000..16292cb84a1559d4599eab8e669b6ba00d8272f5 --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/building-testing.rst @@ -0,0 +1,88 @@ +Building 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. + + diff --git a/exemple/node_modules/highlight.js/docs/css-classes-reference.rst b/exemple/node_modules/highlight.js/docs/css-classes-reference.rst new file mode 100644 index 0000000000000000000000000000000000000000..49eef3980db923480bca2a66e80d5c76c54b22f8 --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/css-classes-reference.rst @@ -0,0 +1,432 @@ +CSS 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 | ++-------------------------+---------------------------------------------------+ diff --git a/exemple/node_modules/highlight.js/docs/index.rst b/exemple/node_modules/highlight.js/docs/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..0559dfd2a70f6749e5748c47ee0e821af28f9803 --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/index.rst @@ -0,0 +1,44 @@ +.. highlight.js documentation master file, created by + sphinx-quickstart on Wed Sep 12 23:48:27 2012. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +``highlight.js`` developer documentation +========================================== + +Contents: + +.. toctree:: + :maxdepth: 1 + + api + language-guide + reference + css-classes-reference + style-guide + language-contribution + building-testing + release-process + +Miscellaneous: + +.. toctree:: + :maxdepth: 1 + + line-numbers + language-requests + +Links: + +- Code: https://github.com/isagalaev/highlight.js +- Discussion: http://groups.google.com/group/highlightjs +- Bug tracking: https://github.com/isagalaev/highlight.js/issues + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/exemple/node_modules/highlight.js/docs/language-contribution.rst b/exemple/node_modules/highlight.js/docs/language-contribution.rst new file mode 100644 index 0000000000000000000000000000000000000000..4deae3f3658f1e4b611265dfd155599a4f4e3e46 --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/language-contribution.rst @@ -0,0 +1,78 @@ +Language 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. diff --git a/exemple/node_modules/highlight.js/docs/language-guide.rst b/exemple/node_modules/highlight.js/docs/language-guide.rst new file mode 100644 index 0000000000000000000000000000000000000000..f48c748be32f95c777dbaba879e27ba284eb3e38 --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/language-guide.rst @@ -0,0 +1,264 @@ +Language 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 `. diff --git a/exemple/node_modules/highlight.js/docs/language-requests.rst b/exemple/node_modules/highlight.js/docs/language-requests.rst new file mode 100644 index 0000000000000000000000000000000000000000..4e4c2f0b61acc62b0e780896f7544e75e933469e --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/language-requests.rst @@ -0,0 +1,17 @@ +On requesting new languages +=========================== + +This is a general answer to requests for adding new languages that appear from +time to time in the highlight.js issue tracker and discussion group. + + Highlight.js doesn't have a fundamental plan for implementing languages, + instead the project works by accepting language definitions from + interested contributors. There are also no rules at the moment forbidding + any languages from being added to the library, no matter how obscure or + weird. + + This means that there's no point in requesting a new language without + providing an implementation for it. If you want to see a particular language + included in highlight.js but cannot implement it, the best way to make it + happen is to get another developer interested in doing so. Here's our + :doc:`language-guide`. diff --git a/exemple/node_modules/highlight.js/docs/line-numbers.rst b/exemple/node_modules/highlight.js/docs/line-numbers.rst new file mode 100644 index 0000000000000000000000000000000000000000..674542d4edc194feae37387cda25fc9c7a5f9201 --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/line-numbers.rst @@ -0,0 +1,39 @@ +Line 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. diff --git a/exemple/node_modules/highlight.js/docs/reference.rst b/exemple/node_modules/highlight.js/docs/reference.rst new file mode 100644 index 0000000000000000000000000000000000000000..56879fbd9a63d31693043944e73a31369d5d8656 --- /dev/null +++ b/exemple/node_modules/highlight.js/docs/reference.rst @@ -0,0 +1,324 @@ +Mode 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 ``