diff --git a/Makefile b/Makefile index aedb93724..0c99d9ff4 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,14 @@ docassets = $(addprefix out/,$(wildcard doc/assets/*)) VERSION = $(shell node -e "console.log( require('./src/package.json').version )") UNAME := $(shell uname -s) -docs: $(outdoc_files) $(docassets) +ensure_marked_is_installed: + set -eu; \ + hash npm; \ + if [ $(shell npm list --prefix bin/doc >/dev/null 2>/dev/null; echo $$?) -ne "0" ]; then \ + npm ci --prefix=bin/doc; \ + fi + +docs: ensure_marked_is_installed $(outdoc_files) $(docassets) out/doc/assets/%: doc/assets/% mkdir -p $(@D) diff --git a/bin/doc/node_modules/.bin/marked b/bin/doc/node_modules/.bin/marked deleted file mode 100644 index a8d872e9d..000000000 --- a/bin/doc/node_modules/.bin/marked +++ /dev/null @@ -1 +0,0 @@ -../marked/bin/marked \ No newline at end of file diff --git a/bin/doc/node_modules/marked/.npmignore b/bin/doc/node_modules/marked/.npmignore deleted file mode 100644 index 3fb773c03..000000000 --- a/bin/doc/node_modules/marked/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -.git* -test/ diff --git a/bin/doc/node_modules/marked/LICENSE b/bin/doc/node_modules/marked/LICENSE deleted file mode 100644 index 40597477c..000000000 --- a/bin/doc/node_modules/marked/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011-2012, 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/bin/doc/node_modules/marked/Makefile b/bin/doc/node_modules/marked/Makefile deleted file mode 100644 index 76904000b..000000000 --- a/bin/doc/node_modules/marked/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: - @cp lib/marked.js marked.js - @uglifyjs -o marked.min.js marked.js - -clean: - @rm marked.js - @rm marked.min.js - -.PHONY: clean all diff --git a/bin/doc/node_modules/marked/README.md b/bin/doc/node_modules/marked/README.md deleted file mode 100644 index 1a0747c0d..000000000 --- a/bin/doc/node_modules/marked/README.md +++ /dev/null @@ -1,135 +0,0 @@ -# marked - -A full-featured markdown parser and compiler. -Built for speed. - -## Benchmarks - -node v0.4.x - -``` bash -$ node test --bench -marked completed in 12071ms. -showdown (reuse converter) completed in 27387ms. -showdown (new converter) completed in 75617ms. -markdown-js completed in 70069ms. -``` - -node v0.6.x - -``` bash -$ node test --bench -marked completed in 6485ms. -marked (with gfm) completed in 7466ms. -discount completed in 7169ms. -showdown (reuse converter) completed in 15937ms. -showdown (new converter) completed in 18279ms. -markdown-js completed in 23572ms. -``` - -__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. - -Benchmarks for other engines to come (?). - -## Install - -``` bash -$ npm install marked -``` - -## Another javascript markdown parser - -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](http://github.github.com/github-flavored-markdown/). - -## Usage - -``` js -var marked = require('marked'); -console.log(marked('i am using __markdown__.')); -``` - -You also have direct access to the lexer and parser if you so desire. - -``` js -var tokens = marked.lexer(str); -console.log(marked.parser(tokens)); -``` - -``` bash -$ node -> require('marked').lexer('> i am using marked.') -[ { type: 'blockquote_start' }, - { type: 'text', text: ' i am using marked.' }, - { type: 'blockquote_end' }, - links: {} ] -``` - -## CLI - -``` bash -$ marked -o hello.html -hello world -^D -$ cat hello.html -
hello world
-``` - -## Syntax Highlighting - -Marked has an interface that allows for a syntax highlighter to highlight code -blocks before they're output. - -Example implementation: - -``` js -var highlight = require('my-syntax-highlighter') - , marked_ = require('marked'); - -var marked = function(text) { - var tokens = marked_.lexer(text) - , l = tokens.length - , i = 0 - , token; - - for (; i < l; i++) { - token = tokens[i]; - if (token.type === 'code') { - token.text = highlight(token.text, token.lang); - // marked should not escape this - token.escaped = true; - } - } - - text = marked_.parser(tokens); - - return text; -}; - -module.exports = marked; -``` - -## License - -Copyright (c) 2011-2012, Christopher Jeffrey. (MIT License) - -See LICENSE for more info. diff --git a/bin/doc/node_modules/marked/bin/marked b/bin/doc/node_modules/marked/bin/marked deleted file mode 100644 index 7d00504ed..000000000 --- a/bin/doc/node_modules/marked/bin/marked +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env node - -/** - * Marked CLI - * Copyright (c) 2011-2012, Christopher Jeffrey (MIT License) - */ - -var fs = require('fs') - , util = require('util') - , marked = require('../'); - -/** - * Man Page - */ - -var help = function() { - var spawn = require('child_process').spawn; - - var options = { - cwd: process.cwd(), - env: process.env, - setsid: false, - customFds: [0, 1, 2] - }; - - spawn('man', - [__dirname + '/../man/marked.1'], - options); -}; - -/** - * Main - */ - -var main = function(argv) { - var files = [] - , data = '' - , input - , output - , arg - , tokens; - - var getarg = function() { - var arg = argv.shift(); - arg = arg.split('='); - if (arg.length > 1) { - argv.unshift(arg.slice(1).join('=')); - } - return arg[0]; - }; - - while (argv.length) { - arg = getarg(); - switch (arg) { - case '-o': - case '--output': - output = argv.shift(); - break; - case '-i': - case '--input': - input = argv.shift(); - break; - case '-t': - case '--tokens': - tokens = true; - break; - case '-h': - case '--help': - return help(); - default: - files.push(arg); - break; - } - } - - if (!input) { - if (files.length <= 2) { - var stdin = process.stdin; - - stdin.setEncoding('utf8'); - stdin.resume(); - - stdin.on('data', function(text) { - data += text; - }); - - stdin.on('end', write); - - return; - } - input = files.pop(); - } - - data = fs.readFileSync(input, 'utf8'); - write(); - - function write() { - data = tokens - ? JSON.stringify(marked.lexer(data), null, 2) - : marked(data); - - if (!output) { - process.stdout.write(data + '\n'); - } else { - fs.writeFileSync(output, data); - } - } -}; - -if (!module.parent) { - process.title = 'marked'; - main(process.argv.slice()); -} else { - module.exports = main; -} diff --git a/bin/doc/node_modules/marked/index.js b/bin/doc/node_modules/marked/index.js deleted file mode 100644 index a12f90569..000000000 --- a/bin/doc/node_modules/marked/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/marked'); diff --git a/bin/doc/node_modules/marked/lib/marked.js b/bin/doc/node_modules/marked/lib/marked.js deleted file mode 100644 index c6f3d0ac8..000000000 --- a/bin/doc/node_modules/marked/lib/marked.js +++ /dev/null @@ -1,662 +0,0 @@ -/** - * marked - A markdown parser (https://github.com/chjj/marked) - * Copyright (c) 2011-2012, Christopher Jeffrey. (MIT Licensed) - */ - -;(function() { - -/** - * Block-Level Grammar - */ - -var block = { - newline: /^\n+/, - code: /^ {4,}[^\n]*(?:\n {4,}[^\n]*|\n)*(?:\n+|$)/, - gfm_code: /^ *``` *(\w+)? *\n([^\0]+?)\s*``` *(?:\n+|$)/, - hr: /^( *[\-*_]){3,} *(?:\n+|$)/, - heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, - lheading: /^([^\n]+)\n *(=|-){3,} *\n*/, - blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/, - list: /^( *)([*+-]|\d+\.) [^\0]+?(?:\n{2,}(?! )|\s*$)(?!\1bullet)\n*/, - html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/, - def: /^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, - paragraph: /^([^\n]+\n?(?!body))+\n*/, - text: /^[^\n]+/ -}; - -block.list = (function() { - var list = block.list.source; - - list = list - .replace('bullet', /(?:[*+-](?!(?: *[-*]){2,})|\d+\.)/.source); - - return new RegExp(list); -})(); - -block.html = (function() { - var html = block.html.source; - - html = html - .replace('comment', //.source) - .replace('closed', /<(tag)[^\0]+?<\/\1>/.source) - .replace('closing', /'
- + escape(cap[2], true)
- + '
';
- continue;
- }
-
- // br
- if (cap = inline.br.exec(src)) {
- src = src.substring(cap[0].length);
- out += ''
- + (token.escaped
- ? token.text
- : escape(token.text, true))
- + '
\n';
- }
- case 'blockquote_start': {
- var body = '';
-
- while (next().type !== 'blockquote_end') {
- body += tok();
- }
-
- return '\n' - + body - + '\n'; - } - case 'list_start': { - var type = token.ordered ? 'ol' : 'ul' - , body = ''; - - while (next().type !== 'list_end') { - body += tok(); - } - - return '<' - + type - + '>\n' - + body - + '' - + type - + '>\n'; - } - case 'list_item_start': { - var body = ''; - - while (next().type !== 'list_item_end') { - body += token.type === 'text' - ? parseText() - : tok(); - } - - return '
' - + inline.lexer(token.text) - + '
\n'; - } - case 'text': { - return '' - + parseText() - + '
\n'; - } - } -}; - -var parseText = function() { - var body = token.text - , top; - - while ((top = tokens[tokens.length-1]) - && top.type === 'text') { - body += '\n' + next().text; - } - - return inline.lexer(body); -}; - -var parse = function(src) { - tokens = src.reverse(); - - var out = ''; - while (next()) { - out += tok(); - } - - tokens = null; - token = null; - - return out; -}; - -/** - * Helpers - */ - -var escape = function(html, encode) { - return html - .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -}; - -var mangle = function(text) { - var out = '' - , l = text.length - , i = 0 - , ch; - - for (; i < l; i++) { - ch = text.charCodeAt(i); - if (Math.random() > 0.5) { - ch = 'x' + ch.toString(16); - } - out += '' + ch + ';'; - } - - return out; -}; - -function tag() { - var 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+'; - - return tag; -} - -/** - * Expose - */ - -var marked = function(src) { - return parse(block.lexer(src)); -}; - -marked.parser = parse; -marked.lexer = block.lexer; - -marked.parse = marked; - -if (typeof module !== 'undefined') { - module.exports = marked; -} else { - this.marked = marked; -} - -}).call(this); diff --git a/bin/doc/node_modules/marked/man/marked.1 b/bin/doc/node_modules/marked/man/marked.1 deleted file mode 100644 index 214533390..000000000 --- a/bin/doc/node_modules/marked/man/marked.1 +++ /dev/null @@ -1,39 +0,0 @@ -.ds q \N'34' -.TH marked 1 -.SH NAME -marked \- a javascript markdown parser -.SH SYNOPSIS -.nf -.B marked [\-o output] [\-i input] [\-th] -.fi -.SH DESCRIPTION -.B marked -is a full-featured javascript markdown parser, built for speed. It also includes -multiple GFM features. -.SH OPTIONS -.TP -.BI \-o,\ \-\-output\ [output] -Specify file output. If none is specified, write to stdout. -.TP -.BI \-i,\ \-\-input\ [input] -Specify file input, otherwise use last argument as input file. If no input file -is specified, read from stdin. -.TP -.BI \-t,\ \-\-tokens -Output a token stream instead of html. -.TP -.BI \-h,\ \-\-help -Display help information. -.SH EXAMPLES -.TP -cat in.md | marked > out.html -.TP -echo "hello *world*" | marked -.TP -marked -o out.html in.md -.TP -marked --output="hello world.html" -i in.md -.SH BUGS -Please report any bugs to https://github.com/chjj/marked. -.SH LICENSE -Copyright (c) 2011-2012, Christopher Jeffrey (MIT License) diff --git a/bin/doc/node_modules/marked/package.json b/bin/doc/node_modules/marked/package.json deleted file mode 100644 index f47a9e125..000000000 --- a/bin/doc/node_modules/marked/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "marked", - "description": "A markdown parser built for speed", - "author": "Christopher Jeffrey", - "version": "0.1.9", - "main": "./lib/marked.js", - "bin": "./bin/marked", - "man": "./man/marked.1", - "preferGlobal": false, - "repository": "git://github.com/chjj/marked.git", - "homepage": "https://github.com/chjj/marked", - "bugs": "http://github.com/chjj/marked/issues", - "keywords": [ "markdown", "markup", "html" ], - "tags": [ "markdown", "markup", "html" ] -} diff --git a/bin/doc/package-lock.json b/bin/doc/package-lock.json new file mode 100644 index 000000000..eb5526135 --- /dev/null +++ b/bin/doc/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "node-doc-generator", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "marked": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.2.tgz", + "integrity": "sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==" + } + } +} diff --git a/bin/doc/package.json b/bin/doc/package.json index 5aba79e05..1a29f1b1c 100644 --- a/bin/doc/package.json +++ b/bin/doc/package.json @@ -7,7 +7,7 @@ "node": ">=0.6.10" }, "dependencies": { - "marked": ">=0.3.6" + "marked": "0.8.2" }, "devDependencies": {}, "optionalDependencies": {},