From 18ba154f000efd66d43e79fbcaf6e87de1d77fc1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 19 Jun 2018 21:05:52 -0700 Subject: [PATCH 1/7] tools: remove unnecessary line in html.js Remove unneeded line that will cause links to break when we update to marked 0.4.0. --- tools/doc/html.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index ae2da58b7a0131..44dfa7932144c3 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -214,8 +214,6 @@ function preprocessElements(lexed, filename) { '') + `${prefix} ${number}${noLinking ? '' : ''}${explication}` .replace(/\n/g, ' '); - - lexed[index] = { type: 'html', text: token.text }; } else if (state === 'MAYBE_STABILITY_BQ') { state = null; lexed[index - 1] = { type: 'blockquote_start' }; From e0412205a9d60161a473445aecab4ee73220ee57 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 19 Jun 2018 21:41:32 -0700 Subject: [PATCH 2/7] doc: simplify buffer.md markdown Simplify the inline markdown in buffer.md. Admission: This is to work around an issue that arises when this markdown is processed by `marked` v0.4.0. --- doc/api/buffer.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index c219f00e4a1f48..c1c928d02799d9 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -206,8 +206,8 @@ changes: `Buffer` instances are also [`Uint8Array`] instances. However, there are subtle incompatibilities with [`TypedArray`]. For example, while [`ArrayBuffer#slice()`] creates a copy of the slice, the implementation of -[`Buffer#slice()`][`buf.slice()`] creates a view over the existing `Buffer` -without copying, making [`Buffer#slice()`][`buf.slice()`] far more efficient. +[`Buffer#slice()`] creates a view over the existing `Buffer` +without copying, making [`Buffer#slice()`] far more efficient. It is also possible to create new [`TypedArray`] instances from a `Buffer` with the following caveats: @@ -2603,6 +2603,7 @@ This value may depend on the JS engine that is being used. [`ArrayBuffer#slice()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/slice [`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer +[`Buffer#slice()`]: #buffer_buf_slice_start_end [`Buffer.alloc()`]: #buffer_class_method_buffer_alloc_size_fill_encoding [`Buffer.allocUnsafe()`]: #buffer_class_method_buffer_allocunsafe_size [`Buffer.allocUnsafeSlow()`]: #buffer_class_method_buffer_allocunsafeslow_size From 25741dcee341c6d7b6a1bcdfb7e9eb0bda6e962b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 19 Jun 2018 22:14:31 -0700 Subject: [PATCH 3/7] doc: add links to inline HTML table Links in crypto.md table had previously been autolinking, but correct Mardkwon processing will not autolink in block elements like tables. Upcoming marked 0.4.0 will not autolink in this instance, so add the links as anchor elements. --- doc/api/crypto.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index e3d069e101aabd..ab33ff3a578d13 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2409,7 +2409,7 @@ The following constants exported by `crypto.constants` apply to various uses of the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. ### OpenSSL Options - + @@ -2418,20 +2418,20 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. + https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html + for detail. + https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. + https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. @@ -2565,6 +2565,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
Constant
SSL_OP_ALL Applies multiple bug workarounds within OpenSSL. See - https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for - detail.
SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See - https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html.
SSL_OP_CIPHER_SERVER_PREFERENCE Attempts to use the server's preferences instead of the client's when selecting a cipher. Behavior depends on protocol version. See - https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html.
SSL_OP_CISCO_ANYCONNECT
### OpenSSL Engine Constants + From 676c1bb5047261a4e3dee2b84752cca16cbfb0ed Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 1 Jun 2018 13:21:25 +0200 Subject: [PATCH 4/7] tools: update marked to 0.4.0 Update marked to 0.4.0 for use with the tools/doc/*.js tools. --- LICENSE | 26 +- test/doctool/test-doctool-json.js | 2 +- tools/doc/node_modules/.bin/marked | 1 + tools/doc/node_modules/marked/.eslintignore | 1 + tools/doc/node_modules/marked/.eslintrc.json | 28 + tools/doc/node_modules/marked/.npmignore | 2 - tools/doc/node_modules/marked/.travis.yml | 5 - tools/doc/node_modules/marked/Gulpfile.js | 22 - tools/doc/node_modules/marked/LICENSE | 19 - tools/doc/node_modules/marked/LICENSE.md | 43 + tools/doc/node_modules/marked/Makefile | 3 + tools/doc/node_modules/marked/README.md | 409 +--------- tools/doc/node_modules/marked/bin/marked | 44 +- tools/doc/node_modules/marked/bower.json | 24 - tools/doc/node_modules/marked/component.json | 10 - tools/doc/node_modules/marked/doc/broken.md | 426 ---------- tools/doc/node_modules/marked/doc/todo.md | 2 - tools/doc/node_modules/marked/jasmine.json | 11 + tools/doc/node_modules/marked/lib/marked.js | 762 ++++++++++++------ tools/doc/node_modules/marked/man/marked.1 | 4 +- .../doc/node_modules/marked/man/marked.1.txt | 96 +++ tools/doc/node_modules/marked/marked.min.js | 4 +- tools/doc/node_modules/marked/package.json | 67 +- tools/doc/package-lock.json | 6 +- tools/doc/package.json | 2 +- tools/license-builder.sh | 2 +- 26 files changed, 822 insertions(+), 1199 deletions(-) create mode 120000 tools/doc/node_modules/.bin/marked create mode 100644 tools/doc/node_modules/marked/.eslintignore create mode 100644 tools/doc/node_modules/marked/.eslintrc.json delete mode 100644 tools/doc/node_modules/marked/.npmignore delete mode 100644 tools/doc/node_modules/marked/.travis.yml delete mode 100644 tools/doc/node_modules/marked/Gulpfile.js delete mode 100644 tools/doc/node_modules/marked/LICENSE create mode 100644 tools/doc/node_modules/marked/LICENSE.md delete mode 100644 tools/doc/node_modules/marked/bower.json delete mode 100644 tools/doc/node_modules/marked/component.json delete mode 100644 tools/doc/node_modules/marked/doc/broken.md delete mode 100644 tools/doc/node_modules/marked/doc/todo.md create mode 100644 tools/doc/node_modules/marked/jasmine.json create mode 100644 tools/doc/node_modules/marked/man/marked.1.txt diff --git a/LICENSE b/LICENSE index d768eb3e2dab1b..9e379a53f49df4 100644 --- a/LICENSE +++ b/LICENSE @@ -1037,7 +1037,17 @@ The externally maintained libraries used by Node.js are: - marked, located at tools/doc/node_modules/marked, is licensed as follows: """ - Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/) + # License information + + ## Contribution License Agreement + + If you contribute code to this project, you are implicitly allowing your code + to be distributed under the MIT license. You are also implicitly verifying that + all code is your original work. `` + + ## Marked + + Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -1056,6 +1066,20 @@ The externally maintained libraries used by Node.js are: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + ## Markdown + + Copyright © 2004, John Gruber + http://daringfireball.net/ + 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 “Markdown” 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 copyright holders 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 copyright owner or 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. """ - cpplint.py, located at tools/cpplint.py, is licensed as follows: diff --git a/test/doctool/test-doctool-json.js b/test/doctool/test-doctool-json.js index e295014071a3c5..2b4ff54f0cae1b 100644 --- a/test/doctool/test-doctool-json.js +++ b/test/doctool/test-doctool-json.js @@ -130,7 +130,7 @@ const testData = [ { textRaw: 'Something', name: 'something', - desc: '\n

' + + desc: '\n\n

' + 'Describe Something in more detail here.

\n', type: 'module', displayName: 'Something' diff --git a/tools/doc/node_modules/.bin/marked b/tools/doc/node_modules/.bin/marked new file mode 120000 index 00000000000000..a8d872e9dc1fd9 --- /dev/null +++ b/tools/doc/node_modules/.bin/marked @@ -0,0 +1 @@ +../marked/bin/marked \ No newline at end of file diff --git a/tools/doc/node_modules/marked/.eslintignore b/tools/doc/node_modules/marked/.eslintignore new file mode 100644 index 00000000000000..121531af8467c5 --- /dev/null +++ b/tools/doc/node_modules/marked/.eslintignore @@ -0,0 +1 @@ +*.min.js diff --git a/tools/doc/node_modules/marked/.eslintrc.json b/tools/doc/node_modules/marked/.eslintrc.json new file mode 100644 index 00000000000000..7fdd614117f1fd --- /dev/null +++ b/tools/doc/node_modules/marked/.eslintrc.json @@ -0,0 +1,28 @@ +{ + "extends": "standard", + "plugins": [ + "standard" + ], + "parserOptions": { "ecmaVersion": 5 }, + "rules": { + "semi": "off", + "indent": ["warn", 2, { + "VariableDeclarator": { "var": 2 }, + "SwitchCase": 1, + "outerIIFEBody": 0 + }], + "space-before-function-paren": "off", + "operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }], + "no-cond-assign": "off", + "no-useless-escape": "off", + "no-return-assign": "off", + "one-var": "off", + "no-control-regex": "off" + }, + "env": { + "node": true, + "browser": true, + "amd": true, + "jasmine": true + } +} diff --git a/tools/doc/node_modules/marked/.npmignore b/tools/doc/node_modules/marked/.npmignore deleted file mode 100644 index 3fb773c0342dda..00000000000000 --- a/tools/doc/node_modules/marked/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -.git* -test/ diff --git a/tools/doc/node_modules/marked/.travis.yml b/tools/doc/node_modules/marked/.travis.yml deleted file mode 100644 index 60d00ce140f37d..00000000000000 --- a/tools/doc/node_modules/marked/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.10" - - "0.8" - - "0.6" diff --git a/tools/doc/node_modules/marked/Gulpfile.js b/tools/doc/node_modules/marked/Gulpfile.js deleted file mode 100644 index cebc16a650b0e9..00000000000000 --- a/tools/doc/node_modules/marked/Gulpfile.js +++ /dev/null @@ -1,22 +0,0 @@ -var gulp = require('gulp'); -var uglify = require('gulp-uglify'); -var concat = require('gulp-concat'); - -var preserveFirstComment = function() { - var set = false; - - return function() { - if (set) return false; - set = true; - return true; - }; -}; - -gulp.task('uglify', function() { - gulp.src('lib/marked.js') - .pipe(uglify({preserveComments: preserveFirstComment()})) - .pipe(concat('marked.min.js')) - .pipe(gulp.dest('.')); -}); - -gulp.task('default', ['uglify']); diff --git a/tools/doc/node_modules/marked/LICENSE b/tools/doc/node_modules/marked/LICENSE deleted file mode 100644 index a7b812ed618f11..00000000000000 --- a/tools/doc/node_modules/marked/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/tools/doc/node_modules/marked/LICENSE.md b/tools/doc/node_modules/marked/LICENSE.md new file mode 100644 index 00000000000000..64b41a0e46378d --- /dev/null +++ b/tools/doc/node_modules/marked/LICENSE.md @@ -0,0 +1,43 @@ +# License information + +## Contribution License Agreement + +If you contribute code to this project, you are implicitly allowing your code +to be distributed under the MIT license. You are also implicitly verifying that +all code is your original work. `` + +## Marked + +Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +## Markdown + +Copyright © 2004, John Gruber +http://daringfireball.net/ +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 “Markdown” 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 copyright holders 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 copyright owner or 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/tools/doc/node_modules/marked/Makefile b/tools/doc/node_modules/marked/Makefile index d9349f07996d34..7deead54c1458a 100644 --- a/tools/doc/node_modules/marked/Makefile +++ b/tools/doc/node_modules/marked/Makefile @@ -9,4 +9,7 @@ clean: bench: @node test --bench +man/marked.1.txt: + groff -man -Tascii man/marked.1 | col -b > man/marked.1.txt + .PHONY: clean all diff --git a/tools/doc/node_modules/marked/README.md b/tools/doc/node_modules/marked/README.md index efa71aaaabc849..7d3af29378614c 100644 --- a/tools/doc/node_modules/marked/README.md +++ b/tools/doc/node_modules/marked/README.md @@ -1,45 +1,47 @@ -# marked + + + -> A full-featured markdown parser and compiler, written in JavaScript. Built -> for speed. +# Marked -[![NPM version](https://badge.fury.io/js/marked.png)][badge] +[![npm](https://img.shields.io/npm/v/marked.svg)](https://www.npmjs.com/package/marked) +[![gzip size](http://img.badgesize.io/https://cdn.jsdelivr.net/npm/marked@0.3.19/marked.min.js?compression=gzip)](https://cdn.jsdelivr.net/npm/marked@0.3.19/marked.min.js) +[![install size](https://packagephobia.now.sh/badge?p=marked@0.3.19)](https://packagephobia.now.sh/result?p=marked@0.3.19) +[![downloads](https://img.shields.io/npm/dt/marked.svg)](https://www.npmjs.com/package/marked) +[![travis](https://travis-ci.org/markedjs/marked.svg?branch=master)](https://travis-ci.org/markedjs/marked) -## Install +- ⚡ built for speed +- ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time +- ⚖️ light-weight while implementing all markdown features from the supported flavors & specifications +- 🌐 works in a browser, on a server, or from a command line interface (CLI) -``` bash -npm install marked --save -``` +## Demo -## Usage +Checkout the [demo page](https://marked.js.org/demo/) to see marked in action ⛹️ -Minimal usage: +## Docs -```js -var marked = require('marked'); -console.log(marked('I am using __markdown__.')); -// Outputs:

I am using markdown.

-``` +Our [documentation pages](https://marked.js.org) are also rendered using marked 💯 + +## Installation + +**CLI:** `npm install -g marked` -Example setting options with default values: +**In-browser:** `npm install marked --save` -```js -var marked = require('marked'); -marked.setOptions({ - renderer: new marked.Renderer(), - gfm: true, - tables: true, - breaks: false, - pedantic: false, - sanitize: true, - smartLists: true, - smartypants: false -}); +## Usage -console.log(marked('I am using __markdown__.')); +**CLI** + +``` bash +$ marked -o hello.html +hello world +^D +$ cat hello.html +

hello world

``` -### Browser +**Browser** ```html @@ -47,360 +49,19 @@ console.log(marked('I am using __markdown__.')); Marked in the browser -
+ ``` -## marked(markdownString [,options] [,callback]) - -### markdownString - -Type: `string` - -String of markdown source to be compiled. - -### options - -Type: `object` - -Hash of options. Can also be set using the `marked.setOptions` method as seen -above. - -### callback - -Type: `function` - -Function called when the `markdownString` has been fully parsed when using -async highlighting. If the `options` argument is omitted, this can be used as -the second argument. - -## Options - -### highlight - -Type: `function` - -A function to highlight code blocks. The first example below uses async highlighting with -[node-pygmentize-bundled][pygmentize], and the second is a synchronous example using -[highlight.js][highlight]: - -```js -var marked = require('marked'); - -var markdownString = '```js\n console.log("hello"); \n```'; - -// Async highlighting with pygmentize-bundled -marked.setOptions({ - highlight: function (code, lang, callback) { - require('pygmentize-bundled')({ lang: lang, format: 'html' }, code, function (err, result) { - callback(err, result.toString()); - }); - } -}); - -// Using async version of marked -marked(markdownString, function (err, content) { - if (err) throw err; - console.log(content); -}); - -// Synchronous highlighting with highlight.js -marked.setOptions({ - highlight: function (code) { - return require('highlight.js').highlightAuto(code).value; - } -}); - -console.log(marked(markdownString)); -``` - -#### highlight arguments - -`code` - -Type: `string` - -The section of code to pass to the highlighter. - -`lang` - -Type: `string` - -The programming language specified in the code block. - -`callback` - -Type: `function` - -The callback function to call when using an async highlighter. - -### renderer - -Type: `object` -Default: `new Renderer()` - -An object containing functions to render tokens to HTML. - -#### Overriding renderer methods - -The renderer option allows you to render tokens in a custom manner. Here is an -example of overriding the default heading token rendering by adding an embedded anchor tag like on GitHub: - -```javascript -var marked = require('marked'); -var renderer = new marked.Renderer(); - -renderer.heading = function (text, level) { - var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-'); - - return '' + - text + ''; -}, - -console.log(marked('# heading+', { renderer: renderer })); -``` -This code will output the following HTML: -```html -

- - - - heading+ -

-``` - -#### Block level renderer methods - -- code(*string* code, *string* language) -- blockquote(*string* quote) -- html(*string* html) -- heading(*string* text, *number* level) -- hr() -- list(*string* body, *boolean* ordered) -- listitem(*string* text) -- paragraph(*string* text) -- table(*string* header, *string* body) -- tablerow(*string* content) -- tablecell(*string* content, *object* flags) - -`flags` has the following properties: - -```js -{ - header: true || false, - align: 'center' || 'left' || 'right' -} -``` - -#### Inline level renderer methods - -- strong(*string* text) -- em(*string* text) -- codespan(*string* code) -- br() -- del(*string* text) -- link(*string* href, *string* title, *string* text) -- image(*string* href, *string* title, *string* text) - -### gfm - -Type: `boolean` -Default: `true` - -Enable [GitHub flavored markdown][gfm]. - -### tables - -Type: `boolean` -Default: `true` - -Enable GFM [tables][tables]. -This option requires the `gfm` option to be true. - -### breaks - -Type: `boolean` -Default: `false` - -Enable GFM [line breaks][breaks]. -This option requires the `gfm` option to be true. - -### pedantic - -Type: `boolean` -Default: `false` - -Conform to obscure parts of `markdown.pl` as much as possible. Don't fix any of -the original markdown bugs or poor behavior. - -### sanitize - -Type: `boolean` -Default: `false` - -Sanitize the output. Ignore any HTML that has been input. - -### smartLists - -Type: `boolean` -Default: `true` - -Use smarter list behavior than the original markdown. May eventually be -default with the old behavior moved into `pedantic`. - -### smartypants - -Type: `boolean` -Default: `false` - -Use "smart" typograhic punctuation for things like quotes and dashes. - -## Access to lexer and parser - -You also have direct access to the lexer and parser if you so desire. - -``` js -var tokens = marked.lexer(text, options); -console.log(marked.parser(tokens)); -``` - -``` js -var lexer = new marked.Lexer(options); -var tokens = lexer.lex(text); -console.log(tokens); -console.log(lexer.rules); -``` - -## CLI - -``` bash -$ marked -o hello.html -hello world -^D -$ cat hello.html -

hello world

-``` - -## Philosophy behind marked - -The point of marked was to create a markdown compiler where it was possible to -frequently parse huge chunks of markdown without having to worry about -caching the compiled output somehow...or blocking for an unnecesarily long time. - -marked is very concise and still implements all markdown features. It is also -now fully compatible with the client-side. - -marked more or less passes the official markdown test suite in its -entirety. This is important because a surprising number of markdown compilers -cannot pass more than a few tests. It was very difficult to get marked as -compliant as it is. It could have cut corners in several areas for the sake -of performance, but did not in order to be exactly what you expect in terms -of a markdown rendering. In fact, this is why marked could be considered at a -disadvantage in the benchmarks above. - -Along with implementing every markdown feature, marked also implements [GFM -features][gfmf]. - -## Benchmarks - -node v0.8.x - -``` bash -$ node test --bench -marked completed in 3411ms. -marked (gfm) completed in 3727ms. -marked (pedantic) completed in 3201ms. -robotskirt completed in 808ms. -showdown (reuse converter) completed in 11954ms. -showdown (new converter) completed in 17774ms. -markdown-js completed in 17191ms. -``` - -__Marked is now faster than Discount, which is written in C.__ - -For those feeling skeptical: These benchmarks run the entire markdown test suite 1000 times. The test suite tests every feature. It doesn't cater to specific aspects. - -### Pro level - -You also have direct access to the lexer and parser if you so desire. - -``` js -var tokens = marked.lexer(text, options); -console.log(marked.parser(tokens)); -``` - -``` js -var lexer = new marked.Lexer(options); -var tokens = lexer.lex(text); -console.log(tokens); -console.log(lexer.rules); -``` - -``` bash -$ node -> require('marked').lexer('> i am using marked.') -[ { type: 'blockquote_start' }, - { type: 'paragraph', - text: 'i am using marked.' }, - { type: 'blockquote_end' }, - links: {} ] -``` - -## Running Tests & Contributing - -If you want to submit a pull request, make sure your changes pass the test -suite. If you're adding a new feature, be sure to add your own test. - -The marked test suite is set up slightly strangely: `test/new` is for all tests -that are not part of the original markdown.pl test suite (this is where your -test should go if you make one). `test/original` is only for the original -markdown.pl tests. `test/tests` houses both types of tests after they have been -combined and moved/generated by running `node test --fix` or `marked --test ---fix`. - -In other words, if you have a test to add, add it to `test/new/` and then -regenerate the tests with `node test --fix`. Commit the result. If your test -uses a certain feature, for example, maybe it assumes GFM is *not* enabled, you -can add `.nogfm` to the filename. So, `my-test.text` becomes -`my-test.nogfm.text`. You can do this with any marked option. Say you want -line breaks and smartypants enabled, your filename should be: -`my-test.breaks.smartypants.text`. - -To run the tests: - -``` bash -cd marked/ -node test -``` - -### Contribution and License Agreement - -If you contribute code to this project, you are implicitly allowing your code -to be distributed under the MIT license. You are also implicitly verifying that -all code is your original work. `` - ## License -Copyright (c) 2011-2014, Christopher Jeffrey. (MIT License) - -See LICENSE for more info. +Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License) -[gfm]: https://help.github.com/articles/github-flavored-markdown -[gfmf]: http://github.github.com/github-flavored-markdown/ -[pygmentize]: https://github.com/rvagg/node-pygmentize-bundled -[highlight]: https://github.com/isagalaev/highlight.js -[badge]: http://badge.fury.io/js/marked -[tables]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#wiki-tables -[breaks]: https://help.github.com/articles/github-flavored-markdown#newlines diff --git a/tools/doc/node_modules/marked/bin/marked b/tools/doc/node_modules/marked/bin/marked index 64254fc3eb2e08..09e5594333129b 100755 --- a/tools/doc/node_modules/marked/bin/marked +++ b/tools/doc/node_modules/marked/bin/marked @@ -5,9 +5,9 @@ * Copyright (c) 2011-2013, Christopher Jeffrey (MIT License) */ -var fs = require('fs') - , util = require('util') - , marked = require('../'); +var fs = require('fs'), + path = require('path'), + marked = require('../'); /** * Man Page @@ -20,12 +20,16 @@ function help() { cwd: process.cwd(), env: process.env, setsid: false, - customFds: [0, 1, 2] + stdio: 'inherit' }; - spawn('man', - [__dirname + '/../man/marked.1'], - options); + spawn('man', [path.resolve(__dirname, '/../man/marked.1')], options) + .on('error', function() { + fs.readFile(path.resolve(__dirname, '/../man/marked.1.txt'), 'utf8', function(err, data) { + if (err) throw err; + console.log(data); + }); + }); } /** @@ -33,13 +37,14 @@ function help() { */ function main(argv, callback) { - var files = [] - , options = {} - , input - , output - , arg - , tokens - , opt; + var files = [], + options = {}, + input, + output, + string, + arg, + tokens, + opt; function getarg() { var arg = argv.shift(); @@ -82,6 +87,10 @@ function main(argv, callback) { case '--input': input = argv.shift(); break; + case '-s': + case '--string': + string = argv.shift(); + break; case '-t': case '--tokens': tokens = true; @@ -114,6 +123,9 @@ function main(argv, callback) { function getData(callback) { if (!input) { if (files.length <= 2) { + if (string) { + return callback(null, string); + } return getStdin(callback); } input = files.pop(); @@ -142,8 +154,8 @@ function main(argv, callback) { */ function getStdin(callback) { - var stdin = process.stdin - , buff = ''; + var stdin = process.stdin, + buff = ''; stdin.setEncoding('utf8'); diff --git a/tools/doc/node_modules/marked/bower.json b/tools/doc/node_modules/marked/bower.json deleted file mode 100644 index a2a8187759f7c9..00000000000000 --- a/tools/doc/node_modules/marked/bower.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "marked", - "version": "0.3.4", - "homepage": "https://github.com/chjj/marked", - "authors": [ - "Christopher Jeffrey " - ], - "description": "A markdown parser built for speed", - "keywords": [ - "markdown", - "markup", - "html" - ], - "main": "lib/marked.js", - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "app/bower_components", - "test", - "tests" - ] -} diff --git a/tools/doc/node_modules/marked/component.json b/tools/doc/node_modules/marked/component.json deleted file mode 100644 index 1d672877f6e712..00000000000000 --- a/tools/doc/node_modules/marked/component.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "marked", - "version": "0.3.4", - "repo": "chjj/marked", - "description": "A markdown parser built for speed", - "keywords": ["markdown", "markup", "html"], - "scripts": ["lib/marked.js"], - "main": "lib/marked.js", - "license": "MIT" -} diff --git a/tools/doc/node_modules/marked/doc/broken.md b/tools/doc/node_modules/marked/doc/broken.md deleted file mode 100644 index 7bfa49e8a9adf9..00000000000000 --- a/tools/doc/node_modules/marked/doc/broken.md +++ /dev/null @@ -1,426 +0,0 @@ -# Markdown is broken - -I have a lot of scraps of markdown engine oddities that I've collected over the -years. What you see below is slightly messy, but it's what I've managed to -cobble together to illustrate the differences between markdown engines, and -why, if there ever is a markdown specification, it has to be absolutely -thorough. There are a lot more of these little differences I have documented -elsewhere. I know I will find them lingering on my disk one day, but until -then, I'll continue to add whatever strange nonsensical things I find. - -Some of these examples may only mention a particular engine compared to marked. -However, the examples with markdown.pl could easily be swapped out for -discount, upskirt, or markdown.js, and you would very easily see even more -inconsistencies. - -A lot of this was written when I was very unsatisfied with the inconsistencies -between markdown engines. Please excuse the frustration noticeable in my -writing. - -## Examples of markdown's "stupid" list parsing - -``` -$ markdown.pl - - * item1 - - * item2 - - text -^D -
    -
  • item1

    - -
      -
    • item2
    • -
    - -

    text

  • -

-``` - - -``` -$ marked - * item1 - - * item2 - - text -^D -
    -
  • item1

    -
      -
    • item2
    • -
    -

    text

    -
  • -
-``` - -Which looks correct to you? - -- - - - -``` -$ markdown.pl -* hello - > world -^D -

    -
  • hello

    - -
    -

    world

  • -

- -``` - -``` -$ marked -* hello - > world -^D -
    -
  • hello
    -

    world

    -
    -
  • -
-``` - -Again, which looks correct to you? - -- - - - -EXAMPLE: - -``` -$ markdown.pl -* hello - * world - * hi - code -^D -
    -
  • hello -
      -
    • world
    • -
    • hi - code
    • -
  • -
-``` - -The code isn't a code block even though it's after the bullet margin. I know, -lets give it two more spaces, effectively making it 8 spaces past the bullet. - -``` -$ markdown.pl -* hello - * world - * hi - code -^D -
    -
  • hello -
      -
    • world
    • -
    • hi - code
    • -
  • -
-``` - -And, it's still not a code block. Did you also notice that the 3rd item isn't -even its own list? Markdown screws that up too because of its indentation -unaware parsing. - -- - - - -Let's look at some more examples of markdown's list parsing: - -``` -$ markdown.pl - - * item1 - - * item2 - - text -^D -
    -
  • item1

    - -
      -
    • item2
    • -
    - -

    text

  • -

-``` - -Misnested tags. - - -``` -$ marked - * item1 - - * item2 - - text -^D -
    -
  • item1

    -
      -
    • item2
    • -
    -

    text

    -
  • -
-``` - -Which looks correct to you? - -- - - - -``` -$ markdown.pl -* hello - > world -^D -

    -
  • hello

    - -
    -

    world

  • -

- -``` - -More misnested tags. - - -``` -$ marked -* hello - > world -^D -
    -
  • hello
    -

    world

    -
    -
  • -
-``` - -Again, which looks correct to you? - -- - - - -# Why quality matters - Part 2 - -``` bash -$ markdown.pl -* hello - > world -^D -

    -
  • hello

    - -
    -

    world

  • -

- -``` - -``` bash -$ sundown # upskirt -* hello - > world -^D -
    -
  • hello -> world
  • -
-``` - -``` bash -$ marked -* hello - > world -^D -
  • hello

    world

-``` - -Which looks correct to you? - -- - - - -See: https://github.com/evilstreak/markdown-js/issues/23 - -``` bash -$ markdown.pl # upskirt/markdown.js/discount -* hello - var a = 1; -* world -^D -
    -
  • hello -var a = 1;
  • -
  • world
  • -
-``` - -``` bash -$ marked -* hello - var a = 1; -* world -^D -
  • hello -
    code>var a = 1;
  • -
  • world
-``` - -Which looks more reasonable? Why shouldn't code blocks be able to appear in -list items in a sane way? - -- - - - -``` bash -$ markdown.js -
hello
- -hello -^D -

<div>hello</div>

- -

<span>hello</span>

-``` - -``` bash -$ marked -
hello
- -hello -^D -
hello
- - -

hello -

-``` - -- - - - -See: https://github.com/evilstreak/markdown-js/issues/27 - -``` bash -$ markdown.js -[![an image](/image)](/link) -^D -

![an image

-``` - -``` bash -$ marked -[![an image](/image)](/link) -^D -

an image -

-``` - -- - - - -See: https://github.com/evilstreak/markdown-js/issues/24 - -``` bash -$ markdown.js -> a - -> b - -> c -^D -

a

bundefined> c

-``` - -``` bash -$ marked -> a - -> b - -> c -^D -

a - -

-

b - -

-

c -

-``` - -- - - - -``` bash -$ markdown.pl -* hello - * world - how - - are - you - - * today -* hi -^D -
    -
  • hello

    - -
      -
    • world -how
    • -
    - -

    are -you

    - -
      -
    • today
    • -
  • -
  • hi
  • -
-``` - -``` bash -$ marked -* hello - * world - how - - are - you - - * today -* hi -^D -
    -
  • hello

    -
      -
    • world -how

      -

      are -you

      -
    • -
    • today

      -
    • -
    -
  • -
  • hi
  • -
-``` diff --git a/tools/doc/node_modules/marked/doc/todo.md b/tools/doc/node_modules/marked/doc/todo.md deleted file mode 100644 index 2e60b162aef82d..00000000000000 --- a/tools/doc/node_modules/marked/doc/todo.md +++ /dev/null @@ -1,2 +0,0 @@ -# Todo - diff --git a/tools/doc/node_modules/marked/jasmine.json b/tools/doc/node_modules/marked/jasmine.json new file mode 100644 index 00000000000000..8d1be919d17817 --- /dev/null +++ b/tools/doc/node_modules/marked/jasmine.json @@ -0,0 +1,11 @@ +{ + "spec_dir": "test", + "spec_files": [ + "**/*-spec.js" + ], + "helpers": [ + "helpers/**/*.js" + ], + "stopSpecOnExpectationFailure": false, + "random": true +} diff --git a/tools/doc/node_modules/marked/lib/marked.js b/tools/doc/node_modules/marked/lib/marked.js index 32521d993497ae..33c02d9cf41dd3 100644 --- a/tools/doc/node_modules/marked/lib/marked.js +++ b/tools/doc/node_modules/marked/lib/marked.js @@ -1,10 +1,11 @@ /** * marked - a markdown parser * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) - * https://github.com/chjj/marked + * https://github.com/markedjs/marked */ -;(function() { +;(function(root) { +'use strict'; /** * Block-Level Grammar @@ -14,55 +15,70 @@ var block = { newline: /^\n+/, code: /^( {4}[^\n]+\n*)+/, fences: noop, - hr: /^( *[-*_]){3,} *(?:\n+|$)/, - heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, + hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/, + heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/, nptable: noop, - lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, - blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/, + blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, - html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/, - def: /^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, + html: '^ {0,3}(?:' // optional indentation + + '<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)' // (1) + + '|comment[^\\n]*(\\n+|$)' // (2) + + '|<\\?[\\s\\S]*?\\?>\\n*' // (3) + + '|\\n*' // (4) + + '|\\n*' // (5) + + '|)[\\s\\S]*?(?:\\n{2,}|$)' // (6) + + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag + + '|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag + + ')', + def: /^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, table: noop, - paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/, + lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, + paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/, text: /^[^\n]+/ }; +block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/; +block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/; +block.def = edit(block.def) + .replace('label', block._label) + .replace('title', block._title) + .getRegex(); + block.bullet = /(?:[*+-]|\d+\.)/; block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; -block.item = replace(block.item, 'gm') - (/bull/g, block.bullet) - (); - -block.list = replace(block.list) - (/bull/g, block.bullet) - ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))') - ('def', '\\n+(?=' + block.def.source + ')') - (); - -block.blockquote = replace(block.blockquote) - ('def', block.def) - (); - -block._tag = '(?!(?:' - + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' - + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' - + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b'; - -block.html = replace(block.html) - ('comment', //) - ('closed', /<(tag)[\s\S]+?<\/\1>/) - ('closing', /])*?>/) - (/tag/g, block._tag) - (); - -block.paragraph = replace(block.paragraph) - ('hr', block.hr) - ('heading', block.heading) - ('lheading', block.lheading) - ('blockquote', block.blockquote) - ('tag', '<' + block._tag) - ('def', block.def) - (); +block.item = edit(block.item, 'gm') + .replace(/bull/g, block.bullet) + .getRegex(); + +block.list = edit(block.list) + .replace(/bull/g, block.bullet) + .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))') + .replace('def', '\\n+(?=' + block.def.source + ')') + .getRegex(); + +block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + + '|track|ul'; +block._comment = //; +block.html = edit(block.html, 'i') + .replace('comment', block._comment) + .replace('tag', block._tag) + .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/) + .getRegex(); + +block.paragraph = edit(block.paragraph) + .replace('hr', block.hr) + .replace('heading', block.heading) + .replace('lheading', block.lheading) + .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks + .getRegex(); + +block.blockquote = edit(block.blockquote) + .replace('paragraph', block.paragraph) + .getRegex(); /** * Normal Block Grammar @@ -75,24 +91,42 @@ block.normal = merge({}, block); */ block.gfm = merge({}, block.normal, { - fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/, + fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/, paragraph: /^/, heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ }); -block.gfm.paragraph = replace(block.paragraph) - ('(?!', '(?!' +block.gfm.paragraph = edit(block.paragraph) + .replace('(?!', '(?!' + block.gfm.fences.source.replace('\\1', '\\2') + '|' + block.list.source.replace('\\1', '\\3') + '|') - (); + .getRegex(); /** * GFM + Tables Block Grammar */ block.tables = merge({}, block.gfm, { - nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/, - table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ + nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/, + table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/ +}); + +/** + * Pedantic grammar + */ + +block.pedantic = merge({}, block.normal, { + html: edit( + '^ *(?:comment *(?:\\n|\\s*$)' + + '|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)' // closed tag + + '|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))') + .replace('comment', block._comment) + .replace(/tag/g, '(?!(?:' + + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b') + .getRegex(), + def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/ }); /** @@ -105,7 +139,9 @@ function Lexer(options) { this.options = options || marked.defaults; this.rules = block.normal; - if (this.options.gfm) { + if (this.options.pedantic) { + this.rules = block.pedantic; + } else if (this.options.gfm) { if (this.options.tables) { this.rules = block.tables; } else { @@ -147,17 +183,21 @@ Lexer.prototype.lex = function(src) { * Lexing */ -Lexer.prototype.token = function(src, top, bq) { - var src = src.replace(/^ +$/gm, '') - , next - , loose - , cap - , bull - , b - , item - , space - , i - , l; +Lexer.prototype.token = function(src, top) { + src = src.replace(/^ +$/gm, ''); + var next, + loose, + cap, + bull, + b, + item, + space, + i, + tag, + l, + isordered, + istask, + ischecked; while (src) { // newline @@ -207,45 +247,36 @@ Lexer.prototype.token = function(src, top, bq) { // table no leading pipe (gfm) if (top && (cap = this.rules.nptable.exec(src))) { - src = src.substring(cap[0].length); - item = { type: 'table', - header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), + header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')), align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/\n$/, '').split('\n') + cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [] }; - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; + if (item.header.length === item.align.length) { + src = src.substring(cap[0].length); + + for (i = 0; i < item.align.length; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = 'right'; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = 'center'; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = 'left'; + } else { + item.align[i] = null; + } } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = item.cells[i].split(/ *\| */); - } - this.tokens.push(item); + for (i = 0; i < item.cells.length; i++) { + item.cells[i] = splitCells(item.cells[i], item.header.length); + } - continue; - } + this.tokens.push(item); - // lheading - if (cap = this.rules.lheading.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'heading', - depth: cap[2] === '=' ? 1 : 2, - text: cap[1] - }); - continue; + continue; + } } // hr @@ -270,7 +301,7 @@ Lexer.prototype.token = function(src, top, bq) { // Pass `top` to keep the current // "toplevel" state. This is exactly // how markdown.pl works. - this.token(cap, top, true); + this.token(cap, top); this.tokens.push({ type: 'blockquote_end' @@ -283,10 +314,12 @@ Lexer.prototype.token = function(src, top, bq) { if (cap = this.rules.list.exec(src)) { src = src.substring(cap[0].length); bull = cap[2]; + isordered = bull.length > 1; this.tokens.push({ type: 'list_start', - ordered: bull.length > 1 + ordered: isordered, + start: isordered ? +bull : '' }); // Get each top-level item. @@ -332,14 +365,24 @@ Lexer.prototype.token = function(src, top, bq) { if (!loose) loose = next; } + // Check for task list items + istask = /^\[[ xX]\] /.test(item); + ischecked = undefined; + if (istask) { + ischecked = item[1] !== ' '; + item = item.replace(/^\[[ xX]\] +/, ''); + } + this.tokens.push({ type: loose ? 'loose_item_start' - : 'list_item_start' + : 'list_item_start', + task: istask, + checked: ischecked }); // Recurse. - this.token(item, false, bq); + this.token(item, false); this.tokens.push({ type: 'list_item_end' @@ -368,46 +411,63 @@ Lexer.prototype.token = function(src, top, bq) { } // def - if ((!bq && top) && (cap = this.rules.def.exec(src))) { + if (top && (cap = this.rules.def.exec(src))) { src = src.substring(cap[0].length); - this.tokens.links[cap[1].toLowerCase()] = { - href: cap[2], - title: cap[3] - }; + if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1); + tag = cap[1].toLowerCase().replace(/\s+/g, ' '); + if (!this.tokens.links[tag]) { + this.tokens.links[tag] = { + href: cap[2], + title: cap[3] + }; + } continue; } // table (gfm) if (top && (cap = this.rules.table.exec(src))) { - src = src.substring(cap[0].length); - item = { type: 'table', - header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), + header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')), align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') + cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : [] }; - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; + if (item.header.length === item.align.length) { + src = src.substring(cap[0].length); + + for (i = 0; i < item.align.length; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = 'right'; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = 'center'; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = 'left'; + } else { + item.align[i] = null; + } } - } - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = item.cells[i] - .replace(/^ *\| *| *\| *$/g, '') - .split(/ *\| */); - } + for (i = 0; i < item.cells.length; i++) { + item.cells[i] = splitCells( + item.cells[i].replace(/^ *\| *| *\| *$/g, ''), + item.header.length); + } - this.tokens.push(item); + this.tokens.push(item); + continue; + } + } + + // lheading + if (cap = this.rules.lheading.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'heading', + depth: cap[2] === '=' ? 1 : 2, + text: cap[1] + }); continue; } @@ -435,8 +495,7 @@ Lexer.prototype.token = function(src, top, bq) { } if (src) { - throw new - Error('Infinite loop on byte: ' + src.charCodeAt(0)); + throw new Error('Infinite loop on byte: ' + src.charCodeAt(0)); } } @@ -448,32 +507,55 @@ Lexer.prototype.token = function(src, top, bq) { */ var inline = { - escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, - autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, + escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, + autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, url: noop, - tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, - link: /^!?\[(inside)\]\(href\)/, - reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, - nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, - strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, - em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, - code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/, + tag: '^comment' + + '|^' // self-closing tag + + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag + + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. + + '|^' // declaration, e.g. + + '|^', // CDATA section + link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/, + reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/, + nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/, + strong: /^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)|^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)/, + em: /^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/, + code: /^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/, br: /^ {2,}\n(?!\s*$)/, del: noop, - text: /^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/; +inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g; -inline.link = replace(inline.link) - ('inside', inline._inside) - ('href', inline._href) - (); +inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; +inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; +inline.autolink = edit(inline.autolink) + .replace('scheme', inline._scheme) + .replace('email', inline._email) + .getRegex(); -inline.reflink = replace(inline.reflink) - ('inside', inline._inside) - (); +inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; + +inline.tag = edit(inline.tag) + .replace('comment', block._comment) + .replace('attribute', inline._attribute) + .getRegex(); + +inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/; +inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f()\\]*\)|[^\s\x00-\x1f()\\])*?)/; +inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; + +inline.link = edit(inline.link) + .replace('label', inline._label) + .replace('href', inline._href) + .replace('title', inline._title) + .getRegex(); + +inline.reflink = edit(inline.reflink) + .replace('label', inline._label) + .getRegex(); /** * Normal Inline Grammar @@ -487,7 +569,13 @@ inline.normal = merge({}, inline); inline.pedantic = merge({}, inline.normal, { strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, - em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ + em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/, + link: edit(/^!?\[(label)\]\((.*?)\)/) + .replace('label', inline._label) + .getRegex(), + reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/) + .replace('label', inline._label) + .getRegex() }); /** @@ -495,13 +583,16 @@ inline.pedantic = merge({}, inline.normal, { */ inline.gfm = merge({}, inline.normal, { - escape: replace(inline.escape)('])', '~|])')(), - url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, + escape: edit(inline.escape).replace('])', '~|])').getRegex(), + url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/) + .replace('email', inline._email) + .getRegex(), + _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/, del: /^~~(?=\S)([\s\S]*?\S)~~/, - text: replace(inline.text) - (']|', '~]|') - ('|', '|https?://|') - () + text: edit(inline.text) + .replace(']|', '~]|') + .replace('|', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|') + .getRegex() }); /** @@ -509,8 +600,8 @@ inline.gfm = merge({}, inline.normal, { */ inline.breaks = merge({}, inline.gfm, { - br: replace(inline.br)('{2,}', '*')(), - text: replace(inline.gfm.text)('{2,}', '*')() + br: edit(inline.br).replace('{2,}', '*').getRegex(), + text: edit(inline.gfm.text).replace('{2,}', '*').getRegex() }); /** @@ -521,22 +612,21 @@ function InlineLexer(links, options) { this.options = options || marked.defaults; this.links = links; this.rules = inline.normal; - this.renderer = this.options.renderer || new Renderer; + this.renderer = this.options.renderer || new Renderer(); this.renderer.options = this.options; if (!this.links) { - throw new - Error('Tokens array requires a `links` property.'); + throw new Error('Tokens array requires a `links` property.'); } - if (this.options.gfm) { + if (this.options.pedantic) { + this.rules = inline.pedantic; + } else if (this.options.gfm) { if (this.options.breaks) { this.rules = inline.breaks; } else { this.rules = inline.gfm; } - } else if (this.options.pedantic) { - this.rules = inline.pedantic; } } @@ -560,11 +650,12 @@ InlineLexer.output = function(src, links, options) { */ InlineLexer.prototype.output = function(src) { - var out = '' - , link - , text - , href - , cap; + var out = '', + link, + text, + href, + title, + cap; while (src) { // escape @@ -578,10 +669,8 @@ InlineLexer.prototype.output = function(src) { if (cap = this.rules.autolink.exec(src)) { src = src.substring(cap[0].length); if (cap[2] === '@') { - text = cap[1].charAt(6) === ':' - ? this.mangle(cap[1].substring(7)) - : this.mangle(cap[1]); - href = this.mangle('mailto:') + text; + text = escape(this.mangle(cap[1])); + href = 'mailto:' + text; } else { text = escape(cap[1]); href = text; @@ -592,9 +681,19 @@ InlineLexer.prototype.output = function(src) { // url (gfm) if (!this.inLink && (cap = this.rules.url.exec(src))) { + cap[0] = this.rules._backpedal.exec(cap[0])[0]; src = src.substring(cap[0].length); - text = escape(cap[1]); - href = text; + if (cap[2] === '@') { + text = escape(cap[0]); + href = 'mailto:' + text; + } else { + text = escape(cap[0]); + if (cap[1] === 'www.') { + href = 'http://' + text; + } else { + href = text; + } + } out += this.renderer.link(href, null, text); continue; } @@ -619,9 +718,23 @@ InlineLexer.prototype.output = function(src) { if (cap = this.rules.link.exec(src)) { src = src.substring(cap[0].length); this.inLink = true; + href = cap[2]; + if (this.options.pedantic) { + link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); + + if (link) { + href = link[1]; + title = link[3]; + } else { + title = ''; + } + } else { + title = cap[3] ? cap[3].slice(1, -1) : ''; + } + href = href.trim().replace(/^<([\s\S]*)>$/, '$1'); out += this.outputLink(cap, { - href: cap[2], - title: cap[3] + href: InlineLexer.escapes(href), + title: InlineLexer.escapes(title) }); this.inLink = false; continue; @@ -647,21 +760,21 @@ InlineLexer.prototype.output = function(src) { // strong if (cap = this.rules.strong.exec(src)) { src = src.substring(cap[0].length); - out += this.renderer.strong(this.output(cap[2] || cap[1])); + out += this.renderer.strong(this.output(cap[4] || cap[3] || cap[2] || cap[1])); continue; } // em if (cap = this.rules.em.exec(src)) { src = src.substring(cap[0].length); - out += this.renderer.em(this.output(cap[2] || cap[1])); + out += this.renderer.em(this.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1])); continue; } // code if (cap = this.rules.code.exec(src)) { src = src.substring(cap[0].length); - out += this.renderer.codespan(escape(cap[2], true)); + out += this.renderer.codespan(escape(cap[2].trim(), true)); continue; } @@ -687,21 +800,24 @@ InlineLexer.prototype.output = function(src) { } if (src) { - throw new - Error('Infinite loop on byte: ' + src.charCodeAt(0)); + throw new Error('Infinite loop on byte: ' + src.charCodeAt(0)); } } return out; }; +InlineLexer.escapes = function(text) { + return text ? text.replace(InlineLexer.rules._escapes, '$1') : text; +} + /** * Compile Link */ InlineLexer.prototype.outputLink = function(cap, link) { - var href = escape(link.href) - , title = link.title ? escape(link.title) : null; + var href = link.href, + title = link.title ? escape(link.title) : null; return cap[0].charAt(0) !== '!' ? this.renderer.link(href, title, this.output(cap[1])) @@ -737,10 +853,10 @@ InlineLexer.prototype.smartypants = function(text) { InlineLexer.prototype.mangle = function(text) { if (!this.options.mangle) return text; - var out = '' - , l = text.length - , i = 0 - , ch; + var out = '', + l = text.length, + i = 0, + ch; for (; i < l; i++) { ch = text.charCodeAt(i); @@ -758,7 +874,7 @@ InlineLexer.prototype.mangle = function(text) { */ function Renderer(options) { - this.options = options || {}; + this.options = options || marked.defaults; } Renderer.prototype.code = function(code, lang, escaped) { @@ -773,7 +889,7 @@ Renderer.prototype.code = function(code, lang, escaped) { if (!lang) { return '
'
       + (escaped ? code : escape(code, true))
-      + '\n
'; + + ''; } return '
'
     + (escaped ? code : escape(code, true))
-    + '\n
\n'; + + '\n'; }; Renderer.prototype.blockquote = function(quote) { @@ -793,43 +909,56 @@ Renderer.prototype.html = function(html) { }; Renderer.prototype.heading = function(text, level, raw) { - return '' - + text - + '\n'; + if (this.options.headerIds) { + return '' + + text + + '\n'; + } + // ignore IDs + return '' + text + '\n'; }; Renderer.prototype.hr = function() { return this.options.xhtml ? '
\n' : '
\n'; }; -Renderer.prototype.list = function(body, ordered) { - var type = ordered ? 'ol' : 'ul'; - return '<' + type + '>\n' + body + '\n'; +Renderer.prototype.list = function(body, ordered, start) { + var type = ordered ? 'ol' : 'ul', + startatt = (ordered && start !== 1) ? (' start="' + start + '"') : ''; + return '<' + type + startatt + '>\n' + body + '\n'; }; Renderer.prototype.listitem = function(text) { return '
  • ' + text + '
  • \n'; }; +Renderer.prototype.checkbox = function(checked) { + return ' '; +} + Renderer.prototype.paragraph = function(text) { return '

    ' + text + '

    \n'; }; Renderer.prototype.table = function(header, body) { + if (body) body = '
    ' + body + ''; + return '
    \n' + '\n' + header + '\n' - + '\n' + body - + '\n' + '
    \n'; }; @@ -840,7 +969,7 @@ Renderer.prototype.tablerow = function(content) { Renderer.prototype.tablecell = function(content, flags) { var type = flags.header ? 'th' : 'td'; var tag = flags.align - ? '<' + type + ' style="text-align:' + flags.align + '">' + ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>'; return tag + content + '\n'; }; @@ -873,13 +1002,21 @@ Renderer.prototype.link = function(href, title, text) { .replace(/[^\w:]/g, '') .toLowerCase(); } catch (e) { - return ''; + return text; } - if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) { - return ''; + if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) { + return text; } } - var out = ' count) { + cells.splice(count); + } else { + while (cells.length < count) cells.push(''); + } + + for (; i < cells.length; i++) { + cells[i] = cells[i].replace(/\\\|/g, '|'); + } + return cells; +} /** * Marked */ function marked(src, opt, callback) { + // throw error in case of non string input + if (typeof src === 'undefined' || src === null) { + throw new Error('marked(): input parameter is undefined or null'); + } + if (typeof src !== 'string') { + throw new Error('marked(): input parameter is of type ' + + Object.prototype.toString.call(src) + ', string expected'); + } + if (callback || typeof opt === 'function') { if (!callback) { callback = opt; @@ -1153,10 +1377,10 @@ function marked(src, opt, callback) { opt = merge({}, marked.defaults, opt || {}); - var highlight = opt.highlight - , tokens - , pending - , i = 0; + var highlight = opt.highlight, + tokens, + pending, + i = 0; try { tokens = Lexer.lex(src, opt) @@ -1218,9 +1442,9 @@ function marked(src, opt, callback) { if (opt) opt = merge({}, marked.defaults, opt); return Parser.parse(Lexer.lex(src, opt), opt); } catch (e) { - e.message += '\nPlease report this to https://github.com/chjj/marked.'; + e.message += '\nPlease report this to https://github.com/markedjs/marked.'; if ((opt || marked.defaults).silent) { - return '

    An error occured:

    '
    +      return '

    An error occurred:

    '
             + escape(e.message + '', true)
             + '
    '; } @@ -1238,23 +1462,29 @@ marked.setOptions = function(opt) { return marked; }; -marked.defaults = { - gfm: true, - tables: true, - breaks: false, - pedantic: false, - sanitize: false, - sanitizer: null, - mangle: true, - smartLists: false, - silent: false, - highlight: null, - langPrefix: 'lang-', - smartypants: false, - headerPrefix: '', - renderer: new Renderer, - xhtml: false -}; +marked.getDefaults = function () { + return { + baseUrl: null, + breaks: false, + gfm: true, + headerIds: true, + headerPrefix: '', + highlight: null, + langPrefix: 'language-', + mangle: true, + pedantic: false, + renderer: new Renderer(), + sanitize: false, + sanitizer: null, + silent: false, + smartLists: false, + smartypants: false, + tables: true, + xhtml: false + }; +} + +marked.defaults = marked.getDefaults(); /** * Expose @@ -1264,6 +1494,7 @@ marked.Parser = Parser; marked.parser = Parser.parse; marked.Renderer = Renderer; +marked.TextRenderer = TextRenderer; marked.Lexer = Lexer; marked.lexer = Lexer.lex; @@ -1278,9 +1509,6 @@ if (typeof module !== 'undefined' && typeof exports === 'object') { } else if (typeof define === 'function' && define.amd) { define(function() { return marked; }); } else { - this.marked = marked; + root.marked = marked; } - -}).call(function() { - return this || (typeof window !== 'undefined' ? window : global); -}()); +})(this || (typeof window !== 'undefined' ? window : global)); diff --git a/tools/doc/node_modules/marked/man/marked.1 b/tools/doc/node_modules/marked/man/marked.1 index b9bdc8c2123e3b..a8e41b50311483 100644 --- a/tools/doc/node_modules/marked/man/marked.1 +++ b/tools/doc/node_modules/marked/man/marked.1 @@ -23,7 +23,7 @@ cat in.md | marked > out.html .TP echo "hello *world*" | marked .TP -marked \-o out.html in.md \-\-gfm +marked \-o out.html \-i in.md \-\-gfm .TP marked \-\-output="hello world.html" \-i in.md \-\-no-breaks @@ -81,7 +81,7 @@ For configuring and running programmatically. require('marked')('*foo*', { gfm: true }); .SH BUGS -Please report any bugs to https://github.com/chjj/marked. +Please report any bugs to https://github.com/markedjs/marked. .SH LICENSE Copyright (c) 2011-2014, Christopher Jeffrey (MIT License). diff --git a/tools/doc/node_modules/marked/man/marked.1.txt b/tools/doc/node_modules/marked/man/marked.1.txt new file mode 100644 index 00000000000000..fd9b37ef334f3d --- /dev/null +++ b/tools/doc/node_modules/marked/man/marked.1.txt @@ -0,0 +1,96 @@ +marked(1) marked.js marked(1) + + + +NAME + marked - a javascript markdown parser + + +SYNOPSIS + marked [-o ] [-i ] [--help] [--tokens] [--pedantic] + [--gfm] [--breaks] [--tables] [--sanitize] [--smart-lists] [--lang-pre‐ + fix ] [--no-etc...] [--silent] [filename] + + +DESCRIPTION + marked is a full-featured javascript markdown parser, built for speed. + It also includes multiple GFM features. + + +EXAMPLES + cat in.md | marked > out.html + + echo "hello *world*" | marked + + marked -o out.html -i in.md --gfm + + marked --output="hello world.html" -i in.md --no-breaks + + +OPTIONS + -o, --output [output] + Specify file output. If none is specified, write to stdout. + + -i, --input [input] + Specify file input, otherwise use last argument as input file. + If no input file is specified, read from stdin. + + -t, --tokens + Output a token stream instead of html. + + --pedantic + Conform to obscure parts of markdown.pl as much as possible. + Don't fix original markdown bugs. + + --gfm Enable github flavored markdown. + + --breaks + Enable GFM line breaks. Only works with the gfm option. + + --tables + Enable GFM tables. Only works with the gfm option. + + --sanitize + Sanitize output. Ignore any HTML input. + + --smart-lists + Use smarter list behavior than the original markdown. + + --lang-prefix [prefix] + Set the prefix for code block classes. + + --mangle + Mangle email addresses. + + --no-sanitize, -no-etc... + The inverse of any of the marked options above. + + --silent + Silence error output. + + -h, --help + Display help information. + + +CONFIGURATION + For configuring and running programmatically. + + Example + + require('marked')('*foo*', { gfm: true }); + + +BUGS + Please report any bugs to https://github.com/chjj/marked. + + +LICENSE + Copyright (c) 2011-2014, Christopher Jeffrey (MIT License). + + +SEE ALSO + markdown(1), node.js(1) + + + +v0.3.1 2014-01-31 marked(1) diff --git a/tools/doc/node_modules/marked/marked.min.js b/tools/doc/node_modules/marked/marked.min.js index 555c1dc1d9da18..d6e5f23790aff1 100644 --- a/tools/doc/node_modules/marked/marked.min.js +++ b/tools/doc/node_modules/marked/marked.min.js @@ -1,6 +1,6 @@ /** * marked - a markdown parser * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) - * https://github.com/chjj/marked + * https://github.com/markedjs/marked */ -(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]||""});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&(cap[1]==="pre"||cap[1]==="script"||cap[1]==="style"),text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^
    /i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(cap[0]):escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.text(escape(this.smartypants(cap[0])));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){if(!this.options.mangle)return text;var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
    "+(escaped?code:escape(code,true))+"\n
    "}return'
    '+(escaped?code:escape(code,true))+"\n
    \n"};Renderer.prototype.blockquote=function(quote){return"
    \n"+quote+"
    \n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0||prot.indexOf("vbscript:")===0){return""}}var out='
    ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};Renderer.prototype.text=function(text){return text};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,sanitizer:null,mangle:true,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file +!function(e){"use strict";var t={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:d,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:d,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:d,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function n(e){this.tokens=[],this.tokens.links={},this.options=e||m.defaults,this.rules=t.normal,this.options.pedantic?this.rules=t.pedantic:this.options.gfm&&(this.options.tables?this.rules=t.tables:this.rules=t.gfm)}t._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,t._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,t.def=p(t.def).replace("label",t._label).replace("title",t._title).getRegex(),t.bullet=/(?:[*+-]|\d+\.)/,t.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,t.item=p(t.item,"gm").replace(/bull/g,t.bullet).getRegex(),t.list=p(t.list).replace(/bull/g,t.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+t.def.source+")").getRegex(),t._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",t._comment=//,t.html=p(t.html,"i").replace("comment",t._comment).replace("tag",t._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),t.paragraph=p(t.paragraph).replace("hr",t.hr).replace("heading",t.heading).replace("lheading",t.lheading).replace("tag",t._tag).getRegex(),t.blockquote=p(t.blockquote).replace("paragraph",t.paragraph).getRegex(),t.normal=f({},t),t.gfm=f({},t.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),t.gfm.paragraph=p(t.paragraph).replace("(?!","(?!"+t.gfm.fences.source.replace("\\1","\\2")+"|"+t.list.source.replace("\\1","\\3")+"|").getRegex(),t.tables=f({},t.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),t.pedantic=f({},t.normal,{html:p("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",t._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),n.rules=t,n.lex=function(e,t){return new n(t).lex(e)},n.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},n.prototype.token=function(e,n){var r,s,i,l,o,a,h,p,u,c,g,d,f;for(e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(n&&(i=this.rules.nptable.exec(e))&&(a={type:"table",header:b(i[1].replace(/^ *| *\| *$/g,"")),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/\n$/,"").split("\n"):[]}).header.length===a.align.length){for(e=e.substring(i[0].length),p=0;p ?/gm,""),this.token(i,n),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),g=(l=i[2]).length>1,this.tokens.push({type:"list_start",ordered:g,start:g?+l:""}),r=!1,c=(i=i[0].match(this.rules.item)).length,p=0;p1&&o.length>1||(e=i.slice(p+1).join("\n")+e,p=c-1)),s=r||/\n\n(?!\s*$)/.test(a),p!==c-1&&(r="\n"===a.charAt(a.length-1),s||(s=r)),f=void 0,(d=/^\[[ xX]\] /.test(a))&&(f=" "!==a[1],a=a.replace(/^\[[ xX]\] +/,"")),this.tokens.push({type:s?"loose_item_start":"list_item_start",task:d,checked:f}),this.token(a,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(n&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),i[3]&&(i[3]=i[3].substring(1,i[3].length-1)),u=i[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[u]||(this.tokens.links[u]={href:i[2],title:i[3]});else if(n&&(i=this.rules.table.exec(e))&&(a={type:"table",header:b(i[1].replace(/^ *| *\| *$/g,"")),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/(?: *\| *)?\n$/,"").split("\n"):[]}).header.length===a.align.length){for(e=e.substring(i[0].length),p=0;p?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:d,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)|^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)/,em:/^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:d,text:/^[\s\S]+?(?=[\\/g,">").replace(/"/g,""").replace(/'/g,"'")}function h(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function p(e,t){return e=e.source||e,t=t||"",{replace:function(t,n){return n=(n=n.source||n).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(t,n),this},getRegex:function(){return new RegExp(e,t)}}}function u(e,t){return c[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?c[" "+e]=e+"/":c[" "+e]=e.replace(/[^/]*$/,"")),e=c[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}r._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,r._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,r._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,r.autolink=p(r.autolink).replace("scheme",r._scheme).replace("email",r._email).getRegex(),r._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,r.tag=p(r.tag).replace("comment",t._comment).replace("attribute",r._attribute).getRegex(),r._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/,r._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f()\\]*\)|[^\s\x00-\x1f()\\])*?)/,r._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,r.link=p(r.link).replace("label",r._label).replace("href",r._href).replace("title",r._title).getRegex(),r.reflink=p(r.reflink).replace("label",r._label).getRegex(),r.normal=f({},r),r.pedantic=f({},r.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",r._label).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",r._label).getRegex()}),r.gfm=f({},r.normal,{escape:p(r.escape).replace("])","~|])").getRegex(),url:p(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("email",r._email).getRegex(),_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:p(r.text).replace("]|","~]|").replace("|","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|").getRegex()}),r.breaks=f({},r.gfm,{br:p(r.br).replace("{2,}","*").getRegex(),text:p(r.gfm.text).replace("{2,}","*").getRegex()}),s.rules=r,s.output=function(e,t,n){return new s(t,n).output(e)},s.prototype.output=function(e){for(var t,n,r,i,l,o="";e;)if(l=this.rules.escape.exec(e))e=e.substring(l[0].length),o+=l[1];else if(l=this.rules.autolink.exec(e))e=e.substring(l[0].length),r="@"===l[2]?"mailto:"+(n=a(this.mangle(l[1]))):n=a(l[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(l=this.rules.url.exec(e))){if(l=this.rules.tag.exec(e))!this.inLink&&/^
    /i.test(l[0])&&(this.inLink=!1),e=e.substring(l[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):a(l[0]):l[0];else if(l=this.rules.link.exec(e))e=e.substring(l[0].length),this.inLink=!0,r=l[2],this.options.pedantic?(t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r))?(r=t[1],i=t[3]):i="":i=l[3]?l[3].slice(1,-1):"",r=r.trim().replace(/^<([\s\S]*)>$/,"$1"),o+=this.outputLink(l,{href:s.escapes(r),title:s.escapes(i)}),this.inLink=!1;else if((l=this.rules.reflink.exec(e))||(l=this.rules.nolink.exec(e))){if(e=e.substring(l[0].length),t=(l[2]||l[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=l[0].charAt(0),e=l[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(l,t),this.inLink=!1}else if(l=this.rules.strong.exec(e))e=e.substring(l[0].length),o+=this.renderer.strong(this.output(l[4]||l[3]||l[2]||l[1]));else if(l=this.rules.em.exec(e))e=e.substring(l[0].length),o+=this.renderer.em(this.output(l[6]||l[5]||l[4]||l[3]||l[2]||l[1]));else if(l=this.rules.code.exec(e))e=e.substring(l[0].length),o+=this.renderer.codespan(a(l[2].trim(),!0));else if(l=this.rules.br.exec(e))e=e.substring(l[0].length),o+=this.renderer.br();else if(l=this.rules.del.exec(e))e=e.substring(l[0].length),o+=this.renderer.del(this.output(l[1]));else if(l=this.rules.text.exec(e))e=e.substring(l[0].length),o+=this.renderer.text(a(this.smartypants(l[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else l[0]=this.rules._backpedal.exec(l[0])[0],e=e.substring(l[0].length),"@"===l[2]?r="mailto:"+(n=a(l[0])):(n=a(l[0]),r="www."===l[1]?"http://"+n:n),o+=this.renderer.link(r,null,n);return o},s.escapes=function(e){return e?e.replace(s.rules._escapes,"$1"):e},s.prototype.outputLink=function(e,t){var n=t.href,r=t.title?a(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,a(e[1]))},s.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},s.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},i.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
    '+(n?e:a(e,!0))+"
    \n":"
    "+(n?e:a(e,!0))+"
    "},i.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},i.prototype.html=function(e){return e},i.prototype.heading=function(e,t,n){return this.options.headerIds?"'+e+"\n":""+e+"\n"},i.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},i.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},i.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},i.prototype.checkbox=function(e){return" "},i.prototype.paragraph=function(e){return"

    "+e+"

    \n"},i.prototype.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},i.prototype.tablerow=function(e){return"\n"+e+"\n"},i.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},i.prototype.strong=function(e){return""+e+""},i.prototype.em=function(e){return""+e+""},i.prototype.codespan=function(e){return""+e+""},i.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},i.prototype.del=function(e){return""+e+""},i.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(h(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return n}var s='
    "},i.prototype.image=function(e,t,n){this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));var r=''+n+'":">"},i.prototype.text=function(e){return e},l.prototype.strong=l.prototype.em=l.prototype.codespan=l.prototype.del=l.prototype.text=function(e){return e},l.prototype.link=l.prototype.image=function(e,t,n){return""+n},l.prototype.br=function(){return""},o.parse=function(e,t){return new o(t).parse(e)},o.prototype.parse=function(e){this.inline=new s(e.links,this.options),this.inlineText=new s(e.links,f({},this.options,{renderer:new l})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,h(this.inlineText.output(this.token.text)));case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;et)n.splice(t);else for(;n.lengthAn error occurred:

    "+a(e.message+"",!0)+"
    ";throw e}}d.exec=d,m.options=m.setOptions=function(e){return f(m.defaults,e),m},m.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new i,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},m.defaults=m.getDefaults(),m.Parser=o,m.parser=o.parse,m.Renderer=i,m.TextRenderer=l,m.Lexer=n,m.lexer=n.lex,m.InlineLexer=s,m.inlineLexer=s.output,m.parse=m,"undefined"!=typeof module&&"object"==typeof exports?module.exports=m:"function"==typeof define&&define.amd?define(function(){return m}):e.marked=m}(this||("undefined"!=typeof window?window:global)); \ No newline at end of file diff --git a/tools/doc/node_modules/marked/package.json b/tools/doc/node_modules/marked/package.json index 81ab0639d2b1dc..0cf4dbe958c6f1 100644 --- a/tools/doc/node_modules/marked/package.json +++ b/tools/doc/node_modules/marked/package.json @@ -1,27 +1,28 @@ { - "_from": "marked@^0.3.5", - "_id": "marked@0.3.6", + "_from": "marked@0.4.0", + "_id": "marked@0.4.0", "_inBundle": false, - "_integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc=", + "_integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==", "_location": "/marked", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "marked@^0.3.5", + "raw": "marked@0.4.0", "name": "marked", "escapedName": "marked", - "rawSpec": "^0.3.5", + "rawSpec": "0.4.0", "saveSpec": null, - "fetchSpec": "^0.3.5" + "fetchSpec": "0.4.0" }, "_requiredBy": [ + "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz", - "_shasum": "b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7", - "_spec": "marked@^0.3.5", - "_where": "/mnt/d/code/node-github-desktop/tools/doc", + "_resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz", + "_shasum": "9ad2c2a7a1791f10a852e0112f77b571dce10c66", + "_spec": "marked@0.4.0", + "_where": "/Users/trott/io.js/tools/doc", "author": { "name": "Christopher Jeffrey" }, @@ -29,19 +30,33 @@ "marked": "./bin/marked" }, "bugs": { - "url": "http://github.com/chjj/marked/issues" + "url": "http://github.com/markedjs/marked/issues" }, "bundleDependencies": false, "deprecated": false, "description": "A markdown parser built for speed", "devDependencies": { - "gulp": "^3.8.11", - "gulp-concat": "^2.5.2", - "gulp-uglify": "^1.1.0", + "eslint": "^4.15.0", + "eslint-config-standard": "^11.0.0-beta.0", + "eslint-plugin-import": "^2.8.0", + "eslint-plugin-node": "^5.2.1", + "eslint-plugin-promise": "^3.6.0", + "eslint-plugin-standard": "^3.0.1", + "eslint-plugin-vuln-regex-detector": "^1.0.4", + "front-matter": "^2.3.0", + "glob-to-regexp": "0.3.0", + "html-differ": "^1.3.4", + "jasmine": "^3.1.0", + "jasmine2-custom-message": "^0.9.0", "markdown": "*", - "showdown": "*" + "markdown-it": "*", + "showdown": "*", + "uglify-js": "^3.3.10" }, - "homepage": "https://github.com/chjj/marked", + "engines": { + "node": ">=0.10.0" + }, + "homepage": "https://marked.js.org", "keywords": [ "markdown", "markup", @@ -53,19 +68,29 @@ "./man/marked.1" ], "name": "marked", - "preferGlobal": true, "repository": { "type": "git", - "url": "git://github.com/chjj/marked.git" + "url": "git://github.com/markedjs/marked.git" }, "scripts": { "bench": "node test --bench", - "test": "node test" + "build": "uglifyjs lib/marked.js -cm --comments /Copyright/ -o marked.min.js", + "lint": "eslint --fix bin/marked .", + "preversion": "npm run build && (git diff --quiet || git commit -am 'minify')", + "test": "jasmine --config=jasmine.json", + "test:cm": "npm test -- test/specs/commonmark/**/*-spec.js", + "test:gfm": "npm test -- test/specs/gfm/**/*-spec.js", + "test:lint": "eslint bin/marked .", + "test:marked": "npm test -- test/specs/marked/**/*-spec.js", + "test:old": "node test", + "test:redos": "eslint --plugin vuln-regex-detector --rule '\"vuln-regex-detector/no-vuln-regex\": 2' lib/marked.js", + "test:specs": "npm test -- test/specs/**/*-spec.js", + "test:unit": "npm test -- test/unit/**/*-spec.js" }, "tags": [ "markdown", "markup", "html" ], - "version": "0.3.6" + "version": "0.4.0" } diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json index 5da2020a1a3a4a..0d8be65dc902cb 100644 --- a/tools/doc/package-lock.json +++ b/tools/doc/package-lock.json @@ -30,9 +30,9 @@ } }, "marked": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz", - "integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc=" + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz", + "integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==" }, "sprintf-js": { "version": "1.0.3", diff --git a/tools/doc/package.json b/tools/doc/package.json index d33943eacddbbd..b265abd30155c4 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -7,7 +7,7 @@ "node": ">=6" }, "dependencies": { - "marked": "^0.3.5" + "marked": "^0.4.0" }, "devDependencies": { "js-yaml": "^3.5.2" diff --git a/tools/license-builder.sh b/tools/license-builder.sh index 672e7c4f4cd5f5..64d15c659e185b 100755 --- a/tools/license-builder.sh +++ b/tools/license-builder.sh @@ -72,7 +72,7 @@ addlicense "npm" "deps/npm" "$(cat ${rootdir}/deps/npm/LICENSE)" # Build tools addlicense "GYP" "tools/gyp" "$(cat ${rootdir}/tools/gyp/LICENSE)" addlicense "marked" "tools/doc/node_modules/marked" \ - "$(cat ${rootdir}/tools/doc/node_modules/marked/LICENSE)" + "$(cat ${rootdir}/tools/doc/node_modules/marked/LICENSE.md)" # Testing tools addlicense "cpplint.py" "tools/cpplint.py" \ From 52ac8c9ff09af0a5192a57814ac08b2900070fc2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 22 Jun 2018 14:27:54 -0700 Subject: [PATCH 5/7] tools: float punctuation patch on marked-0.4.0 Float a patch to deal with punctuation at the end of URLs in a more robust fashion. Refs: https://github.com/markedjs/marked/pull/1293 --- tools/doc/node_modules/marked/lib/marked.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/doc/node_modules/marked/lib/marked.js b/tools/doc/node_modules/marked/lib/marked.js index 33c02d9cf41dd3..6056bef6b39de5 100644 --- a/tools/doc/node_modules/marked/lib/marked.js +++ b/tools/doc/node_modules/marked/lib/marked.js @@ -655,7 +655,8 @@ InlineLexer.prototype.output = function(src) { text, href, title, - cap; + cap, + prevCapZero; while (src) { // escape @@ -681,7 +682,10 @@ InlineLexer.prototype.output = function(src) { // url (gfm) if (!this.inLink && (cap = this.rules.url.exec(src))) { - cap[0] = this.rules._backpedal.exec(cap[0])[0]; + do { + prevCapZero = cap[0]; + cap[0] = this.rules._backpedal.exec(cap[0])[0]; + } while (prevCapZero !== cap[0]); src = src.substring(cap[0].length); if (cap[2] === '@') { text = escape(cap[0]); From ece7854a3907f564e89aa0b8894e04e8f3f22571 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 22 Jun 2018 21:24:16 -0700 Subject: [PATCH 6/7] tools: float empty cell patch on marked-0.4.0 Float a patch to deal with empty table cells. Refs: https://github.com/markedjs/marked/pull/1262 --- tools/doc/node_modules/marked/lib/marked.js | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tools/doc/node_modules/marked/lib/marked.js b/tools/doc/node_modules/marked/lib/marked.js index 6056bef6b39de5..96d6473754cdd1 100644 --- a/tools/doc/node_modules/marked/lib/marked.js +++ b/tools/doc/node_modules/marked/lib/marked.js @@ -1344,8 +1344,23 @@ function merge(obj) { } function splitCells(tableRow, count) { - var cells = tableRow.replace(/([^\\])\|/g, '$1 |').split(/ +\| */), - i = 0; +// ensure that every cell-delimiting pipe has a space +// before it to distinguish it from an escaped pipe +var row = tableRow.replace(/\|/g, function (match, offset, str) { + var escaped = false, + curr = offset; + while (--curr >= 0 && str[curr] === '\\') escaped = !escaped; + if (escaped) { + // odd number of slashes means | is escaped + // so we leave it alone + return '|'; + } else { + // add space before unescaped | + return ' |'; + } + }), + cells = row.split(/ \|/), + i = 0; if (cells.length > count) { cells.splice(count); @@ -1354,8 +1369,8 @@ function splitCells(tableRow, count) { } for (; i < cells.length; i++) { - cells[i] = cells[i].replace(/\\\|/g, '|'); - } + // leading or trailing whitespace is ignored per the gfm spec + cells[i] = cells[i].trim().replace(/\\\|/g, '|'); } return cells; } From 10be56cd8b54d4c374dd1fa74812031d221a7480 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 28 Jun 2018 23:20:31 -0700 Subject: [PATCH 7/7] tools: float prototype patch on marked-0.4.0 Float a patch on marked-0.4.0 that fixes a bug that breaks links that are named the same as properties on the Object prototype. Refs: https://github.com/markedjs/marked/pull/1299 --- tools/doc/node_modules/marked/lib/marked.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/doc/node_modules/marked/lib/marked.js b/tools/doc/node_modules/marked/lib/marked.js index 96d6473754cdd1..71555e18bc634e 100644 --- a/tools/doc/node_modules/marked/lib/marked.js +++ b/tools/doc/node_modules/marked/lib/marked.js @@ -135,7 +135,7 @@ block.pedantic = merge({}, block.normal, { function Lexer(options) { this.tokens = []; - this.tokens.links = {}; + this.tokens.links = Object.create(null); this.options = options || marked.defaults; this.rules = block.normal;