├── .gitignore
├── LICENSE
├── README.md
├── app.js
├── bin
└── nd
├── config
└── config.json
├── deps
└── marked
│ ├── LICENSE
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ └── marked
│ ├── index.js
│ ├── lib
│ ├── marked.js
│ └── terminal.js
│ ├── man
│ └── marked.1
│ ├── package.json
│ └── test
│ ├── README
│ ├── browser
│ ├── index.html
│ ├── index.js
│ └── test.js
│ ├── fix
│ ├── fix.js
│ ├── index.js
│ ├── new
│ ├── blockquote_list_item.html
│ ├── blockquote_list_item.text
│ ├── case_insensitive_refs.html
│ ├── case_insensitive_refs.text
│ ├── escaped_angles.html
│ ├── escaped_angles.text
│ ├── gfm_break.html
│ ├── gfm_break.text
│ ├── gfm_code.html
│ ├── gfm_code.text
│ ├── gfm_em.html
│ ├── gfm_em.text
│ ├── gfm_links.html
│ ├── gfm_links.text
│ ├── hr_list_break.html
│ ├── hr_list_break.text
│ ├── lazy_blockquotes.html
│ ├── lazy_blockquotes.text
│ ├── list_item_text.html
│ ├── list_item_text.text
│ ├── loose_lists.html
│ ├── loose_lists.text
│ ├── main.html
│ ├── main.text
│ ├── nested_code.html
│ ├── nested_code.text
│ ├── nested_em.html
│ ├── nested_em.text
│ ├── nested_square_link.html
│ ├── nested_square_link.text
│ ├── not_a_link.html
│ ├── not_a_link.text
│ ├── ref_paren.html
│ ├── ref_paren.text
│ ├── same_bullet.html
│ ├── same_bullet.text
│ ├── toplevel_paragraphs.html
│ ├── toplevel_paragraphs.text
│ ├── tricky_list.html
│ └── tricky_list.text
│ ├── original
│ ├── amps_and_angles_encoding.html
│ ├── amps_and_angles_encoding.text
│ ├── auto_links.html
│ ├── auto_links.text
│ ├── backslash_escapes.html
│ ├── backslash_escapes.text
│ ├── blockquotes_with_code_blocks.html
│ ├── blockquotes_with_code_blocks.text
│ ├── code_blocks.html
│ ├── code_blocks.text
│ ├── code_spans.html
│ ├── code_spans.text
│ ├── hard_wrapped_paragraphs_with_list_like_lines.html
│ ├── hard_wrapped_paragraphs_with_list_like_lines.text
│ ├── horizontal_rules.html
│ ├── horizontal_rules.text
│ ├── inline_html_advanced.html
│ ├── inline_html_advanced.text
│ ├── inline_html_comments.html
│ ├── inline_html_comments.text
│ ├── inline_html_simple.html
│ ├── inline_html_simple.text
│ ├── links_inline_style.html
│ ├── links_inline_style.text
│ ├── links_reference_style.html
│ ├── links_reference_style.text
│ ├── links_shortcut_references.html
│ ├── links_shortcut_references.text
│ ├── literal_quotes_in_titles.html
│ ├── literal_quotes_in_titles.text
│ ├── markdown_documentation_basics.html
│ ├── markdown_documentation_basics.text
│ ├── markdown_documentation_syntax.html
│ ├── markdown_documentation_syntax.text
│ ├── nested_blockquotes.html
│ ├── nested_blockquotes.text
│ ├── ordered_and_unordered_lists.html
│ ├── ordered_and_unordered_lists.text
│ ├── strong_and_em_together.html
│ ├── strong_and_em_together.text
│ ├── tabs.html
│ ├── tabs.text
│ ├── tidyness.html
│ └── tidyness.text
│ └── tests
│ ├── amps_and_angles_encoding.html
│ ├── amps_and_angles_encoding.text
│ ├── auto_links.html
│ ├── auto_links.text
│ ├── backslash_escapes.html
│ ├── backslash_escapes.text
│ ├── blockquote_list_item.html
│ ├── blockquote_list_item.text
│ ├── blockquotes_with_code_blocks.html
│ ├── blockquotes_with_code_blocks.text
│ ├── case_insensitive_refs.html
│ ├── case_insensitive_refs.text
│ ├── code_blocks.html
│ ├── code_blocks.text
│ ├── code_spans.html
│ ├── code_spans.text
│ ├── escaped_angles.html
│ ├── escaped_angles.text
│ ├── gfm_break.html
│ ├── gfm_break.text
│ ├── gfm_code.html
│ ├── gfm_code.text
│ ├── gfm_em.html
│ ├── gfm_em.text
│ ├── gfm_links.html
│ ├── gfm_links.text
│ ├── hard_wrapped_paragraphs_with_list_like_lines.html
│ ├── hard_wrapped_paragraphs_with_list_like_lines.text
│ ├── horizontal_rules.html
│ ├── horizontal_rules.text
│ ├── hr_list_break.html
│ ├── hr_list_break.text
│ ├── inline_html_advanced.html
│ ├── inline_html_advanced.text
│ ├── inline_html_comments.html
│ ├── inline_html_comments.text
│ ├── inline_html_simple.html
│ ├── inline_html_simple.text
│ ├── lazy_blockquotes.html
│ ├── lazy_blockquotes.text
│ ├── links_inline_style.html
│ ├── links_inline_style.text
│ ├── links_reference_style.html
│ ├── links_reference_style.text
│ ├── links_shortcut_references.html
│ ├── links_shortcut_references.text
│ ├── list_item_text.html
│ ├── list_item_text.text
│ ├── literal_quotes_in_titles.html
│ ├── literal_quotes_in_titles.text
│ ├── loose_lists.html
│ ├── loose_lists.text
│ ├── main.html
│ ├── main.text
│ ├── markdown_documentation_basics.html
│ ├── markdown_documentation_basics.text
│ ├── markdown_documentation_syntax.html
│ ├── markdown_documentation_syntax.text
│ ├── nested_blockquotes.html
│ ├── nested_blockquotes.text
│ ├── nested_code.html
│ ├── nested_code.text
│ ├── nested_em.html
│ ├── nested_em.text
│ ├── nested_square_link.html
│ ├── nested_square_link.text
│ ├── not_a_link.html
│ ├── not_a_link.text
│ ├── ordered_and_unordered_lists.html
│ ├── ordered_and_unordered_lists.text
│ ├── ref_paren.html
│ ├── ref_paren.text
│ ├── same_bullet.html
│ ├── same_bullet.text
│ ├── strong_and_em_together.html
│ ├── strong_and_em_together.text
│ ├── tabs.html
│ ├── tabs.text
│ ├── tidyness.html
│ ├── tidyness.text
│ ├── toplevel_paragraphs.html
│ ├── toplevel_paragraphs.text
│ ├── tricky_list.html
│ └── tricky_list.text
├── lib
└── find.js
├── package.json
├── shot.png
└── windows-shot.png
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 Russell Frank github.com/russfrank russfrank.us twitter.com/russjf
2 |
3 | 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:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | 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.
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # nd
2 |
3 | _a documentation viewer for npm_
4 |
5 |
6 |
7 | `nd` is a documentation viewer for npm packages. Similar to
8 | [mad(1)](http://tjholowaychuk.com/post/21100445420/going-mad-1),
9 | it displays markdown documents in your terminal. Dissimilarly to *mad*, nd
10 | is written in javascript, and reads documentation out of npm module directories,
11 | not out of its own repository of pages.
12 |
13 | By writing this software in javascript, we benefit
14 | from the existing `require()` circuitry. This means that there is a large
15 | volume of useful documentation available, despite the fact that very few packages
16 | have a `doc` or `docs` folder. Nearly every package at least has a
17 | `README.md`; `nd` will read this.
18 |
19 | If a `doc` or `docs` directory is present, or if there is a docs directory
20 | specified in the `package.json` of some module, documentation will be loaded
21 | out of these directories.
22 |
23 | For example, if we type
24 |
25 | ```
26 | $ nd npm cli
27 | ```
28 |
29 | We will get `npm/doc/cli/index.md`. So, if additional arguments (besides the
30 | module name) are provided, we try to find a file which is more specific:
31 | we'll look for `module/arg1/arg2/index.md`, `module/arg1/arg2/arg2.md`, and
32 | `module/arg1/arg2.md`. This allows us to be flexible about the organization
33 | of documentation within modules.
34 |
35 | ## Usage
36 |
37 | To install:
38 |
39 | ```
40 | $ sudo npm install -g nd
41 | ```
42 |
43 | Note that you may not need `sudo` if you installed `node` via a virtual
44 | environment manager such as [nvm](https://github.com/creationix/nvm).
45 |
46 | To use:
47 |
48 | ```
49 | $ nd modulename
50 | ```
51 |
52 | `nd` searches for modules from within the current directory. If it can't find
53 | the module you're looking for in the current directory, it will search for
54 | modules installed globally with `npm -g`.
55 |
56 |
57 | You can also type simply
58 |
59 | ```
60 | $ nd
61 | ```
62 |
63 | to get a list of modules in the current directory.. You can run `nd` with the relative
64 | path to a markdown file as an argument and `nd` will read it, or you can pipe it some stuff:
65 |
66 | ```
67 | $ nd README.md
68 | $ curl https://github.com/russfrank/nd/raw/master/README.md | nd
69 | ```
70 |
71 | `nd` can also grab core docs, though, I should note that it always takes them
72 | straight out of *master*, which might not be what you want:
73 |
74 | ```
75 | $ nd node child_process
76 | ```
77 |
78 | You can also just straight up give it urls, it'll figure that shit out.
79 |
80 | ```
81 | $ nd https://raw.github.com/joyent/node/master/doc/api/child_process.markdown
82 | ```
83 |
84 | Also, it works on Windows, since everybody knows that Windows users love to
85 | read docs in their terminal:
86 |
87 |
88 |
89 | ## Future
90 |
91 | More ideas:
92 |
93 | 1. Pydoc like web server
94 | 2. Docco view of source files (markdown comments on left, source on right) in terminal
95 | 3. picture-tube for images
96 | 4. command line completion
97 |
98 | ## License
99 |
100 | MIT.
101 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | var flatiron = require('flatiron');
2 | var path = require('path');
3 | var fs = require('fs');
4 | var _ = require('underscore');
5 | var app = flatiron.app;
6 | var find = require('./lib/find');
7 | var async = require('async');
8 | var npm = require('npm');
9 | var request = require('request');
10 | var moar;
11 |
12 | if (fs.existsSync) path.existsSync = fs.existsSync;
13 | if (fs.exists) path.exists = fs.exists;
14 |
15 | app.config.file({ file: path.join(__dirname, 'config', 'config.json') });
16 |
17 | app.use(flatiron.plugins.cli, {dir: __dirname, usage: [], argv: {
18 | l: {boolean: true}
19 | }});
20 |
21 | function list (module, args) {
22 | async.waterfall([
23 | function (callback) { find.root(module, callback); },
24 | function (root, callback) { find.docDir(root, callback); }
25 | ], function (err, data) {
26 | if (err) {
27 | app.log.error(err);
28 | return;
29 | }
30 |
31 | var dir = path.join(data[0], path.join.apply(null, args));
32 |
33 | fs.readdir(dir, function (err, files) {
34 | if (err) return app.log.error(err.message);
35 |
36 | if (_.size(files) === 0) {
37 | return app.log.error('No packages found!');
38 | }
39 |
40 | _.each(files, function (file) {
41 | console.log(file);
42 | });
43 | });
44 | });
45 | }
46 |
47 | function markdisp (data) {
48 | var marked = require('./deps/marked').setOptions({gfm: true, terminal: true});
49 | if (!moar) {
50 | moar = require('moar')({nowrap: true});
51 | }
52 |
53 | moar.write('\n' + marked.parse(data));
54 | moar.end();
55 | moar.on('done', function () { process.exit(0); });
56 | }
57 |
58 | function listModules () {
59 | console.log("Available modules:".bold);
60 | npm.dir = process.cwd();
61 | npm.config.set('global', false);
62 | npm.commands.ls([], false, function (err, data) {
63 | if (err) return app.log.error(err);
64 | });
65 | }
66 |
67 | function view (module, args) {
68 | async.waterfall([
69 | function (callback) { find.root(module, callback); },
70 | function (root, callback) { find.docDir(root, callback); },
71 | function (dirs, callback) { find.file(dirs, args, module, callback); }
72 | ], function (err, data) {
73 | if (err) {
74 | app.log.error(err);
75 | return;
76 | }
77 |
78 | markdisp(data);
79 | });
80 | }
81 |
82 | app.cmd('node *', function (page) {
83 | var url = 'https://raw.github.com/joyent/node/master/doc/api/'+page+'.markdown';
84 | request(url, function (error, res, body) {
85 | if (error || res.statusCode == 404) return app.log.error('error retrieving page');
86 | markdisp(body);
87 | });
88 | });
89 |
90 | app.router.notfound = function () {
91 | var args = app.argv._;
92 | var module = args.shift();
93 |
94 | if (app.argv.l) {
95 | // list mode
96 | if (args.length > 0 || module) {
97 | list(module, args);
98 | } else {
99 | listModules();
100 | }
101 | } else {
102 | // view
103 |
104 | if (!process.stdin.isTTY && process.platform !== "win32") {
105 | // we're getting piped some stuff, gather it up and send it over to
106 | // markdisp to be displayed
107 |
108 | // we have spawn less before resuming stdin, or it gets confused
109 | moar = require('moar')({nowrap: true});
110 |
111 | process.stdin.resume();
112 | process.stdin.setEncoding('utf8');
113 | var data = '';
114 |
115 | process.stdin.on('data', function (chunk) {
116 | data += chunk;
117 | });
118 |
119 | process.stdin.on('end', function () {
120 | markdisp(data);
121 | });
122 | }
123 |
124 | // the process.stdin.pauses below are because the call to
125 | // process.stdin.isTTY above are enough to make the process hang without
126 | // pausing stdin
127 |
128 | else if (!module) {
129 | process.stdin.pause();
130 | // no module name provided, just give a list of modules
131 | listModules();
132 | }
133 |
134 | else if (/^https?:\/\//.test(module)) {
135 | process.stdin.pause();
136 | request(module, function (error, res, body) {
137 | if (error || res.statusCode == 404) return app.log.error('error retrieving page');
138 | markdisp(body);
139 | });
140 | }
141 |
142 | else {
143 | process.stdin.pause();
144 | // we have some arguments.. check to see if they're a filename
145 | var file = path.join(process.cwd(), module);
146 | path.exists(file, function (exists) {
147 |
148 | if (exists) {
149 | // if so, read and display the file
150 | fs.readFile(file, 'utf8', function (err, data) {
151 | if (err) return app.log.error(err);
152 | markdisp(data);
153 | });
154 | }
155 |
156 | else {
157 | // otherwise send the arguments over to view() to do an actual
158 | // module lookup
159 | view(module, args);
160 | }
161 | });
162 | }
163 | }
164 | };
165 |
166 | npm.load({global: true, loglevel: 'silent'}, function(err) {
167 | if (err) app.log.error(err);
168 | else app.start();
169 | });
170 |
--------------------------------------------------------------------------------
/bin/nd:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | require('../app.js');
4 |
--------------------------------------------------------------------------------
/config/config.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
--------------------------------------------------------------------------------
/deps/marked/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-2012, Christopher Jeffrey (https://github.com/chjj/)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/deps/marked/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | @cp lib/marked.js marked.js
3 | @uglifyjs -o marked.min.js marked.js
4 |
5 | clean:
6 | @rm marked.js
7 | @rm marked.min.js
8 |
9 | .PHONY: clean all
10 |
--------------------------------------------------------------------------------
/deps/marked/README.md:
--------------------------------------------------------------------------------
1 | # marked
2 |
3 | A full-featured markdown parser and compiler, written in javascript.
4 | Built for speed.
5 |
6 | ## Benchmarks
7 |
8 | node v0.4.x
9 |
10 | ``` bash
11 | $ node test --bench
12 | marked completed in 12071ms.
13 | showdown (reuse converter) completed in 27387ms.
14 | showdown (new converter) completed in 75617ms.
15 | markdown-js completed in 70069ms.
16 | ```
17 |
18 | node v0.6.x
19 |
20 | ``` bash
21 | $ node test --bench
22 | marked completed in 6448ms.
23 | marked (gfm) completed in 7357ms.
24 | marked (pedantic) completed in 6092ms.
25 | discount completed in 7314ms.
26 | showdown (reuse converter) completed in 16018ms.
27 | showdown (new converter) completed in 18234ms.
28 | markdown-js completed in 24270ms.
29 | ```
30 |
31 | __Marked is now faster than Discount, which is written in C.__
32 |
33 | For those feeling skeptical: These benchmarks run the entire markdown test suite
34 | 1000 times. The test suite tests every feature. It doesn't cater to specific
35 | aspects.
36 |
37 | ## Install
38 |
39 | ``` bash
40 | $ npm install marked
41 | ```
42 |
43 | ## Another Javascript Markdown Parser
44 |
45 | The point of marked was to create a markdown compiler where it was possible to
46 | frequently parse huge chunks of markdown without having to worry about
47 | caching the compiled output somehow...or blocking for an unnecesarily long time.
48 |
49 | marked is very concise and still implements all markdown features. It is also
50 | now fully compatible with the client-side.
51 |
52 | marked more or less passes the official markdown test suite in its
53 | entirety. This is important because a surprising number of markdown compilers
54 | cannot pass more than a few tests. It was very difficult to get marked as
55 | compliant as it is. It could have cut corners in several areas for the sake
56 | of performance, but did not in order to be exactly what you expect in terms
57 | of a markdown rendering. In fact, this is why marked could be considered at a
58 | disadvantage in the benchmarks above.
59 |
60 | Along with implementing every markdown feature, marked also implements
61 | [GFM features](http://github.github.com/github-flavored-markdown/).
62 |
63 | ## Options
64 |
65 | marked has 4 different switches which change behavior.
66 |
67 | - __pedantic__: Conform to obscure parts of `markdown.pl` as much as possible.
68 | Don't fix any of the original markdown bugs or poor behavior.
69 | - __gfm__: Enable github flavored markdown (enabled by default).
70 | - __sanitize__: Sanitize the output. Ignore any HTML that has been input.
71 | - __highlight__: A callback to highlight code blocks.
72 |
73 | None of the above are mutually exclusive/inclusive.
74 |
75 | ## Usage
76 |
77 | ``` js
78 | // Set default options
79 | marked.setOptions({
80 | gfm: true,
81 | pedantic: false,
82 | sanitize: true,
83 | // callback for code highlighter
84 | highlight: function(code, lang) {
85 | if (lang === 'js') {
86 | return javascriptHighlighter(code);
87 | }
88 | return code;
89 | }
90 | });
91 | console.log(marked('i am using __markdown__.'));
92 | ```
93 |
94 | You also have direct access to the lexer and parser if you so desire.
95 |
96 | ``` js
97 | var tokens = marked.lexer(text);
98 | console.log(marked.parser(tokens));
99 | ```
100 |
101 | ``` bash
102 | $ node
103 | > require('marked').lexer('> i am using marked.')
104 | [ { type: 'blockquote_start' },
105 | { type: 'paragraph',
106 | text: 'i am using marked.' },
107 | { type: 'blockquote_end' },
108 | links: {} ]
109 | ```
110 |
111 | ## CLI
112 |
113 | ``` bash
114 | $ marked -o hello.html
115 | hello world
116 | ^D
117 | $ cat hello.html
118 |
hello world
119 | ``` 120 | 121 | ## License 122 | 123 | Copyright (c) 2011-2012, Christopher Jeffrey. (MIT License) 124 | 125 | See LICENSE for more info. 126 | -------------------------------------------------------------------------------- /deps/marked/bin/marked: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Marked CLI 5 | * Copyright (c) 2011-2012, Christopher Jeffrey (MIT License) 6 | */ 7 | 8 | var fs = require('fs') 9 | , util = require('util') 10 | , marked = require('../'); 11 | 12 | /** 13 | * Man Page 14 | */ 15 | 16 | var help = function() { 17 | var spawn = require('child_process').spawn; 18 | 19 | var options = { 20 | cwd: process.cwd(), 21 | env: process.env, 22 | setsid: false, 23 | customFds: [0, 1, 2] 24 | }; 25 | 26 | spawn('man', 27 | [__dirname + '/../man/marked.1'], 28 | options); 29 | }; 30 | 31 | /** 32 | * Main 33 | */ 34 | 35 | var main = function(argv) { 36 | var files = [] 37 | , options = {} 38 | , data = '' 39 | , input 40 | , output 41 | , arg 42 | , tokens; 43 | 44 | var getarg = function() { 45 | var arg = argv.shift(); 46 | arg = arg.split('='); 47 | if (arg.length > 1) { 48 | argv.unshift(arg.slice(1).join('=')); 49 | } 50 | return arg[0]; 51 | }; 52 | 53 | while (argv.length) { 54 | arg = getarg(); 55 | switch (arg) { 56 | case '-o': 57 | case '--output': 58 | output = argv.shift(); 59 | break; 60 | case '-i': 61 | case '--input': 62 | input = argv.shift(); 63 | break; 64 | case '-t': 65 | case '--tokens': 66 | tokens = true; 67 | break; 68 | case '--gfm': 69 | options.gfm = true; 70 | break; 71 | case '--sanitize': 72 | options.sanitize = true; 73 | break; 74 | case '--pedantic': 75 | options.pedantic = true; 76 | break; 77 | case '-h': 78 | case '--help': 79 | return help(); 80 | case '--terminal': 81 | options.terminal = true; 82 | break; 83 | default: 84 | files.push(arg); 85 | break; 86 | } 87 | } 88 | 89 | if (!input) { 90 | if (files.length <= 2) { 91 | var stdin = process.stdin; 92 | 93 | stdin.setEncoding('utf8'); 94 | stdin.resume(); 95 | 96 | stdin.on('data', function(text) { 97 | data += text; 98 | }); 99 | 100 | stdin.on('end', write); 101 | 102 | return; 103 | } 104 | input = files.pop(); 105 | } 106 | 107 | data = fs.readFileSync(input, 'utf8'); 108 | write(); 109 | 110 | function write() { 111 | marked.setOptions(options); 112 | 113 | data = tokens 114 | ? JSON.stringify(marked.lexer(data), null, 2) 115 | : marked(data); 116 | 117 | if (!output) { 118 | process.stdout.write(data + '\n'); 119 | } else { 120 | fs.writeFileSync(output, data); 121 | } 122 | } 123 | }; 124 | 125 | if (!module.parent) { 126 | process.title = 'marked'; 127 | main(process.argv.slice()); 128 | } else { 129 | module.exports = main; 130 | } 131 | -------------------------------------------------------------------------------- /deps/marked/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/marked'); 2 | -------------------------------------------------------------------------------- /deps/marked/lib/marked.js: -------------------------------------------------------------------------------- 1 | /** 2 | * marked - A markdown parser (https://github.com/chjj/marked) 3 | * Copyright (c) 2011-2012, Christopher Jeffrey. (MIT Licensed) 4 | */ 5 | 6 | ;(function() { 7 | 8 | /** 9 | * Block-Level Grammar 10 | */ 11 | 12 | var block = { 13 | newline: /^\n+/, 14 | code: /^( {4}[^\n]+\n*)+/, 15 | fences: noop, 16 | hr: /^( *[-*_]){3,} *(?:\n+|$)/, 17 | heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, 18 | lheading: /^([^\n]+)\n *(=|-){3,} *\n*/, 19 | blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/, 20 | list: /^( *)(bull) [^\0]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, 21 | html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/, 22 | def: /^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, 23 | paragraph: /^([^\n]+\n?(?!body))+\n*/, 24 | text: /^[^\n]+/ 25 | }; 26 | 27 | block.bullet = /(?:[*+-]|\d+\.)/; 28 | block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; 29 | block.item = replace(block.item, 'gm') 30 | (/bull/g, block.bullet) 31 | (); 32 | 33 | block.list = replace(block.list) 34 | (/bull/g, block.bullet) 35 | ('hr', /\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/) 36 | (); 37 | 38 | block.html = replace(block.html) 39 | ('comment', //) 40 | ('closed', /<(tag)[^\0]+?<\/\1>/) 41 | ('closing', /'
420 | + escape(text, true)
421 | + '
';
422 | },
423 |
424 | br: function () {
425 | return ''
581 | + text
582 | + '
\n';
583 | },
584 |
585 | blockquote: function (body) {
586 | return '\n' 587 | + body 588 | + '\n'; 589 | }, 590 | 591 | list: function (type, body) { 592 | return '<' 593 | + type 594 | + '>\n' 595 | + body 596 | + '' 597 | + type 598 | + '>\n'; 599 | }, 600 | 601 | listItem: function (body) { 602 | return '
' 609 | + body 610 | + '
\n'; 611 | } 612 | }; 613 | 614 | function next() { 615 | return token = tokens.pop(); 616 | } 617 | 618 | function tok() { 619 | switch (token.type) { 620 | case 'space': { 621 | return ''; 622 | } 623 | case 'hr': { 624 | return fmt.hr(); 625 | } 626 | case 'heading': { 627 | return fmt.heading(token.depth, inline.lexer(token.text)); 628 | } 629 | 630 | case 'code': { 631 | if (options.highlight) { 632 | token.code = options.highlight(token.text, token.lang); 633 | if (token.code != null && token.code !== token.text) { 634 | token.escaped = true; 635 | token.text = token.code; 636 | } 637 | } 638 | 639 | return fmt.code(token.lang, token.text, token.escaped); 640 | } 641 | 642 | case 'blockquote_start': { 643 | var body = ''; 644 | 645 | while (next().type !== 'blockquote_end') { 646 | body += tok(); 647 | } 648 | 649 | return fmt.blockquote(body); 650 | } 651 | 652 | case 'list_start': { 653 | var type = token.ordered ? 'ol' : 'ul' 654 | , body = ''; 655 | 656 | while (next().type !== 'list_end') { 657 | body += tok(); 658 | } 659 | 660 | return fmt.list(type, body); 661 | } 662 | 663 | case 'list_item_start': { 664 | var body = ''; 665 | 666 | while (next().type !== 'list_item_end') { 667 | body += token.type === 'text' 668 | ? parseText() 669 | : tok(); 670 | } 671 | 672 | return fmt.listItem(body); 673 | } 674 | 675 | case 'loose_item_start': { 676 | var body = ''; 677 | 678 | while (next().type !== 'list_item_end') { 679 | body += tok(); 680 | } 681 | 682 | return fmt.listItem(body); 683 | } 684 | 685 | case 'html': { 686 | if (options.sanitize) { 687 | return inline.lexer(token.text); 688 | } 689 | return !token.pre && !options.pedantic 690 | ? inline.lexer(token.text) 691 | : token.text; 692 | } 693 | 694 | case 'paragraph': { 695 | return fmt.paragraph(inline.lexer(token.text)); 696 | } 697 | 698 | case 'text': { 699 | return fmt.paragraph(parseText()); 700 | } 701 | } 702 | } 703 | 704 | function parseText() { 705 | var body = token.text 706 | , top; 707 | 708 | while ((top = tokens[tokens.length-1]) 709 | && top.type === 'text') { 710 | body += '\n' + next().text; 711 | } 712 | 713 | return inline.lexer(body); 714 | } 715 | 716 | function parse(src) { 717 | tokens = src.reverse(); 718 | 719 | var out = ''; 720 | while (next()) { 721 | out += tok(); 722 | } 723 | 724 | tokens = null; 725 | token = null; 726 | 727 | return out; 728 | } 729 | 730 | /** 731 | * Helpers 732 | */ 733 | 734 | function escape(html, encode) { 735 | return html 736 | .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') 737 | .replace(//g, '>') 739 | .replace(/"/g, '"') 740 | .replace(/'/g, '''); 741 | } 742 | 743 | function mangle(text) { 744 | var out = '' 745 | , l = text.length 746 | , i = 0 747 | , ch; 748 | 749 | for (; i < l; i++) { 750 | ch = text.charCodeAt(i); 751 | if (Math.random() > 0.5) { 752 | ch = 'x' + ch.toString(16); 753 | } 754 | out += '' + ch + ';'; 755 | } 756 | 757 | return out; 758 | } 759 | 760 | function tag() { 761 | var tag = '(?!(?:' 762 | + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' 763 | + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' 764 | + '|span|br|wbr|ins|del|img)\\b)\\w+'; 765 | 766 | return tag; 767 | } 768 | 769 | function replace(regex, opt) { 770 | regex = regex.source; 771 | opt = opt || ''; 772 | return function self(name, val) { 773 | if (!name) return new RegExp(regex, opt); 774 | regex = regex.replace(name, val.source || val); 775 | return self; 776 | }; 777 | } 778 | 779 | function noop() {} 780 | noop.exec = noop; 781 | 782 | /** 783 | * Marked 784 | */ 785 | 786 | function marked(src, opt) { 787 | setOptions(opt); 788 | return parse(block.lexer(src)); 789 | } 790 | 791 | /** 792 | * Options 793 | */ 794 | 795 | var options 796 | , defaults; 797 | 798 | function setOptions(opt) { 799 | if (!opt) opt = defaults; 800 | if (options === opt) return; 801 | options = opt; 802 | 803 | if (options.gfm) { 804 | block.fences = block.gfm.fences; 805 | block.paragraph = block.gfm.paragraph; 806 | inline.text = inline.gfm.text; 807 | inline.url = inline.gfm.url; 808 | } else { 809 | block.fences = block.normal.fences; 810 | block.paragraph = block.normal.paragraph; 811 | inline.text = inline.normal.text; 812 | inline.url = inline.normal.url; 813 | } 814 | 815 | if (options.pedantic) { 816 | inline.em = inline.pedantic.em; 817 | inline.strong = inline.pedantic.strong; 818 | } else { 819 | inline.em = inline.normal.em; 820 | inline.strong = inline.normal.strong; 821 | } 822 | 823 | if (options.fmt) { 824 | fmt = options.fmt; 825 | } else { 826 | fmt = defaultFmt; 827 | } 828 | 829 | if (options.inlineFmt) { 830 | inline.fmt = options.inlineFmt; 831 | } else { 832 | inline.fmt = inline.defaultFmt; 833 | } 834 | 835 | if (options.terminal) { 836 | var term = require('./terminal'); 837 | inline.fmt = term.inlineFmt; 838 | fmt = term.fmt; 839 | } else { 840 | fmt = defaultFmt; 841 | inline.fmt = inline.defaultFmt; 842 | } 843 | } 844 | 845 | marked.options = 846 | marked.setOptions = function(opt) { 847 | defaults = opt; 848 | setOptions(opt); 849 | return marked; 850 | }; 851 | 852 | marked.setOptions({ 853 | gfm: true, 854 | pedantic: false, 855 | sanitize: false, 856 | highlight: null 857 | }); 858 | 859 | /** 860 | * Expose 861 | */ 862 | 863 | marked.parser = function(src, opt) { 864 | setOptions(opt); 865 | return parse(src); 866 | }; 867 | 868 | marked.lexer = function(src, opt) { 869 | setOptions(opt); 870 | return block.lexer(src); 871 | }; 872 | 873 | marked.parse = marked; 874 | 875 | if (typeof module !== 'undefined') { 876 | module.exports = marked; 877 | } else { 878 | this.marked = marked; 879 | } 880 | 881 | }).call(function() { 882 | return this || (typeof window !== 'undefined' ? window : global); 883 | }()); 884 | -------------------------------------------------------------------------------- /deps/marked/lib/terminal.js: -------------------------------------------------------------------------------- 1 | try { 2 | var colors = require('colors'); 3 | var wordwrap = require('wordwrap'); 4 | } catch (e) { 5 | console.error([ 6 | "terminal support in marked requires npm packages `colors` and `wordwrap`.", 7 | "it isn't in the package.json as a dependency because nobody really cares", 8 | "about markdown in the terminal apparently. Install them with", 9 | "`npm install colors wordwrap`." 10 | ].join('\n')); 11 | } 12 | 13 | var width = process.stdout.getWindowSize && process.stdout.getWindowSize()[0]; 14 | if (!width) width = 90; 15 | width = Math.floor(0.85 * width); 16 | var wrap = wordwrap(3, width); 17 | var indent = wordwrap(9, width); 18 | var paragraph = wordwrap(6, width); 19 | 20 | var _s = require('underscore.string'); 21 | 22 | exports.inlineFmt = { 23 | escape: function (text) { 24 | return text; 25 | }, 26 | 27 | autolink: function (href, text) { 28 | if (href.indexOf && href.indexOf('mailto') !== -1) { 29 | href = href.slice(7); 30 | } 31 | if (href == text || href[0] == '#') { 32 | return text.underline; 33 | } else { 34 | return text.underline + ' (' + href + ')'; 35 | } 36 | }, 37 | 38 | tag: function (text) { 39 | //return text; 40 | return ''; 41 | }, 42 | 43 | link: function (isImage, href, title, text) { 44 | return exports.inlineFmt.autolink(href, text || title); 45 | }, 46 | 47 | url: function (href, text) { 48 | return exports.inlineFmt.autolink(href, text); 49 | }, 50 | 51 | strong: function (text) { 52 | return text.bold; 53 | }, 54 | 55 | em: function (text) { 56 | return text.bold.underline; 57 | }, 58 | 59 | code: function (text) { 60 | return text.grey; 61 | }, 62 | 63 | br: function () { 64 | return '\n'; 65 | }, 66 | 67 | text: function (text) { 68 | return text; 69 | } 70 | }; 71 | 72 | function fixWhitespace (body) { 73 | body = body 74 | .replace(/\n/g, ' ') 75 | .replace(/[\s]+/g, ' '); 76 | body = _s.trim(body); 77 | return body; 78 | } 79 | 80 | function colorizeLines (body, c) { 81 | return body.split('\n').map(function (item) { return item[c]; }).join('\n'); 82 | } 83 | 84 | exports.fmt = { 85 | hr: function () { 86 | var line = (function () { 87 | return ' ' + new Array(width - 2).join(process.platform == "win32" ? "-":"⎽"); 88 | }()); 89 | return line + '\n\n'; 90 | }, 91 | 92 | heading: function (depth, text) { 93 | text = fixWhitespace(text); 94 | switch (depth) { 95 | case 1: return wrap(text.bold.blue.underline) + '\n\n'; 96 | case 2: return wrap(text.bold.underline) + '\n\n'; 97 | default: return wrap(text.bold) + '\n\n'; 98 | } 99 | }, 100 | 101 | code: function (lang, text) { 102 | // we do have to colorize twice here because after indenting some new lines 103 | // may have been made so we'll have to colorize those lines as well 104 | text = indent(colorizeLines(text, 'grey')); 105 | return colorizeLines(text, 'grey') + '\n\n'; 106 | }, 107 | 108 | blockquote: function (body) { 109 | body = fixWhitespace(body); 110 | return indent(body).grey + '\n\n'; 111 | }, 112 | 113 | list: function (type, body) { 114 | return body + '\n\n'; 115 | }, 116 | 117 | listItem: function (body) { 118 | body = fixWhitespace(body); 119 | return indent(body.replace(/\n/g, ' ')).replace(' ', ' * ') + '\n'; 120 | }, 121 | 122 | paragraph: function (body) { 123 | body = body 124 | .replace(/\n/g, ' ') 125 | .replace(/[\s]+/g, ' '); 126 | 127 | body = _s.trim(body); 128 | return paragraph(body.replace(/\n/g, ' ').replace(/[\s]+/g, ' ')) + '\n\n'; 129 | } 130 | }; 131 | -------------------------------------------------------------------------------- /deps/marked/man/marked.1: -------------------------------------------------------------------------------- 1 | .ds q \N'34' 2 | .TH marked 1 3 | .SH NAME 4 | marked \- a javascript markdown parser 5 | .SH SYNOPSIS 6 | .nf 7 | .B marked [\-o output] [\-i input] [\-th] 8 | .fi 9 | .SH DESCRIPTION 10 | .B marked 11 | is a full-featured javascript markdown parser, built for speed. It also includes 12 | multiple GFM features. 13 | .SH OPTIONS 14 | .TP 15 | .BI \-o,\ \-\-output\ [output] 16 | Specify file output. If none is specified, write to stdout. 17 | .TP 18 | .BI \-i,\ \-\-input\ [input] 19 | Specify file input, otherwise use last argument as input file. If no input file 20 | is specified, read from stdin. 21 | .TP 22 | .BI \-t,\ \-\-tokens 23 | Output a token stream instead of html. 24 | .TP 25 | .BI \-\-pedantic 26 | Conform to obscure parts of markdown.pl as much as possible. Don't fix original 27 | markdown bugs. 28 | .TP 29 | .BI \-\-gfm 30 | Enable github flavored markdown. 31 | .TP 32 | .BI \-\-sanitize 33 | Sanitize output. Ignore any HTML input. 34 | .TP 35 | .BI \-h,\ \-\-help 36 | Display help information. 37 | .SH EXAMPLES 38 | .TP 39 | cat in.md | marked > out.html 40 | .TP 41 | echo "hello *world*" | marked 42 | .TP 43 | marked -o out.html in.md 44 | .TP 45 | marked --output="hello world.html" -i in.md 46 | .SH BUGS 47 | Please report any bugs to https://github.com/chjj/marked. 48 | .SH LICENSE 49 | Copyright (c) 2011-2012, Christopher Jeffrey (MIT License) 50 | -------------------------------------------------------------------------------- /deps/marked/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "marked", 3 | "description": "A markdown parser built for speed", 4 | "author": "Christopher Jeffrey", 5 | "version": "0.2.5", 6 | "main": "./lib/marked.js", 7 | "bin": "./bin/marked", 8 | "man": "./man/marked.1", 9 | "preferGlobal": false, 10 | "repository": "git://github.com/chjj/marked.git", 11 | "homepage": "https://github.com/chjj/marked", 12 | "bugs": { "url": "http://github.com/chjj/marked/issues" }, 13 | "keywords": [ "markdown", "markup", "html" ], 14 | "tags": [ "markdown", "markup", "html" ] 15 | } 16 | -------------------------------------------------------------------------------- /deps/marked/test/README: -------------------------------------------------------------------------------- 1 | In this directory: 2 | 3 | # 4 | # MarkdownTester -- Run tests for Markdown implementations 5 | # 6 | # Copyright (c) 2004-2005 John Gruber 7 | #testing...
4 | 5 | 6 | -------------------------------------------------------------------------------- /deps/marked/test/browser/index.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | var main = require('../') 4 | , load = main.load; 5 | 6 | var express = require('express') 7 | , app = express.createServer(); 8 | 9 | app.use(function(req, res, next) { 10 | var setHeader = res.setHeader; 11 | res.setHeader = function(name) { 12 | switch (name) { 13 | case 'Cache-Control': 14 | case 'Last-Modified': 15 | case 'ETag': 16 | return; 17 | } 18 | return setHeader.apply(res, arguments); 19 | }; 20 | next(); 21 | }); 22 | 23 | var dir = __dirname + '/../tests' 24 | , files = {}; 25 | 26 | app.get('/test.js', function(req, res, next) { 27 | var test = fs.readFileSync(__dirname + '/test.js', 'utf8') 28 | , files = load(); 29 | 30 | test = test.replace('__TESTS__', JSON.stringify(files)); 31 | test = test.replace('__MAIN__', main + ''); 32 | 33 | res.contentType('.js'); 34 | res.send(test); 35 | }); 36 | 37 | app.use(express.static(__dirname + '/../../lib')); 38 | app.use(express.static(__dirname)); 39 | 40 | app.listen(8080); 41 | -------------------------------------------------------------------------------- /deps/marked/test/browser/test.js: -------------------------------------------------------------------------------- 1 | ;(function() { 2 | 3 | var files = __TESTS__; 4 | 5 | var BREAK_ON_ERROR = false; 6 | 7 | var print = function(text) { 8 | var args = Array.prototype.slice.call(arguments, 1) 9 | , i = 0; 10 | 11 | text = text.replace(/%\w/g, function() { 12 | return args[i++] || ''; 13 | }); 14 | 15 | if (window.console) window.console.log(text); 16 | document.body.innerHTML += '' + escape(text) + ''; 17 | }; 18 | 19 | var console = { log: print }; 20 | 21 | var load = function() {}; 22 | 23 | Object.keys = Object.keys || function(obj) { 24 | var out = [] 25 | , key; 26 | 27 | for (key in obj) { 28 | if (Object.prototype.hasOwnProperty.call(obj, key)) { 29 | out.push(key); 30 | } 31 | } 32 | 33 | return out; 34 | }; 35 | 36 | String.prototype.trim = String.prototype.trim || function() { 37 | return this.replace(/^\s+|\s+$/g, ''); 38 | }; 39 | 40 | var escape = function(html, encode) { 41 | return html 42 | .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') 43 | .replace(//g, '>') 45 | .replace(/"/g, '"') 46 | .replace(/'/g, '''); 47 | }; 48 | 49 | var main = __MAIN__; 50 | 51 | main(); 52 | 53 | }).call(this); 54 | -------------------------------------------------------------------------------- /deps/marked/test/fix: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd $(dirname "$0") 4 | 5 | cat README 6 | 7 | rm -rf tests 8 | cp -r original tests 9 | 10 | node fix.js 11 | 12 | cp new/* -t tests 13 | -------------------------------------------------------------------------------- /deps/marked/test/fix.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Markdown Test Suite Fixer 3 | */ 4 | 5 | // this file is responsible for "fixing" 6 | // the markdown test suite. there are 7 | // certain aspects of the suite that 8 | // are strange or will make my tests 9 | // fail for reasons unrelated to 10 | // conformance. 11 | 12 | var path = require('path') 13 | , fs = require('fs') 14 | , dir = __dirname + '/tests'; 15 | 16 | // fix unencoded quotes 17 | fs.readdirSync(dir).filter(function(file) { 18 | return path.extname(file) === '.html'; 19 | }).forEach(function(file) { 20 | var file = path.join(dir, file) 21 | , html = fs.readFileSync(file, 'utf8'); 22 | 23 | html = html 24 | .replace(/='([^\n']*)'(?=[^<>\n]*>)/g, '=&__APOS__;$1&__APOS__;') 25 | .replace(/="([^\n"]*)"(?=[^<>\n]*>)/g, '=&__QUOT__;$1&__QUOT__;') 26 | .replace(/"/g, '"') 27 | .replace(/'/g, ''') 28 | .replace(/&__QUOT__;/g, '"') 29 | .replace(/&__APOS__;/g, '\''); 30 | 31 | fs.writeFileSync(file, html); 32 | }); 33 | 34 | // turn
This fails in markdown.pl and upskirt:
2 | 3 |world
>
2 | -------------------------------------------------------------------------------- /deps/marked/test/new/escaped_angles.text: -------------------------------------------------------------------------------- 1 | \> 2 | -------------------------------------------------------------------------------- /deps/marked/test/new/gfm_break.html: -------------------------------------------------------------------------------- 1 |Look at the
pretty line
breaks.
var a = 'hello';
2 | console.log(a + ' world');
3 |
4 |
--------------------------------------------------------------------------------
/deps/marked/test/new/gfm_code.text:
--------------------------------------------------------------------------------
1 | ``` js
2 | var a = 'hello';
3 | console.log(a + ' world');
4 | ```
5 |
--------------------------------------------------------------------------------
/deps/marked/test/new/gfm_em.html:
--------------------------------------------------------------------------------
1 | These words should_not_be_emphasized.
2 | -------------------------------------------------------------------------------- /deps/marked/test/new/gfm_em.text: -------------------------------------------------------------------------------- 1 | These words should_not_be_emphasized. 2 | -------------------------------------------------------------------------------- /deps/marked/test/new/gfm_links.html: -------------------------------------------------------------------------------- 1 |This should be a link: 2 | http://example.com/hello-world.
3 | -------------------------------------------------------------------------------- /deps/marked/test/new/gfm_links.text: -------------------------------------------------------------------------------- 1 | This should be a link: http://example.com/hello-world. 2 | -------------------------------------------------------------------------------- /deps/marked/test/new/hr_list_break.html: -------------------------------------------------------------------------------- 1 |you today?
11 | -------------------------------------------------------------------------------- /deps/marked/test/new/hr_list_break.text: -------------------------------------------------------------------------------- 1 | * hello 2 | world 3 | * how 4 | are 5 | * * * 6 | you today? 7 | -------------------------------------------------------------------------------- /deps/marked/test/new/lazy_blockquotes.html: -------------------------------------------------------------------------------- 1 |2 |5 | -------------------------------------------------------------------------------- /deps/marked/test/new/lazy_blockquotes.text: -------------------------------------------------------------------------------- 1 | > hi there 2 | bud 3 | -------------------------------------------------------------------------------- /deps/marked/test/new/list_item_text.html: -------------------------------------------------------------------------------- 1 |hi there 3 | bud
4 |
item1
text
hello 3 | world
4 | 5 |how 6 | are
better behavior:
13 | 14 |hello
world 15 | how
are 16 | you
today
hello
world
world
hi
world
39 | 40 |how
how
50 | 51 |are
world
how
60 | 61 |are
Just a note, I've found that I can't test my markdown parser vs others. For example, both markdown.js and showdown code blocks in lists wrong. They're also completely inconsistent with regards to paragraphs in list items.
A link. Not anymore.
List Item 1
List Item 2
Code goes here.
3 | Lots of it...
List Item 3 The final item.
List Item 4 The real final item.
Paragraph.
- bq Item 1
- bq Item 2
- New bq Item 1
- New bq Item 2 Text here
Another blockquote! I really need to get more creative with mockup text.. markdown.js breaks here again
Hello world. Here is a link. And an image .
Code goes here.
4 | Lots of it...
5 |
--------------------------------------------------------------------------------
/deps/marked/test/new/main.text:
--------------------------------------------------------------------------------
1 | [test]: http://google.com/ "Google"
2 |
3 | # A heading
4 |
5 | Just a note, I've found that I can't test my markdown parser vs others.
6 | For example, both markdown.js and showdown code blocks in lists wrong. They're
7 | also completely [inconsistent][test] with regards to paragraphs in list items.
8 |
9 | A link. Not anymore.
10 |
11 |
13 |
14 | * List Item 1
15 |
16 | * List Item 2
17 | * New List Item 1
18 | Hi, this is a list item.
19 | * New List Item 2
20 | Another item
21 | Code goes here.
22 | Lots of it...
23 | * New List Item 3
24 | The last item
25 |
26 | * List Item 3
27 | The final item.
28 |
29 | * List Item 4
30 | The real final item.
31 |
32 | Paragraph.
33 |
34 | > * bq Item 1
35 | > * bq Item 2
36 | > * New bq Item 1
37 | > * New bq Item 2
38 | > Text here
39 |
40 | * * *
41 |
42 | > Another blockquote!
43 | > I really need to get
44 | > more creative with
45 | > mockup text..
46 | > markdown.js breaks here again
47 |
48 | Another Heading
49 | -------------
50 |
51 | Hello *world*. Here is a [link](//hello).
52 | And an image .
53 |
54 | Code goes here.
55 | Lots of it...
56 |
--------------------------------------------------------------------------------
/deps/marked/test/new/nested_code.html:
--------------------------------------------------------------------------------
1 | hi ther `` ok ```
test test test
2 | 3 |test test test
4 | -------------------------------------------------------------------------------- /deps/marked/test/new/nested_em.text: -------------------------------------------------------------------------------- 1 | *test **test** test* 2 | 3 | _test __test__ test_ 4 | -------------------------------------------------------------------------------- /deps/marked/test/new/nested_square_link.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /deps/marked/test/new/nested_square_link.text: -------------------------------------------------------------------------------- 1 | [the `]` character](/url) 2 | -------------------------------------------------------------------------------- /deps/marked/test/new/not_a_link.html: -------------------------------------------------------------------------------- 1 |\[test](not a link)
2 | -------------------------------------------------------------------------------- /deps/marked/test/new/not_a_link.text: -------------------------------------------------------------------------------- 1 | \\[test](not a link) 2 | -------------------------------------------------------------------------------- /deps/marked/test/new/ref_paren.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /deps/marked/test/new/ref_paren.text: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [hi]: /url (there) 4 | -------------------------------------------------------------------------------- /deps/marked/test/new/same_bullet.html: -------------------------------------------------------------------------------- 1 |hello world 2 | how are you 3 | how are you
4 | 5 |hello world
6 |how are you
7 |
8 | hello world
9 |hello world
12 |hello world
15 |hello world
18 |19 | 20 |how are you
hello world 21 | * how are you
22 | 23 |hello world
24 |hello world 27 | how are you
28 | 29 |hello world 30 |
31 | 32 |hello
35 | -------------------------------------------------------------------------------- /deps/marked/test/new/toplevel_paragraphs.text: -------------------------------------------------------------------------------- 1 | hello world 2 | how are you 3 | how are you 4 | 5 | hello world 6 | ``` 7 | how are you 8 | ``` 9 | 10 | hello world 11 | * * * 12 | 13 | hello world 14 | # how are you 15 | 16 | hello world 17 | how are you 18 | =========== 19 | 20 | hello world 21 | > how are you 22 | 23 | hello world 24 | * how are you 25 | 26 | hello world 27 |hello world
2 | 3 |hello world
8 | 9 |hello world
14 | 15 |hello world
20 | 21 |AT&T has an ampersand in their name.
2 | 3 |AT&T is another way to write it.
4 | 5 |This & that.
6 | 7 |4 < 5.
8 | 9 |6 > 5.
10 | 11 |Here's a link with an ampersand in the URL.
12 | 13 |Here's a link with an amersand in the link text: AT&T.
14 | 15 |Here's an inline link.
16 | 17 |Here's an inline link.
18 | -------------------------------------------------------------------------------- /deps/marked/test/original/amps_and_angles_encoding.text: -------------------------------------------------------------------------------- 1 | AT&T has an ampersand in their name. 2 | 3 | AT&T is another way to write it. 4 | 5 | This & that. 6 | 7 | 4 < 5. 8 | 9 | 6 > 5. 10 | 11 | Here's a [link] [1] with an ampersand in the URL. 12 | 13 | Here's a link with an amersand in the link text: [AT&T] [2]. 14 | 15 | Here's an inline [link](/script?foo=1&bar=2). 16 | 17 | Here's an inline [link](). 18 | 19 | 20 | [1]: http://example.com/?foo=1&bar=2 21 | [2]: http://att.com/ "AT&T" 22 | -------------------------------------------------------------------------------- /deps/marked/test/original/auto_links.html: -------------------------------------------------------------------------------- 1 |Link: http://example.com/.
2 | 3 |With an ampersand: http://example.com/?foo=1&bar=2
4 | 5 |12 |14 | 15 |Blockquoted: http://example.com/
13 |
Auto-links should not occur here: <http://example.com/>
or here: <http://example.com/>
18 |
19 |
--------------------------------------------------------------------------------
/deps/marked/test/original/auto_links.text:
--------------------------------------------------------------------------------
1 | Link: These should all get escaped:
2 | 3 |Backslash: \
4 | 5 |Backtick: `
6 | 7 |Asterisk: *
8 | 9 |Underscore: _
10 | 11 |Left brace: {
12 | 13 |Right brace: }
14 | 15 |Left bracket: [
16 | 17 |Right bracket: ]
18 | 19 |Left paren: (
20 | 21 |Right paren: )
22 | 23 |Greater-than: >
24 | 25 |Hash: #
26 | 27 |Period: .
28 | 29 |Bang: !
30 | 31 |Plus: +
32 | 33 |Minus: -
34 | 35 |These should not, because they occur within a code block:
36 | 37 |Backslash: \\
38 |
39 | Backtick: \`
40 |
41 | Asterisk: \*
42 |
43 | Underscore: \_
44 |
45 | Left brace: \{
46 |
47 | Right brace: \}
48 |
49 | Left bracket: \[
50 |
51 | Right bracket: \]
52 |
53 | Left paren: \(
54 |
55 | Right paren: \)
56 |
57 | Greater-than: \>
58 |
59 | Hash: \#
60 |
61 | Period: \.
62 |
63 | Bang: \!
64 |
65 | Plus: \+
66 |
67 | Minus: \-
68 |
69 |
70 | Nor should these, which occur in code spans:
71 | 72 |Backslash: \\
Backtick: \`
Asterisk: \*
Underscore: \_
Left brace: \{
Right brace: \}
Left bracket: \[
Right bracket: \]
Left paren: \(
Right paren: \)
Greater-than: \>
Hash: \#
Period: \.
Bang: \!
Plus: \+
Minus: \-
These should get escaped, even though they're matching pairs for 106 | other Markdown constructs:
107 | 108 |*asterisks*
109 | 110 |_underscores_
111 | 112 |`backticks`
113 | 114 |This is a code span with a literal backslash-backtick sequence: \`
This is a tag with unescaped backticks bar.
117 | 118 |This is a tag with backslashes bar.
119 | -------------------------------------------------------------------------------- /deps/marked/test/original/backslash_escapes.text: -------------------------------------------------------------------------------- 1 | These should all get escaped: 2 | 3 | Backslash: \\ 4 | 5 | Backtick: \` 6 | 7 | Asterisk: \* 8 | 9 | Underscore: \_ 10 | 11 | Left brace: \{ 12 | 13 | Right brace: \} 14 | 15 | Left bracket: \[ 16 | 17 | Right bracket: \] 18 | 19 | Left paren: \( 20 | 21 | Right paren: \) 22 | 23 | Greater-than: \> 24 | 25 | Hash: \# 26 | 27 | Period: \. 28 | 29 | Bang: \! 30 | 31 | Plus: \+ 32 | 33 | Minus: \- 34 | 35 | 36 | 37 | These should not, because they occur within a code block: 38 | 39 | Backslash: \\ 40 | 41 | Backtick: \` 42 | 43 | Asterisk: \* 44 | 45 | Underscore: \_ 46 | 47 | Left brace: \{ 48 | 49 | Right brace: \} 50 | 51 | Left bracket: \[ 52 | 53 | Right bracket: \] 54 | 55 | Left paren: \( 56 | 57 | Right paren: \) 58 | 59 | Greater-than: \> 60 | 61 | Hash: \# 62 | 63 | Period: \. 64 | 65 | Bang: \! 66 | 67 | Plus: \+ 68 | 69 | Minus: \- 70 | 71 | 72 | Nor should these, which occur in code spans: 73 | 74 | Backslash: `\\` 75 | 76 | Backtick: `` \` `` 77 | 78 | Asterisk: `\*` 79 | 80 | Underscore: `\_` 81 | 82 | Left brace: `\{` 83 | 84 | Right brace: `\}` 85 | 86 | Left bracket: `\[` 87 | 88 | Right bracket: `\]` 89 | 90 | Left paren: `\(` 91 | 92 | Right paren: `\)` 93 | 94 | Greater-than: `\>` 95 | 96 | Hash: `\#` 97 | 98 | Period: `\.` 99 | 100 | Bang: `\!` 101 | 102 | Plus: `\+` 103 | 104 | Minus: `\-` 105 | 106 | 107 | These should get escaped, even though they're matching pairs for 108 | other Markdown constructs: 109 | 110 | \*asterisks\* 111 | 112 | \_underscores\_ 113 | 114 | \`backticks\` 115 | 116 | This is a code span with a literal backslash-backtick sequence: `` \` `` 117 | 118 | This is a tag with unescaped backticks bar. 119 | 120 | This is a tag with backslashes bar. 121 | -------------------------------------------------------------------------------- /deps/marked/test/original/blockquotes_with_code_blocks.html: -------------------------------------------------------------------------------- 1 |2 |16 | -------------------------------------------------------------------------------- /deps/marked/test/original/blockquotes_with_code_blocks.text: -------------------------------------------------------------------------------- 1 | > Example: 2 | > 3 | > sub status { 4 | > print "working"; 5 | > } 6 | > 7 | > Or: 8 | > 9 | > sub status { 10 | > return "working"; 11 | > } 12 | -------------------------------------------------------------------------------- /deps/marked/test/original/code_blocks.html: -------------------------------------------------------------------------------- 1 |Example:
3 | 4 |8 | 9 |sub status { 5 | print "working"; 6 | } 7 |
Or:
10 | 11 |15 |sub status { 12 | return "working"; 13 | } 14 |
code block on the first line
2 |
3 |
4 | Regular text.
5 | 6 |code block indented by spaces
7 |
8 |
9 | Regular text.
10 | 11 |the lines in this block
12 | all contain trailing spaces
13 |
14 |
15 | Regular Text.
16 | 17 |code block on the last line
18 |
19 |
--------------------------------------------------------------------------------
/deps/marked/test/original/code_blocks.text:
--------------------------------------------------------------------------------
1 | code block on the first line
2 |
3 | Regular text.
4 |
5 | code block indented by spaces
6 |
7 | Regular text.
8 |
9 | the lines in this block
10 | all contain trailing spaces
11 |
12 | Regular Text.
13 |
14 | code block on the last line
15 |
--------------------------------------------------------------------------------
/deps/marked/test/original/code_spans.html:
--------------------------------------------------------------------------------
1 | <test a="
content of attribute ">
Fix for backticks within HTML tag: like this
4 | 5 |Here's how you put `backticks`
in a code span.
In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item.
6 | 7 |Here's one with a bullet. 8 | * criminey.
9 | -------------------------------------------------------------------------------- /deps/marked/test/original/hard_wrapped_paragraphs_with_list_like_lines.text: -------------------------------------------------------------------------------- 1 | In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item. 6 | 7 | Here's one with a bullet. 8 | * criminey. 9 | -------------------------------------------------------------------------------- /deps/marked/test/original/horizontal_rules.html: -------------------------------------------------------------------------------- 1 |Dashes:
2 | 3 |---
12 |
13 |
14 | - - -
23 |
24 |
25 | Asterisks:
26 | 27 |***
36 |
37 |
38 | * * *
47 |
48 |
49 | Underscores:
50 | 51 |___
60 |
61 |
62 | _ _ _
71 |
72 |
--------------------------------------------------------------------------------
/deps/marked/test/original/horizontal_rules.text:
--------------------------------------------------------------------------------
1 | Dashes:
2 |
3 | ---
4 |
5 | ---
6 |
7 | ---
8 |
9 | ---
10 |
11 | ---
12 |
13 | - - -
14 |
15 | - - -
16 |
17 | - - -
18 |
19 | - - -
20 |
21 | - - -
22 |
23 |
24 | Asterisks:
25 |
26 | ***
27 |
28 | ***
29 |
30 | ***
31 |
32 | ***
33 |
34 | ***
35 |
36 | * * *
37 |
38 | * * *
39 |
40 | * * *
41 |
42 | * * *
43 |
44 | * * *
45 |
46 |
47 | Underscores:
48 |
49 | ___
50 |
51 | ___
52 |
53 | ___
54 |
55 | ___
56 |
57 | ___
58 |
59 | _ _ _
60 |
61 | _ _ _
62 |
63 | _ _ _
64 |
65 | _ _ _
66 |
67 | _ _ _
68 |
--------------------------------------------------------------------------------
/deps/marked/test/original/inline_html_advanced.html:
--------------------------------------------------------------------------------
1 | Simple block on one line:
2 | 3 |And nested without indentation:
6 | 7 |Paragraph one.
2 | 3 | 4 | 5 | 8 | 9 |Paragraph two.
10 | 11 | 12 | 13 |The end.
14 | -------------------------------------------------------------------------------- /deps/marked/test/original/inline_html_comments.text: -------------------------------------------------------------------------------- 1 | Paragraph one. 2 | 3 | 4 | 5 | 8 | 9 | Paragraph two. 10 | 11 | 12 | 13 | The end. 14 | -------------------------------------------------------------------------------- /deps/marked/test/original/inline_html_simple.html: -------------------------------------------------------------------------------- 1 |Here's a simple block:
2 | 3 |This should be a code block, though:
8 | 9 |<div>
10 | foo
11 | </div>
12 |
13 |
14 | As should this:
15 | 16 |<div>foo</div>
17 |
18 |
19 | Now, nested:
20 | 21 |This should just be an HTML comment:
30 | 31 | 32 | 33 |Multiline:
34 | 35 | 39 | 40 |Code block:
41 | 42 |<!-- Comment -->
43 |
44 |
45 | Just plain comment, with trailing spaces on the line:
46 | 47 | 48 | 49 |Code:
50 | 51 |<hr />
52 |
53 |
54 | Hr's:
55 | 56 |Just a URL.
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /deps/marked/test/original/links_inline_style.text: -------------------------------------------------------------------------------- 1 | Just a [URL](/url/). 2 | 3 | [URL and title](/url/ "title"). 4 | 5 | [URL and title](/url/ "title preceded by two spaces"). 6 | 7 | [URL and title](/url/ "title preceded by a tab"). 8 | 9 | [URL and title](/url/ "title has spaces afterward" ). 10 | 11 | 12 | [Empty](). 13 | -------------------------------------------------------------------------------- /deps/marked/test/original/links_reference_style.html: -------------------------------------------------------------------------------- 1 |Foo bar.
2 | 3 |Foo bar.
4 | 5 |Foo bar.
6 | 7 |With embedded [brackets].
8 | 9 |Indented once.
10 | 11 |Indented twice.
12 | 13 |Indented thrice.
14 | 15 |Indented [four][] times.
16 | 17 |[four]: /url
18 |
19 |
20 | this should work
23 | 24 |So should this.
25 | 26 |And this.
27 | 28 |And this.
29 | 30 |And this.
31 | 32 |But not [that] [].
33 | 34 |Nor [that][].
35 | 36 |Nor [that].
37 | 38 |[Something in brackets like this should work]
39 | 40 |[Same with this.]
41 | 42 |In this case, this points to something else.
43 | 44 |Backslashing should suppress [this] and [this].
45 | 46 |Here's one where the link 49 | breaks across lines.
50 | 51 |Here's another where the link 52 | breaks across lines, but with a line-ending space.
53 | -------------------------------------------------------------------------------- /deps/marked/test/original/links_reference_style.text: -------------------------------------------------------------------------------- 1 | Foo [bar] [1]. 2 | 3 | Foo [bar][1]. 4 | 5 | Foo [bar] 6 | [1]. 7 | 8 | [1]: /url/ "Title" 9 | 10 | 11 | With [embedded [brackets]] [b]. 12 | 13 | 14 | Indented [once][]. 15 | 16 | Indented [twice][]. 17 | 18 | Indented [thrice][]. 19 | 20 | Indented [four][] times. 21 | 22 | [once]: /url 23 | 24 | [twice]: /url 25 | 26 | [thrice]: /url 27 | 28 | [four]: /url 29 | 30 | 31 | [b]: /url/ 32 | 33 | * * * 34 | 35 | [this] [this] should work 36 | 37 | So should [this][this]. 38 | 39 | And [this] []. 40 | 41 | And [this][]. 42 | 43 | And [this]. 44 | 45 | But not [that] []. 46 | 47 | Nor [that][]. 48 | 49 | Nor [that]. 50 | 51 | [Something in brackets like [this][] should work] 52 | 53 | [Same with [this].] 54 | 55 | In this case, [this](/somethingelse/) points to something else. 56 | 57 | Backslashing should suppress \[this] and [this\]. 58 | 59 | [this]: foo 60 | 61 | 62 | * * * 63 | 64 | Here's one where the [link 65 | breaks] across lines. 66 | 67 | Here's another where the [link 68 | breaks] across lines, but with a line-ending space. 69 | 70 | 71 | [link breaks]: /url/ 72 | -------------------------------------------------------------------------------- /deps/marked/test/original/links_shortcut_references.html: -------------------------------------------------------------------------------- 1 |This is the simple case.
2 | 3 |This one has a line 4 | break.
5 | 6 |This one has a line 7 | break with a line-ending space.
8 | 9 | 10 | -------------------------------------------------------------------------------- /deps/marked/test/original/links_shortcut_references.text: -------------------------------------------------------------------------------- 1 | This is the [simple case]. 2 | 3 | [simple case]: /simple 4 | 5 | 6 | 7 | This one has a [line 8 | break]. 9 | 10 | This one has a [line 11 | break] with a line-ending space. 12 | 13 | [line break]: /foo 14 | 15 | 16 | [this] [that] and the [other] 17 | 18 | [this]: /this 19 | [that]: /that 20 | [other]: /other 21 | -------------------------------------------------------------------------------- /deps/marked/test/original/literal_quotes_in_titles.html: -------------------------------------------------------------------------------- 1 |Foo bar.
2 | 3 |Foo bar.
4 | -------------------------------------------------------------------------------- /deps/marked/test/original/literal_quotes_in_titles.text: -------------------------------------------------------------------------------- 1 | Foo [bar][]. 2 | 3 | Foo [bar](/url/ "Title with "quotes" inside"). 4 | 5 | 6 | [bar]: /url/ "Title with "quotes" inside" 7 | 8 | -------------------------------------------------------------------------------- /deps/marked/test/original/markdown_documentation_basics.html: -------------------------------------------------------------------------------- 1 |This page offers a brief overview of what it's like to use Markdown. 14 | The syntax page provides complete, detailed documentation for 15 | every feature, but Markdown should be very easy to pick up simply by 16 | looking at a few examples of it in action. The examples on this page 17 | are written in a before/after style, showing example syntax and the 18 | HTML output produced by Markdown.
19 | 20 |It's also helpful to simply try Markdown out; the Dingus is a 21 | web application that allows you type your own Markdown-formatted text 22 | and translate it to XHTML.
23 | 24 |Note: This document is itself written using Markdown; you 25 | can see the source for it by adding '.text' to the URL.
26 | 27 |A paragraph is simply one or more consecutive lines of text, separated 30 | by one or more blank lines. (A blank line is any line that looks like a 31 | blank line -- a line containing nothing spaces or tabs is considered 32 | blank.) Normal paragraphs should not be intended with spaces or tabs.
33 | 34 |Markdown offers two styles of headers: Setext and atx.
35 | Setext-style headers for <h1>
and <h2>
are created by
36 | "underlining" with equal signs (=
) and hyphens (-
), respectively.
37 | To create an atx-style header, you put 1-6 hash marks (#
) at the
38 | beginning of the line -- the number of hashes equals the resulting
39 | HTML header level.
Blockquotes are indicated using email-style '>
' angle brackets.
Markdown:
44 | 45 |A First Level Header
46 | ====================
47 |
48 | A Second Level Header
49 | ---------------------
50 |
51 | Now is the time for all good men to come to
52 | the aid of their country. This is just a
53 | regular paragraph.
54 |
55 | The quick brown fox jumped over the lazy
56 | dog's back.
57 |
58 | ### Header 3
59 |
60 | > This is a blockquote.
61 | >
62 | > This is the second paragraph in the blockquote.
63 | >
64 | > ## This is an H2 in a blockquote
65 |
66 |
67 | Output:
68 | 69 |<h1>A First Level Header</h1>
70 |
71 | <h2>A Second Level Header</h2>
72 |
73 | <p>Now is the time for all good men to come to
74 | the aid of their country. This is just a
75 | regular paragraph.</p>
76 |
77 | <p>The quick brown fox jumped over the lazy
78 | dog's back.</p>
79 |
80 | <h3>Header 3</h3>
81 |
82 | <blockquote>
83 | <p>This is a blockquote.</p>
84 |
85 | <p>This is the second paragraph in the blockquote.</p>
86 |
87 | <h2>This is an H2 in a blockquote</h2>
88 | </blockquote>
89 |
90 |
91 | Markdown uses asterisks and underscores to indicate spans of emphasis.
94 | 95 |Markdown:
96 | 97 |Some of these words *are emphasized*.
98 | Some of these words _are emphasized also_.
99 |
100 | Use two asterisks for **strong emphasis**.
101 | Or, if you prefer, __use two underscores instead__.
102 |
103 |
104 | Output:
105 | 106 |<p>Some of these words <em>are emphasized</em>.
107 | Some of these words <em>are emphasized also</em>.</p>
108 |
109 | <p>Use two asterisks for <strong>strong emphasis</strong>.
110 | Or, if you prefer, <strong>use two underscores instead</strong>.</p>
111 |
112 |
113 | Unordered (bulleted) lists use asterisks, pluses, and hyphens (*
,
116 | +
, and -
) as list markers. These three markers are
117 | interchangable; this:
* Candy.
120 | * Gum.
121 | * Booze.
122 |
123 |
124 | this:
125 | 126 |+ Candy.
127 | + Gum.
128 | + Booze.
129 |
130 |
131 | and this:
132 | 133 |- Candy.
134 | - Gum.
135 | - Booze.
136 |
137 |
138 | all produce the same output:
139 | 140 |<ul>
141 | <li>Candy.</li>
142 | <li>Gum.</li>
143 | <li>Booze.</li>
144 | </ul>
145 |
146 |
147 | Ordered (numbered) lists use regular numbers, followed by periods, as 148 | list markers:
149 | 150 |1. Red
151 | 2. Green
152 | 3. Blue
153 |
154 |
155 | Output:
156 | 157 |<ol>
158 | <li>Red</li>
159 | <li>Green</li>
160 | <li>Blue</li>
161 | </ol>
162 |
163 |
164 | If you put blank lines between items, you'll get <p>
tags for the
165 | list item text. You can create multi-paragraph list items by indenting
166 | the paragraphs by 4 spaces or 1 tab:
* A list item.
169 |
170 | With multiple paragraphs.
171 |
172 | * Another item in the list.
173 |
174 |
175 | Output:
176 | 177 |<ul>
178 | <li><p>A list item.</p>
179 | <p>With multiple paragraphs.</p></li>
180 | <li><p>Another item in the list.</p></li>
181 | </ul>
182 |
183 |
184 | Markdown supports two styles for creating links: inline and 187 | reference. With both styles, you use square brackets to delimit the 188 | text you want to turn into a link.
189 | 190 |Inline-style links use parentheses immediately after the link text. 191 | For example:
192 | 193 |This is an [example link](http://example.com/).
194 |
195 |
196 | Output:
197 | 198 |<p>This is an <a href="http://example.com/">
199 | example link</a>.</p>
200 |
201 |
202 | Optionally, you may include a title attribute in the parentheses:
203 | 204 |This is an [example link](http://example.com/ "With a Title").
205 |
206 |
207 | Output:
208 | 209 |<p>This is an <a href="http://example.com/" title="With a Title">
210 | example link</a>.</p>
211 |
212 |
213 | Reference-style links allow you to refer to your links by names, which 214 | you define elsewhere in your document:
215 | 216 |I get 10 times more traffic from [Google][1] than from
217 | [Yahoo][2] or [MSN][3].
218 |
219 | [1]: http://google.com/ "Google"
220 | [2]: http://search.yahoo.com/ "Yahoo Search"
221 | [3]: http://search.msn.com/ "MSN Search"
222 |
223 |
224 | Output:
225 | 226 |<p>I get 10 times more traffic from <a href="http://google.com/"
227 | title="Google">Google</a> than from <a href="http://search.yahoo.com/"
228 | title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
229 | title="MSN Search">MSN</a>.</p>
230 |
231 |
232 | The title attribute is optional. Link names may contain letters, 233 | numbers and spaces, but are not case sensitive:
234 | 235 |I start my morning with a cup of coffee and
236 | [The New York Times][NY Times].
237 |
238 | [ny times]: http://www.nytimes.com/
239 |
240 |
241 | Output:
242 | 243 |<p>I start my morning with a cup of coffee and
244 | <a href="http://www.nytimes.com/">The New York Times</a>.</p>
245 |
246 |
247 | Image syntax is very much like link syntax.
250 | 251 |Inline (titles are optional):
252 | 253 |
254 |
255 |
256 | Reference-style:
257 | 258 |![alt text][id]
259 |
260 | [id]: /path/to/img.jpg "Title"
261 |
262 |
263 | Both of the above examples produce the same output:
264 | 265 |<img src="/path/to/img.jpg" alt="alt text" title="Title" />
266 |
267 |
268 | In a regular paragraph, you can create code span by wrapping text in
271 | backtick quotes. Any ampersands (&
) and angle brackets (<
or
272 | >
) will automatically be translated into HTML entities. This makes
273 | it easy to use Markdown to write about HTML example code:
I strongly recommend against using any `<blink>` tags.
276 |
277 | I wish SmartyPants used named entities like `—`
278 | instead of decimal-encoded entites like `—`.
279 |
280 |
281 | Output:
282 | 283 |<p>I strongly recommend against using any
284 | <code><blink></code> tags.</p>
285 |
286 | <p>I wish SmartyPants used named entities like
287 | <code>&mdash;</code> instead of decimal-encoded
288 | entites like <code>&#8212;</code>.</p>
289 |
290 |
291 | To specify an entire block of pre-formatted code, indent every line of
292 | the block by 4 spaces or 1 tab. Just like with code spans, &
, <
,
293 | and >
characters will be escaped automatically.
Markdown:
296 | 297 |If you want your page to validate under XHTML 1.0 Strict,
298 | you've got to put paragraph tags in your blockquotes:
299 |
300 | <blockquote>
301 | <p>For example.</p>
302 | </blockquote>
303 |
304 |
305 | Output:
306 | 307 |<p>If you want your page to validate under XHTML 1.0 Strict,
308 | you've got to put paragraph tags in your blockquotes:</p>
309 |
310 | <pre><code><blockquote>
311 | <p>For example.</p>
312 | </blockquote>
313 | </code></pre>
314 |
315 |
--------------------------------------------------------------------------------
/deps/marked/test/original/markdown_documentation_basics.text:
--------------------------------------------------------------------------------
1 | Markdown: Basics
2 | ================
3 |
4 |
11 |
12 |
13 | Getting the Gist of Markdown's Formatting Syntax
14 | ------------------------------------------------
15 |
16 | This page offers a brief overview of what it's like to use Markdown.
17 | The [syntax page] [s] provides complete, detailed documentation for
18 | every feature, but Markdown should be very easy to pick up simply by
19 | looking at a few examples of it in action. The examples on this page
20 | are written in a before/after style, showing example syntax and the
21 | HTML output produced by Markdown.
22 |
23 | It's also helpful to simply try Markdown out; the [Dingus] [d] is a
24 | web application that allows you type your own Markdown-formatted text
25 | and translate it to XHTML.
26 |
27 | **Note:** This document is itself written using Markdown; you
28 | can [see the source for it by adding '.text' to the URL] [src].
29 |
30 | [s]: /projects/markdown/syntax "Markdown Syntax"
31 | [d]: /projects/markdown/dingus "Markdown Dingus"
32 | [src]: /projects/markdown/basics.text
33 |
34 |
35 | ## Paragraphs, Headers, Blockquotes ##
36 |
37 | A paragraph is simply one or more consecutive lines of text, separated
38 | by one or more blank lines. (A blank line is any line that looks like a
39 | blank line -- a line containing nothing spaces or tabs is considered
40 | blank.) Normal paragraphs should not be intended with spaces or tabs.
41 |
42 | Markdown offers two styles of headers: *Setext* and *atx*.
43 | Setext-style headers for `Now is the time for all good men to come to 82 | the aid of their country. This is just a 83 | regular paragraph.
84 | 85 |The quick brown fox jumped over the lazy 86 | dog's back.
87 | 88 |91 |97 | 98 | 99 | 100 | ### Phrase Emphasis ### 101 | 102 | Markdown uses asterisks and underscores to indicate spans of emphasis. 103 | 104 | Markdown: 105 | 106 | Some of these words *are emphasized*. 107 | Some of these words _are emphasized also_. 108 | 109 | Use two asterisks for **strong emphasis**. 110 | Or, if you prefer, __use two underscores instead__. 111 | 112 | Output: 113 | 114 |This is a blockquote.
92 | 93 |This is the second paragraph in the blockquote.
94 | 95 |This is an H2 in a blockquote
96 |
Some of these words are emphasized. 115 | Some of these words are emphasized also.
116 | 117 |Use two asterisks for strong emphasis. 118 | Or, if you prefer, use two underscores instead.
119 | 120 | 121 | 122 | ## Lists ## 123 | 124 | Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, 125 | `+`, and `-`) as list markers. These three markers are 126 | interchangable; this: 127 | 128 | * Candy. 129 | * Gum. 130 | * Booze. 131 | 132 | this: 133 | 134 | + Candy. 135 | + Gum. 136 | + Booze. 137 | 138 | and this: 139 | 140 | - Candy. 141 | - Gum. 142 | - Booze. 143 | 144 | all produce the same output: 145 | 146 |` tags for the 168 | list item text. You can create multi-paragraph list items by indenting 169 | the paragraphs by 4 spaces or 1 tab: 170 | 171 | * A list item. 172 | 173 | With multiple paragraphs. 174 | 175 | * Another item in the list. 176 | 177 | Output: 178 | 179 |
A list item.
181 |With multiple paragraphs.
Another item in the list.
This is an 201 | example link.
202 | 203 | Optionally, you may include a title attribute in the parentheses: 204 | 205 | This is an [example link](http://example.com/ "With a Title"). 206 | 207 | Output: 208 | 209 |This is an 210 | example link.
211 | 212 | Reference-style links allow you to refer to your links by names, which 213 | you define elsewhere in your document: 214 | 215 | I get 10 times more traffic from [Google][1] than from 216 | [Yahoo][2] or [MSN][3]. 217 | 218 | [1]: http://google.com/ "Google" 219 | [2]: http://search.yahoo.com/ "Yahoo Search" 220 | [3]: http://search.msn.com/ "MSN Search" 221 | 222 | Output: 223 | 224 |I get 10 times more traffic from Google than from Yahoo or MSN.
228 | 229 | The title attribute is optional. Link names may contain letters, 230 | numbers and spaces, but are *not* case sensitive: 231 | 232 | I start my morning with a cup of coffee and 233 | [The New York Times][NY Times]. 234 | 235 | [ny times]: http://www.nytimes.com/ 236 | 237 | Output: 238 | 239 |I start my morning with a cup of coffee and 240 | The New York Times.
241 | 242 | 243 | ### Images ### 244 | 245 | Image syntax is very much like link syntax. 246 | 247 | Inline (titles are optional): 248 | 249 |  250 | 251 | Reference-style: 252 | 253 | ![alt text][id] 254 | 255 | [id]: /path/to/img.jpg "Title" 256 | 257 | Both of the above examples produce the same output: 258 | 259 |