├── .gitignore ├── 404.html ├── CNAME ├── LICENSE ├── README.md ├── app └── bower_components │ ├── marked │ ├── .bower.json │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── bin │ │ └── marked │ ├── component.json │ ├── doc │ │ ├── broken.md │ │ └── todo.md │ ├── index.js │ ├── lib │ │ └── marked.js │ ├── man │ │ └── marked.1 │ ├── package.json │ └── test │ │ ├── README │ │ ├── browser │ │ ├── index.html │ │ ├── index.js │ │ └── test.js │ │ ├── index.js │ │ ├── new │ │ ├── autolink_lines.html │ │ ├── autolink_lines.text │ │ ├── blockquote_list_item.html │ │ ├── blockquote_list_item.text │ │ ├── case_insensitive_refs.html │ │ ├── case_insensitive_refs.text │ │ ├── def_blocks.html │ │ ├── def_blocks.text │ │ ├── double_link.html │ │ ├── double_link.text │ │ ├── escaped_angles.html │ │ ├── escaped_angles.text │ │ ├── gfm_break.breaks.html │ │ ├── gfm_break.breaks.text │ │ ├── gfm_code.html │ │ ├── gfm_code.text │ │ ├── gfm_code_hr_list.html │ │ ├── gfm_code_hr_list.text │ │ ├── gfm_del.html │ │ ├── gfm_del.text │ │ ├── gfm_em.html │ │ ├── gfm_em.text │ │ ├── gfm_links.html │ │ ├── gfm_links.text │ │ ├── gfm_tables.html │ │ ├── gfm_tables.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 │ │ ├── text.smartypants.html │ │ ├── text.smartypants.text │ │ ├── toplevel_paragraphs.gfm.html │ │ ├── toplevel_paragraphs.gfm.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 │ │ ├── autolink_lines.html │ │ ├── autolink_lines.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 │ │ ├── def_blocks.html │ │ ├── def_blocks.text │ │ ├── double_link.html │ │ ├── double_link.text │ │ ├── escaped_angles.html │ │ ├── escaped_angles.text │ │ ├── gfm_break.breaks.html │ │ ├── gfm_break.breaks.text │ │ ├── gfm_code.html │ │ ├── gfm_code.text │ │ ├── gfm_code_hr_list.html │ │ ├── gfm_code_hr_list.text │ │ ├── gfm_del.html │ │ ├── gfm_del.text │ │ ├── gfm_em.html │ │ ├── gfm_em.text │ │ ├── gfm_links.html │ │ ├── gfm_links.text │ │ ├── gfm_tables.html │ │ ├── gfm_tables.text │ │ ├── hard_wrapped_paragraphs_with_list_like_lines.nogfm.html │ │ ├── hard_wrapped_paragraphs_with_list_like_lines.nogfm.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 │ │ ├── text.smartypants.html │ │ ├── text.smartypants.text │ │ ├── tidyness.html │ │ ├── tidyness.text │ │ ├── toplevel_paragraphs.gfm.html │ │ ├── toplevel_paragraphs.gfm.text │ │ ├── tricky_list.html │ │ └── tricky_list.text │ └── normalize-css │ ├── .bower.json │ ├── LICENSE.md │ ├── README.md │ ├── bower.json │ └── normalize.css ├── config.js ├── css ├── app.css └── normalize.css ├── docs ├── array.md ├── arraybuffer.md ├── async.md ├── class.md ├── decorator.md ├── destructuring.md ├── fp.md ├── function.md ├── generator.md ├── intro.md ├── iterator.md ├── let.md ├── mixin.md ├── module.md ├── number.md ├── object.md ├── promise.md ├── proxy.md ├── reference.md ├── regex.md ├── set-map.md ├── simd.md ├── spec.md ├── string.md ├── style.md └── symbol.md ├── favicon.ico ├── images ├── copyright.png ├── cover-2nd.jpg ├── cover.jpg ├── cover_thumbnail.jpg ├── magnifier.jpg ├── page1.png └── page2.png ├── index.html ├── js ├── ditto.js ├── jquery-1.11.0.min.js ├── jquery-ui.min.js ├── marked.js ├── prism.js └── store.js └── sidebar.md /.gitignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | -------------------------------------------------------------------------------- /404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | ES6标准参考教程 4 | 14 | 15 | 16 |

redirecting...

17 | 18 | 19 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | es6.ruanyifeng.com 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | # Creative Commons Attribution-NonCommercial 4.0 International License 2 | 3 | Disclaimer: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-nc/4.0/legalcode). 4 | 5 | You are free to: 6 | 7 | - Share — copy and redistribute the material in any medium or format 8 | - Adapt — remix, transform, and build upon the material 9 | 10 | The licensor cannot revoke these freedoms as long as you follow the license terms. 11 | 12 | Under the following terms: 13 | 14 | - Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 15 | - NonCommercial — You may not use the material for commercial purposes. 16 | - No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 17 | 18 | Notices: 19 | 20 | You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation. 21 | 22 | No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ECMAScript 6入门 2 | 3 | 《ECMAScript 6入门》是一本开源的JavaScript语言教程,全面介绍ECMAScript 6新引入的语法特性。 4 | 5 | [![cover](images/cover_thumbnail.jpg)](images/cover-2nd.jpg) 6 | 7 | 本书覆盖 ES6/ES7 与 ES5 的所有不同之处,对涉及的语法知识给予详细介绍,并给出大量简洁易懂的示例代码。 8 | 9 | 本书为中级难度,适合已经掌握 ES5 的读者,用来了解这门语言的最新发展;也可当作参考手册,查寻新增的语法点。 10 | 11 | 全书已由电子工业出版社出版,目前是第二版,书名为《ES6 标准入门》。纸版是基于网站内容排版印刷的。 12 | 13 | 感谢张春雨编辑支持我将全书开源的做法。如果您认可这本书,建议购买纸版。这样可以使出版社不因出版开源书籍而亏钱,进而鼓励更多的作者开源自己的书籍。 14 | 15 | - [京东](http://item.jd.com/11849235.html) 16 | - [当当](http://product.dangdang.com/23840431.html) 17 | - [亚马逊](http://www.amazon.cn/ES6-%E6%A0%87%E5%87%86%E5%85%A5%E9%97%A8-%E9%98%AE%E4%B8%80%E5%B3%B0/dp/B01A18WWAG/) 18 | - [China-pub](http://product.china-pub.com/4904712) 19 | 20 | ### 版权许可 21 | 22 | 本书采用“保持署名—非商用”创意共享4.0许可证。 23 | 24 | 只要保持原作者署名和非商用,您可以自由地阅读、分享、修改本书。 25 | 26 | 详细的法律条文请参见[创意共享](http://creativecommons.org/licenses/by-nc/4.0/)网站。 27 | -------------------------------------------------------------------------------- /app/bower_components/marked/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "marked", 3 | "homepage": "https://github.com/chjj/marked", 4 | "version": "0.3.2", 5 | "_release": "0.3.2", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "v0.3.2", 9 | "commit": "43db549e31af5ff6e4a3b12e41a23513b9f88c99" 10 | }, 11 | "_source": "git://github.com/chjj/marked.git", 12 | "_target": "~0.3.2", 13 | "_originalSource": "marked", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /app/bower_components/marked/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/.npmignore: -------------------------------------------------------------------------------- 1 | .git* 2 | test/ 3 | -------------------------------------------------------------------------------- /app/bower_components/marked/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.10" 4 | - "0.8" 5 | - "0.6" 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2014, 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 | -------------------------------------------------------------------------------- /app/bower_components/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 | bench: 10 | @node test --bench 11 | 12 | .PHONY: clean all 13 | -------------------------------------------------------------------------------- /app/bower_components/marked/bin/marked: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Marked CLI 5 | * Copyright (c) 2011-2013, 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 | function help() { 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 | function main(argv, callback) { 36 | var files = [] 37 | , options = {} 38 | , input 39 | , output 40 | , arg 41 | , tokens 42 | , opt; 43 | 44 | function getarg() { 45 | var arg = argv.shift(); 46 | 47 | if (arg.indexOf('--') === 0) { 48 | // e.g. --opt 49 | arg = arg.split('='); 50 | if (arg.length > 1) { 51 | // e.g. --opt=val 52 | argv.unshift(arg.slice(1).join('=')); 53 | } 54 | arg = arg[0]; 55 | } else if (arg[0] === '-') { 56 | if (arg.length > 2) { 57 | // e.g. -abc 58 | argv = arg.substring(1).split('').map(function(ch) { 59 | return '-' + ch; 60 | }).concat(argv); 61 | arg = argv.shift(); 62 | } else { 63 | // e.g. -a 64 | } 65 | } else { 66 | // e.g. foo 67 | } 68 | 69 | return arg; 70 | } 71 | 72 | while (argv.length) { 73 | arg = getarg(); 74 | switch (arg) { 75 | case '--test': 76 | return require('../test').main(process.argv.slice()); 77 | case '-o': 78 | case '--output': 79 | output = argv.shift(); 80 | break; 81 | case '-i': 82 | case '--input': 83 | input = argv.shift(); 84 | break; 85 | case '-t': 86 | case '--tokens': 87 | tokens = true; 88 | break; 89 | case '-h': 90 | case '--help': 91 | return help(); 92 | default: 93 | if (arg.indexOf('--') === 0) { 94 | opt = camelize(arg.replace(/^--(no-)?/, '')); 95 | if (!marked.defaults.hasOwnProperty(opt)) { 96 | continue; 97 | } 98 | if (arg.indexOf('--no-') === 0) { 99 | options[opt] = typeof marked.defaults[opt] !== 'boolean' 100 | ? null 101 | : false; 102 | } else { 103 | options[opt] = typeof marked.defaults[opt] !== 'boolean' 104 | ? argv.shift() 105 | : true; 106 | } 107 | } else { 108 | files.push(arg); 109 | } 110 | break; 111 | } 112 | } 113 | 114 | function getData(callback) { 115 | if (!input) { 116 | if (files.length <= 2) { 117 | return getStdin(callback); 118 | } 119 | input = files.pop(); 120 | } 121 | return fs.readFile(input, 'utf8', callback); 122 | } 123 | 124 | return getData(function(err, data) { 125 | if (err) return callback(err); 126 | 127 | data = tokens 128 | ? JSON.stringify(marked.lexer(data, options), null, 2) 129 | : marked(data, options); 130 | 131 | if (!output) { 132 | process.stdout.write(data + '\n'); 133 | return callback(); 134 | } 135 | 136 | return fs.writeFile(output, data, callback); 137 | }); 138 | } 139 | 140 | /** 141 | * Helpers 142 | */ 143 | 144 | function getStdin(callback) { 145 | var stdin = process.stdin 146 | , buff = ''; 147 | 148 | stdin.setEncoding('utf8'); 149 | 150 | stdin.on('data', function(data) { 151 | buff += data; 152 | }); 153 | 154 | stdin.on('error', function(err) { 155 | return callback(err); 156 | }); 157 | 158 | stdin.on('end', function() { 159 | return callback(null, buff); 160 | }); 161 | 162 | try { 163 | stdin.resume(); 164 | } catch (e) { 165 | callback(e); 166 | } 167 | } 168 | 169 | function camelize(text) { 170 | return text.replace(/(\w)-(\w)/g, function(_, a, b) { 171 | return a + b.toUpperCase(); 172 | }); 173 | } 174 | 175 | /** 176 | * Expose / Entry Point 177 | */ 178 | 179 | if (!module.parent) { 180 | process.title = 'marked'; 181 | main(process.argv.slice(), function(err, code) { 182 | if (err) throw err; 183 | return process.exit(code || 0); 184 | }); 185 | } else { 186 | module.exports = main; 187 | } 188 | -------------------------------------------------------------------------------- /app/bower_components/marked/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "marked", 3 | "version": "0.3.2", 4 | "repo": "chjj/marked", 5 | "description": "A markdown parser built for speed", 6 | "keywords": ["markdown", "markup", "html"], 7 | "scripts": ["lib/marked.js"], 8 | "main": "lib/marked.js", 9 | "license": "MIT" 10 | } 11 | -------------------------------------------------------------------------------- /app/bower_components/marked/doc/broken.md: -------------------------------------------------------------------------------- 1 | # Markdown is broken 2 | 3 | I have a lot of scraps of markdown engine oddities that I've collected over the 4 | years. What you see below is slightly messy, but it's what I've managed to 5 | cobble together to illustrate the differences between markdown engines, and 6 | why, if there ever is a markdown specification, it has to be absolutely 7 | thorough. There are a lot more of these little differences I have documented 8 | elsewhere. I know I will find them lingering on my disk one day, but until 9 | then, I'll continue to add whatever strange nonsensical things I find. 10 | 11 | Some of these examples may only mention a particular engine compared to marked. 12 | However, the examples with markdown.pl could easily be swapped out for 13 | discount, upskirt, or markdown.js, and you would very easily see even more 14 | inconsistencies. 15 | 16 | A lot of this was written when I was very unsatisfied with the inconsistencies 17 | between markdown engines. Please excuse the frustration noticeable in my 18 | writing. 19 | 20 | ## Examples of markdown's "stupid" list parsing 21 | 22 | ``` 23 | $ markdown.pl 24 | 25 | * item1 26 | 27 | * item2 28 | 29 | text 30 | ^D 31 |

40 | ``` 41 | 42 | 43 | ``` 44 | $ marked 45 | * item1 46 | 47 | * item2 48 | 49 | text 50 | ^D 51 | 59 | ``` 60 | 61 | Which looks correct to you? 62 | 63 | - - - 64 | 65 | ``` 66 | $ markdown.pl 67 | * hello 68 | > world 69 | ^D 70 |

76 | 77 | ``` 78 | 79 | ``` 80 | $ marked 81 | * hello 82 | > world 83 | ^D 84 | 90 | ``` 91 | 92 | Again, which looks correct to you? 93 | 94 | - - - 95 | 96 | EXAMPLE: 97 | 98 | ``` 99 | $ markdown.pl 100 | * hello 101 | * world 102 | * hi 103 | code 104 | ^D 105 | 113 | ``` 114 | 115 | The code isn't a code block even though it's after the bullet margin. I know, 116 | lets give it two more spaces, effectively making it 8 spaces past the bullet. 117 | 118 | ``` 119 | $ markdown.pl 120 | * hello 121 | * world 122 | * hi 123 | code 124 | ^D 125 | 133 | ``` 134 | 135 | And, it's still not a code block. Did you also notice that the 3rd item isn't 136 | even its own list? Markdown screws that up too because of its indentation 137 | unaware parsing. 138 | 139 | - - - 140 | 141 | Let's look at some more examples of markdown's list parsing: 142 | 143 | ``` 144 | $ markdown.pl 145 | 146 | * item1 147 | 148 | * item2 149 | 150 | text 151 | ^D 152 |

161 | ``` 162 | 163 | Misnested tags. 164 | 165 | 166 | ``` 167 | $ marked 168 | * item1 169 | 170 | * item2 171 | 172 | text 173 | ^D 174 | 182 | ``` 183 | 184 | Which looks correct to you? 185 | 186 | - - - 187 | 188 | ``` 189 | $ markdown.pl 190 | * hello 191 | > world 192 | ^D 193 |

199 | 200 | ``` 201 | 202 | More misnested tags. 203 | 204 | 205 | ``` 206 | $ marked 207 | * hello 208 | > world 209 | ^D 210 | 216 | ``` 217 | 218 | Again, which looks correct to you? 219 | 220 | - - - 221 | 222 | # Why quality matters - Part 2 223 | 224 | ``` bash 225 | $ markdown.pl 226 | * hello 227 | > world 228 | ^D 229 |

235 | 236 | ``` 237 | 238 | ``` bash 239 | $ sundown # upskirt 240 | * hello 241 | > world 242 | ^D 243 | 247 | ``` 248 | 249 | ``` bash 250 | $ marked 251 | * hello 252 | > world 253 | ^D 254 | 255 | ``` 256 | 257 | Which looks correct to you? 258 | 259 | - - - 260 | 261 | See: https://github.com/evilstreak/markdown-js/issues/23 262 | 263 | ``` bash 264 | $ markdown.pl # upskirt/markdown.js/discount 265 | * hello 266 | var a = 1; 267 | * world 268 | ^D 269 | 274 | ``` 275 | 276 | ``` bash 277 | $ marked 278 | * hello 279 | var a = 1; 280 | * world 281 | ^D 282 | 285 | ``` 286 | 287 | Which looks more reasonable? Why shouldn't code blocks be able to appear in 288 | list items in a sane way? 289 | 290 | - - - 291 | 292 | ``` bash 293 | $ markdown.js 294 |
hello
295 | 296 | hello 297 | ^D 298 |

<div>hello</div>

299 | 300 |

<span>hello</span>

301 | ``` 302 | 303 | ``` bash 304 | $ marked 305 |
hello
306 | 307 | hello 308 | ^D 309 |
hello
310 | 311 | 312 |

hello 313 |

314 | ``` 315 | 316 | - - - 317 | 318 | See: https://github.com/evilstreak/markdown-js/issues/27 319 | 320 | ``` bash 321 | $ markdown.js 322 | [![an image](/image)](/link) 323 | ^D 324 |

![an image

325 | ``` 326 | 327 | ``` bash 328 | $ marked 329 | [![an image](/image)](/link) 330 | ^D 331 |

an image 332 |

333 | ``` 334 | 335 | - - - 336 | 337 | See: https://github.com/evilstreak/markdown-js/issues/24 338 | 339 | ``` bash 340 | $ markdown.js 341 | > a 342 | 343 | > b 344 | 345 | > c 346 | ^D 347 |

a

bundefined> c

348 | ``` 349 | 350 | ``` bash 351 | $ marked 352 | > a 353 | 354 | > b 355 | 356 | > c 357 | ^D 358 |

a 359 | 360 |

361 |

b 362 | 363 |

364 |

c 365 |

366 | ``` 367 | 368 | - - - 369 | 370 | ``` bash 371 | $ markdown.pl 372 | * hello 373 | * world 374 | how 375 | 376 | are 377 | you 378 | 379 | * today 380 | * hi 381 | ^D 382 | 398 | ``` 399 | 400 | ``` bash 401 | $ marked 402 | * hello 403 | * world 404 | how 405 | 406 | are 407 | you 408 | 409 | * today 410 | * hi 411 | ^D 412 | 426 | ``` 427 | -------------------------------------------------------------------------------- /app/bower_components/marked/doc/todo.md: -------------------------------------------------------------------------------- 1 | # Todo 2 | 3 | -------------------------------------------------------------------------------- /app/bower_components/marked/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/marked'); 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/man/marked.1: -------------------------------------------------------------------------------- 1 | .ds q \N'34' 2 | .TH marked 1 "2014-01-31" "v0.3.1" "marked.js" 3 | 4 | .SH NAME 5 | marked \- a javascript markdown parser 6 | 7 | .SH SYNOPSIS 8 | .B marked 9 | [\-o \fI\fP] [\-i \fI\fP] [\-\-help] 10 | [\-\-tokens] [\-\-pedantic] [\-\-gfm] 11 | [\-\-breaks] [\-\-tables] [\-\-sanitize] 12 | [\-\-smart\-lists] [\-\-lang\-prefix \fI\fP] 13 | [\-\-no\-etc...] [\-\-silent] [\fIfilename\fP] 14 | 15 | .SH DESCRIPTION 16 | .B marked 17 | is a full-featured javascript markdown parser, built for speed. It also includes 18 | multiple GFM features. 19 | 20 | .SH EXAMPLES 21 | .TP 22 | cat in.md | marked > out.html 23 | .TP 24 | echo "hello *world*" | marked 25 | .TP 26 | marked \-o out.html in.md \-\-gfm 27 | .TP 28 | marked \-\-output="hello world.html" \-i in.md \-\-no-breaks 29 | 30 | .SH OPTIONS 31 | .TP 32 | .BI \-o,\ \-\-output\ [\fIoutput\fP] 33 | Specify file output. If none is specified, write to stdout. 34 | .TP 35 | .BI \-i,\ \-\-input\ [\fIinput\fP] 36 | Specify file input, otherwise use last argument as input file. If no input file 37 | is specified, read from stdin. 38 | .TP 39 | .BI \-t,\ \-\-tokens 40 | Output a token stream instead of html. 41 | .TP 42 | .BI \-\-pedantic 43 | Conform to obscure parts of markdown.pl as much as possible. Don't fix original 44 | markdown bugs. 45 | .TP 46 | .BI \-\-gfm 47 | Enable github flavored markdown. 48 | .TP 49 | .BI \-\-breaks 50 | Enable GFM line breaks. Only works with the gfm option. 51 | .TP 52 | .BI \-\-tables 53 | Enable GFM tables. Only works with the gfm option. 54 | .TP 55 | .BI \-\-sanitize 56 | Sanitize output. Ignore any HTML input. 57 | .TP 58 | .BI \-\-smart\-lists 59 | Use smarter list behavior than the original markdown. 60 | .TP 61 | .BI \-\-lang\-prefix\ [\fIprefix\fP] 62 | Set the prefix for code block classes. 63 | .TP 64 | .BI \-\-no\-sanitize,\ \-no-etc... 65 | The inverse of any of the marked options above. 66 | .TP 67 | .BI \-\-silent 68 | Silence error output. 69 | .TP 70 | .BI \-h,\ \-\-help 71 | Display help information. 72 | 73 | .SH CONFIGURATION 74 | For configuring and running programmatically. 75 | 76 | .B Example 77 | 78 | require('marked')('*foo*', { gfm: true }); 79 | 80 | .SH BUGS 81 | Please report any bugs to https://github.com/chjj/marked. 82 | 83 | .SH LICENSE 84 | Copyright (c) 2011-2014, Christopher Jeffrey (MIT License). 85 | 86 | .SH "SEE ALSO" 87 | .BR markdown(1), 88 | .BR node.js(1) 89 | -------------------------------------------------------------------------------- /app/bower_components/marked/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "marked", 3 | "description": "A markdown parser built for speed", 4 | "author": "Christopher Jeffrey", 5 | "version": "0.3.2", 6 | "main": "./lib/marked.js", 7 | "bin": "./bin/marked", 8 | "man": "./man/marked.1", 9 | "preferGlobal": true, 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 | "license": "MIT", 14 | "keywords": ["markdown", "markup", "html"], 15 | "tags": ["markdown", "markup", "html"], 16 | "devDependencies": { 17 | "markdown": "*", 18 | "showdown": "*", 19 | "robotskirt": "*" 20 | }, 21 | "scripts": { "test": "node test", "bench": "node test --bench" } 22 | } 23 | -------------------------------------------------------------------------------- /app/bower_components/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 | # 8 | # 9 | 10 | Partially modified for testing purposes. 11 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/browser/index.html: -------------------------------------------------------------------------------- 1 | 2 | marked tests 3 |

testing...

4 | 5 | 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/browser/index.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | var test = require('../') 4 | , runTests = test.runTests 5 | , load = test.load; 6 | 7 | var express = require('express') 8 | , app = express(); 9 | 10 | app.use(function(req, res, next) { 11 | var setHeader = res.setHeader; 12 | res.setHeader = function(name) { 13 | switch (name) { 14 | case 'Cache-Control': 15 | case 'Last-Modified': 16 | case 'ETag': 17 | return; 18 | } 19 | return setHeader.apply(res, arguments); 20 | }; 21 | next(); 22 | }); 23 | 24 | var dir = __dirname + '/../tests' 25 | , files = {}; 26 | 27 | app.get('/test.js', function(req, res, next) { 28 | var test = fs.readFileSync(__dirname + '/test.js', 'utf8') 29 | , files = load(); 30 | 31 | test = test.replace('__TESTS__', JSON.stringify(files)); 32 | test = test.replace('__MAIN__', runTests + ''); 33 | 34 | res.contentType('.js'); 35 | res.send(test); 36 | }); 37 | 38 | app.use(express.static(__dirname + '/../../lib')); 39 | app.use(express.static(__dirname)); 40 | 41 | app.listen(8080); 42 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/browser/test.js: -------------------------------------------------------------------------------- 1 | ;(function() { 2 | 3 | var console = {} 4 | , files = __TESTS__; 5 | 6 | console.log = function(text) { 7 | var args = Array.prototype.slice.call(arguments, 1) 8 | , i = 0; 9 | 10 | text = text.replace(/%\w/g, function() { 11 | return args[i++] || ''; 12 | }); 13 | 14 | if (window.console) window.console.log(text); 15 | document.body.innerHTML += '
' + escape(text) + '
'; 16 | }; 17 | 18 | if (!Object.keys) { 19 | Object.keys = function(obj) { 20 | var out = [] 21 | , key; 22 | 23 | for (key in obj) { 24 | if (Object.prototype.hasOwnProperty.call(obj, key)) { 25 | out.push(key); 26 | } 27 | } 28 | 29 | return out; 30 | }; 31 | } 32 | 33 | if (!Array.prototype.forEach) { 34 | Array.prototype.forEach = function(callback, context) { 35 | for (var i = 0; i < this.length; i++) { 36 | callback.call(context || null, this[i], i, obj); 37 | } 38 | }; 39 | } 40 | 41 | if (!String.prototype.trim) { 42 | String.prototype.trim = function() { 43 | return this.replace(/^\s+|\s+$/g, ''); 44 | }; 45 | } 46 | 47 | function load() { 48 | return files; 49 | } 50 | 51 | function escape(html, encode) { 52 | return html 53 | .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') 54 | .replace(//g, '>') 56 | .replace(/"/g, '"') 57 | .replace(/'/g, '''); 58 | } 59 | 60 | (__MAIN__)(); 61 | 62 | }).call(this); 63 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/autolink_lines.html: -------------------------------------------------------------------------------- 1 |

hello world 2 | http://example.com 3 |

4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/autolink_lines.text: -------------------------------------------------------------------------------- 1 | hello world 2 | 3 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/blockquote_list_item.html: -------------------------------------------------------------------------------- 1 |

This fails in markdown.pl and upskirt:

2 | 3 |
  • hello

    world

4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/blockquote_list_item.text: -------------------------------------------------------------------------------- 1 | This fails in markdown.pl and upskirt: 2 | 3 | * hello 4 | > world 5 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/case_insensitive_refs.html: -------------------------------------------------------------------------------- 1 |

hi

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/case_insensitive_refs.text: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [HI]: /url 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/def_blocks.html: -------------------------------------------------------------------------------- 1 |
2 |

hello 3 | [1]: hello

4 |
5 | 6 |
7 | 8 |
9 |

hello

10 |
11 | 12 | 13 |
    14 |
  • hello
  • 15 |
  • [3]: hello
  • 16 |
17 | 18 | 19 |
    20 |
  • hello
  • 21 |
22 | 23 | 24 |
25 |

foo 26 | bar 27 | bar

28 |
29 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/def_blocks.text: -------------------------------------------------------------------------------- 1 | > hello 2 | > [1]: hello 3 | 4 | * * * 5 | 6 | > hello 7 | [2]: hello 8 | 9 | 10 | * hello 11 | * [3]: hello 12 | 13 | 14 | * hello 15 | [4]: hello 16 | 17 | 18 | > foo 19 | > bar 20 | [1]: foo 21 | > bar 22 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/double_link.html: -------------------------------------------------------------------------------- 1 |

Already linked: http://example.com/.

2 | 3 |

Already linked: http://example.com/.

4 | 5 |

Already linked: http://example.com/.

6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/double_link.text: -------------------------------------------------------------------------------- 1 |

Already linked: http://example.com/.

2 | 3 | Already linked: [http://example.com/](http://example.com/). 4 | 5 | Already linked: **http://example.com/**. 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/escaped_angles.html: -------------------------------------------------------------------------------- 1 |

>

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/escaped_angles.text: -------------------------------------------------------------------------------- 1 | \> 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_break.breaks.html: -------------------------------------------------------------------------------- 1 |

Look at the
pretty line
breaks.

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_break.breaks.text: -------------------------------------------------------------------------------- 1 | Look at the 2 | pretty line 3 | breaks. 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_code.html: -------------------------------------------------------------------------------- 1 |
var a = 'hello';
2 | console.log(a + ' world');
3 |
echo "hello, ${WORLD}"
4 |
Q: What do you call a tall person who sells stolen goods?
5 |
A longfence!
6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_code.text: -------------------------------------------------------------------------------- 1 | ``` js 2 | var a = 'hello'; 3 | console.log(a + ' world'); 4 | ``` 5 | 6 | ~~~bash 7 | echo "hello, ${WORLD}" 8 | ~~~ 9 | 10 | ```````longfence 11 | Q: What do you call a tall person who sells stolen goods? 12 | ``````` 13 | 14 | ~~~~~~~~~~ ManyTildes 15 | A longfence! 16 | ~~~~~~~~~~ 17 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_code_hr_list.html: -------------------------------------------------------------------------------- 1 |

foo

2 |
    3 |
  1. bar:

    4 |
    5 |
      6 |
    • one
        7 |
      • two
          8 |
        • three
        • 9 |
        • four
        • 10 |
        • five
        • 11 |
        12 |
      • 13 |
      14 |
    • 15 |
    16 |
    17 |
  2. 18 |
  3. foo:

    19 |
     line 1
    20 |  line 2
    21 |
  4. 22 |
  5. foo:

    23 |
      24 |
    1. foo bar bar:

      25 |
       some code here
      26 | 
      27 |
    2. 28 |
    3. foo bar bar:

      29 |
       foo
      30 |  ---
      31 |  bar
      32 |  ---
      33 |  foo
      34 |  bar
      35 |
    4. 36 |
    5. foo bar bar:

      37 |
       ---
      38 |  foo
      39 |  foo
      40 |  ---
      41 |  bar
      42 |
    6. 43 |
    7. foo bar bar:

      44 |
       foo
      45 |  ---
      46 |  bar
      47 |
    8. 48 |
    9. foo

      49 |
    10. 50 |
    51 |
  6. 52 |
53 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_code_hr_list.text: -------------------------------------------------------------------------------- 1 | ## foo 2 | 3 | 1. bar: 4 | 5 | > - one 6 | - two 7 | - three 8 | - four 9 | - five 10 | 11 | 1. foo: 12 | 13 | ``` 14 | line 1 15 | line 2 16 | ``` 17 | 18 | 1. foo: 19 | 20 | 1. foo `bar` bar: 21 | 22 | ``` erb 23 | some code here 24 | ``` 25 | 26 | 2. foo `bar` bar: 27 | 28 | ``` erb 29 | foo 30 | --- 31 | bar 32 | --- 33 | foo 34 | bar 35 | ``` 36 | 37 | 3. foo `bar` bar: 38 | 39 | ``` html 40 | --- 41 | foo 42 | foo 43 | --- 44 | bar 45 | ``` 46 | 47 | 4. foo `bar` bar: 48 | 49 | foo 50 | --- 51 | bar 52 | 53 | 5. foo 54 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_del.html: -------------------------------------------------------------------------------- 1 |

hello hi world

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_del.text: -------------------------------------------------------------------------------- 1 | hello ~~hi~~ world 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_em.html: -------------------------------------------------------------------------------- 1 |

These words should_not_be_emphasized.

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_em.text: -------------------------------------------------------------------------------- 1 | These words should_not_be_emphasized. 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_links.html: -------------------------------------------------------------------------------- 1 |

This should be a link: 2 | http://example.com/hello-world.

3 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_links.text: -------------------------------------------------------------------------------- 1 | This should be a link: http://example.com/hello-world. 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_tables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Heading 1Heading 2
Cell 1Cell 2
Cell 3Cell 4
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
Header 1Header 2Header 3Header 4
Cell 1Cell 2Cell 3Cell 4
Cell 5Cell 6Cell 7Cell 8
19 |
Test code
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Header 1Header 2
Cell 1Cell 2
Cell 3Cell 4
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
Header 1Header 2Header 3Header 4
Cell 1Cell 2Cell 3Cell 4
Cell 5Cell 6Cell 7Cell 8
38 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/gfm_tables.text: -------------------------------------------------------------------------------- 1 | | Heading 1 | Heading 2 2 | | --------- | --------- 3 | | Cell 1 | Cell 2 4 | | Cell 3 | Cell 4 5 | 6 | | Header 1 | Header 2 | Header 3 | Header 4 | 7 | | :------: | -------: | :------- | -------- | 8 | | Cell 1 | Cell 2 | Cell 3 | Cell 4 | 9 | | Cell 5 | Cell 6 | Cell 7 | Cell 8 | 10 | 11 | Test code 12 | 13 | Header 1 | Header 2 14 | -------- | -------- 15 | Cell 1 | Cell 2 16 | Cell 3 | Cell 4 17 | 18 | Header 1|Header 2|Header 3|Header 4 19 | :-------|:------:|-------:|-------- 20 | Cell 1 |Cell 2 |Cell 3 |Cell 4 21 | *Cell 5*|Cell 6 |Cell 7 |Cell 8 22 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/hr_list_break.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • hello 3 | world
  • 4 |
  • how 5 | are
  • 6 |
7 | 8 |
9 | 10 |

you today?

11 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/hr_list_break.text: -------------------------------------------------------------------------------- 1 | * hello 2 | world 3 | * how 4 | are 5 | * * * 6 | you today? 7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/lazy_blockquotes.html: -------------------------------------------------------------------------------- 1 |
2 |

hi there 3 | bud

4 |
5 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/lazy_blockquotes.text: -------------------------------------------------------------------------------- 1 | > hi there 2 | bud 3 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/list_item_text.html: -------------------------------------------------------------------------------- 1 |
  • item1

    • item2

    text

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/list_item_text.text: -------------------------------------------------------------------------------- 1 | * item1 2 | 3 | * item2 4 | 5 | text 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/loose_lists.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • hello 3 | world

    4 | 5 |

    how 6 | are

  • 7 |
  • you
  • 8 |
9 | 10 | 11 | 12 |

better behavior:

13 | 14 |
  • hello

    • world 15 | how

      are 16 | you

    • today

  • hi
17 | 18 | 19 | 20 |
    21 |
  • hello

  • 22 |
  • world

  • 23 |
  • hi
  • 24 |
25 | 26 | 27 | 28 |
    29 |
  • hello
  • 30 |
  • world

  • 31 |
  • hi

  • 32 |
33 | 34 | 35 | 36 |
    37 |
  • hello
  • 38 |
  • world

    39 | 40 |

    how

  • 41 |
  • hi
  • 42 |
43 | 44 | 45 | 46 |
    47 |
  • hello
  • 48 |
  • world
  • 49 |
  • how

    50 | 51 |

    are

  • 52 |
53 | 54 | 55 | 56 |
    57 |
  • hello
  • 58 |
  • world

  • 59 |
  • how

    60 | 61 |

    are

  • 62 |
63 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/loose_lists.text: -------------------------------------------------------------------------------- 1 | * hello 2 | world 3 | 4 | how 5 | are 6 | * you 7 | 8 | 9 | 10 | better behavior: 11 | 12 | * hello 13 | * world 14 | how 15 | 16 | are 17 | you 18 | 19 | * today 20 | * hi 21 | 22 | 23 | 24 | * hello 25 | 26 | * world 27 | * hi 28 | 29 | 30 | 31 | * hello 32 | * world 33 | 34 | * hi 35 | 36 | 37 | 38 | * hello 39 | * world 40 | 41 | how 42 | * hi 43 | 44 | 45 | 46 | * hello 47 | * world 48 | * how 49 | 50 | are 51 | 52 | 53 | 54 | * hello 55 | * world 56 | 57 | * how 58 | 59 | are 60 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/main.html: -------------------------------------------------------------------------------- 1 |

A heading

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

    • New List Item 1 Hi, this is a list item.
    • New List Item 2 Another item
      Code goes here.
      3 | Lots of it...
    • New List Item 3 The last item
  • 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

Another Heading

Hello world. Here is a link. And an image alt.

Code goes here.
4 | Lots of it...
5 | -------------------------------------------------------------------------------- /app/bower_components/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 ![alt](src). 53 | 54 | Code goes here. 55 | Lots of it... 56 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/nested_code.html: -------------------------------------------------------------------------------- 1 |

hi ther `` ok ```

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/nested_code.text: -------------------------------------------------------------------------------- 1 | ````` hi ther `` ok ``` ````` 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/nested_em.html: -------------------------------------------------------------------------------- 1 |

test test test

2 | 3 |

test test test

4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/nested_em.text: -------------------------------------------------------------------------------- 1 | *test **test** test* 2 | 3 | _test __test__ test_ 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/nested_square_link.html: -------------------------------------------------------------------------------- 1 |

the ] character

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/nested_square_link.text: -------------------------------------------------------------------------------- 1 | [the `]` character](/url) 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/not_a_link.html: -------------------------------------------------------------------------------- 1 |

[test](not a link)

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/not_a_link.text: -------------------------------------------------------------------------------- 1 | \[test](not a link) 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/ref_paren.html: -------------------------------------------------------------------------------- 1 |

hi

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/ref_paren.text: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [hi]: /url (there) 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/same_bullet.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • test
  • 3 |
  • test
  • 4 |
  • test
  • 5 |
6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/same_bullet.text: -------------------------------------------------------------------------------- 1 | * test 2 | + test 3 | - test 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/text.smartypants.html: -------------------------------------------------------------------------------- 1 |

Hello world ‘how’ “are” you — today…

2 | 3 |

“It’s a more ‘challenging’ smartypants test…”

4 | 5 |

‘And,’ as a bonus — “one 6 | multiline” test!

7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/text.smartypants.text: -------------------------------------------------------------------------------- 1 | Hello world 'how' "are" you -- today... 2 | 3 | "It's a more 'challenging' smartypants test..." 4 | 5 | 'And,' as a bonus -- "one 6 | multiline" test! 7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/toplevel_paragraphs.gfm.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 |
10 | 11 |

hello world

12 |

how are you

13 | 14 |

hello world

15 |

how are you

16 | 17 |

hello world

18 |

how are you

19 | 20 |

hello world

21 |
  • how are you
22 | 23 |

hello world

24 |
how are you
25 | 26 |

hello world 27 | how are you

28 | 29 |

hello world 30 |

31 | 32 |
hello
33 | 34 |

hello

35 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/toplevel_paragraphs.gfm.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 |
how are you
28 | 29 | hello world 30 | how are you 31 | 32 | hello [world][how] 33 | [how]: /are/you 34 | 35 |
hello
36 | 37 | hello 38 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/tricky_list.html: -------------------------------------------------------------------------------- 1 |

hello world

2 | 3 |
    4 |
  • hello world
  • 5 |
6 | 7 |

hello world

8 | 9 |
    10 |
  • hello world
  • 11 |
12 | 13 |

hello world

14 | 15 |
    16 |
  • Hello world
  • 17 |
18 | 19 |

hello world

20 | 21 |
    22 |
  • hello world
  • 23 |
24 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/new/tricky_list.text: -------------------------------------------------------------------------------- 1 | **hello** _world_ 2 | 3 | * hello world 4 | 5 | **hello** _world_ 6 | 7 | * hello world 8 | 9 | **hello** _world_ 10 | 11 | * Hello world 12 | 13 | **hello** _world_ 14 | 15 | * hello world 16 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/amps_and_angles_encoding.html: -------------------------------------------------------------------------------- 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 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 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/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 | 10 | 11 |
12 |

Blockquoted: http://example.com/

13 |
14 | 15 |

Auto-links should not occur here: <http://example.com/>

16 | 17 |
or here: <http://example.com/>
18 | 
19 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/auto_links.text: -------------------------------------------------------------------------------- 1 | Link: . 2 | 3 | With an ampersand: 4 | 5 | * In a list? 6 | * 7 | * It should. 8 | 9 | > Blockquoted: 10 | 11 | Auto-links should not occur here: `` 12 | 13 | or here: 14 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/backslash_escapes.html: -------------------------------------------------------------------------------- 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 |

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: \\

73 | 74 |

Backtick: \`

75 | 76 |

Asterisk: \*

77 | 78 |

Underscore: \_

79 | 80 |

Left brace: \{

81 | 82 |

Right brace: \}

83 | 84 |

Left bracket: \[

85 | 86 |

Right bracket: \]

87 | 88 |

Left paren: \(

89 | 90 |

Right paren: \)

91 | 92 |

Greater-than: \>

93 | 94 |

Hash: \#

95 | 96 |

Period: \.

97 | 98 |

Bang: \!

99 | 100 |

Plus: \+

101 | 102 |

Minus: \-

103 | 104 | 105 |

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: \`

115 | 116 |

This is a tag with unescaped backticks bar.

117 | 118 |

This is a tag with backslashes bar.

119 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/blockquotes_with_code_blocks.html: -------------------------------------------------------------------------------- 1 |
2 |

Example:

3 | 4 |
sub status {
 5 |     print "working";
 6 | }
 7 | 
8 | 9 |

Or:

10 | 11 |
sub status {
12 |     return "working";
13 | }
14 | 
15 |
16 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/code_blocks.html: -------------------------------------------------------------------------------- 1 |
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 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/code_spans.html: -------------------------------------------------------------------------------- 1 |

<test a=" content of attribute ">

2 | 3 |

Fix for backticks within HTML tag: like this

4 | 5 |

Here's how you put `backticks` in a code span.

6 | 7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/code_spans.text: -------------------------------------------------------------------------------- 1 | `` 2 | 3 | Fix for backticks within HTML tag: like this 4 | 5 | Here's how you put `` `backticks` `` in a code span. 6 | 7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/hard_wrapped_paragraphs_with_list_like_lines.html: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/horizontal_rules.html: -------------------------------------------------------------------------------- 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 | 25 |

Asterisks:

26 | 27 |
28 | 29 |
30 | 31 |
32 | 33 |
34 | 35 |
***
36 | 
37 | 38 |
39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |
* * *
47 | 
48 | 49 |

Underscores:

50 | 51 |
52 | 53 |
54 | 55 |
56 | 57 |
58 | 59 |
___
60 | 
61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 |
_ _ _
71 | 
72 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/inline_html_advanced.html: -------------------------------------------------------------------------------- 1 |

Simple block on one line:

2 | 3 |
foo
4 | 5 |

And nested without indentation:

6 | 7 |
8 |
9 |
10 | foo 11 |
12 |
13 |
14 |
bar
15 |
16 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/inline_html_advanced.text: -------------------------------------------------------------------------------- 1 | Simple block on one line: 2 | 3 |
foo
4 | 5 | And nested without indentation: 6 | 7 |
8 |
9 |
10 | foo 11 |
12 |
13 |
14 |
bar
15 |
16 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/inline_html_comments.html: -------------------------------------------------------------------------------- 1 |

Paragraph one.

2 | 3 | 4 | 5 | 8 | 9 |

Paragraph two.

10 | 11 | 12 | 13 |

The end.

14 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/inline_html_simple.html: -------------------------------------------------------------------------------- 1 |

Here's a simple block:

2 | 3 |
4 | foo 5 |
6 | 7 |

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 |
22 |
23 |
24 | foo 25 |
26 |
27 |
28 | 29 |

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 |
57 | 58 |
59 | 60 |
61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 |
71 | 72 |
73 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/inline_html_simple.text: -------------------------------------------------------------------------------- 1 | Here's a simple block: 2 | 3 |
4 | foo 5 |
6 | 7 | This should be a code block, though: 8 | 9 |
10 | foo 11 |
12 | 13 | As should this: 14 | 15 |
foo
16 | 17 | Now, nested: 18 | 19 |
20 |
21 |
22 | foo 23 |
24 |
25 |
26 | 27 | This should just be an HTML comment: 28 | 29 | 30 | 31 | Multiline: 32 | 33 | 37 | 38 | Code block: 39 | 40 | 41 | 42 | Just plain comment, with trailing spaces on the line: 43 | 44 | 45 | 46 | Code: 47 | 48 |
49 | 50 | Hr's: 51 | 52 |
53 | 54 |
55 | 56 |
57 | 58 |
59 | 60 |
61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/links_inline_style.html: -------------------------------------------------------------------------------- 1 |

Just a URL.

2 | 3 |

URL and title.

4 | 5 |

URL and title.

6 | 7 |

URL and title.

8 | 9 |

URL and title.

10 | 11 |

URL and title.

12 | 13 |

URL and title.

14 | 15 |

Empty.

16 | -------------------------------------------------------------------------------- /app/bower_components/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 | [URL and title]( /url/has space ). 12 | 13 | [URL and title]( /url/has space/ "url has space and title"). 14 | 15 | [Empty](). 16 | -------------------------------------------------------------------------------- /app/bower_components/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 |
21 | 22 |

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 |
47 | 48 |

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 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/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 |

this and the other

10 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/literal_quotes_in_titles.html: -------------------------------------------------------------------------------- 1 |

Foo bar.

2 | 3 |

Foo bar.

4 | -------------------------------------------------------------------------------- /app/bower_components/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 | -------------------------------------------------------------------------------- /app/bower_components/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 `

` and `

` are created by 44 | "underlining" with equal signs (`=`) and hyphens (`-`), respectively. 45 | To create an atx-style header, you put 1-6 hash marks (`#`) at the 46 | beginning of the line -- the number of hashes equals the resulting 47 | HTML header level. 48 | 49 | Blockquotes are indicated using email-style '`>`' angle brackets. 50 | 51 | Markdown: 52 | 53 | A First Level Header 54 | ==================== 55 | 56 | A Second Level Header 57 | --------------------- 58 | 59 | Now is the time for all good men to come to 60 | the aid of their country. This is just a 61 | regular paragraph. 62 | 63 | The quick brown fox jumped over the lazy 64 | dog's back. 65 | 66 | ### Header 3 67 | 68 | > This is a blockquote. 69 | > 70 | > This is the second paragraph in the blockquote. 71 | > 72 | > ## This is an H2 in a blockquote 73 | 74 | 75 | Output: 76 | 77 |

A First Level Header

78 | 79 |

A Second Level Header

80 | 81 |

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 |

Header 3

89 | 90 |
91 |

This is a blockquote.

92 | 93 |

This is the second paragraph in the blockquote.

94 | 95 |

This is an H2 in a blockquote

96 |
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 |

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 |
    147 |
  • Candy.
  • 148 |
  • Gum.
  • 149 |
  • Booze.
  • 150 |
151 | 152 | Ordered (numbered) lists use regular numbers, followed by periods, as 153 | list markers: 154 | 155 | 1. Red 156 | 2. Green 157 | 3. Blue 158 | 159 | Output: 160 | 161 |
    162 |
  1. Red
  2. 163 |
  3. Green
  4. 164 |
  5. Blue
  6. 165 |
166 | 167 | If you put blank lines between items, you'll get `

` 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 |

    180 |
  • A list item.

    181 |

    With multiple paragraphs.

  • 182 |
  • Another item in the list.

  • 183 |
184 | 185 | 186 | 187 | ### Links ### 188 | 189 | Markdown supports two styles for creating links: *inline* and 190 | *reference*. With both styles, you use square brackets to delimit the 191 | text you want to turn into a link. 192 | 193 | Inline-style links use parentheses immediately after the link text. 194 | For example: 195 | 196 | This is an [example link](http://example.com/). 197 | 198 | Output: 199 | 200 |

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 | ![alt text](/path/to/img.jpg "Title") 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 | alt text 260 | 261 | 262 | 263 | ### Code ### 264 | 265 | In a regular paragraph, you can create code span by wrapping text in 266 | backtick quotes. Any ampersands (`&`) and angle brackets (`<` or 267 | `>`) will automatically be translated into HTML entities. This makes 268 | it easy to use Markdown to write about HTML example code: 269 | 270 | I strongly recommend against using any `` tags. 271 | 272 | I wish SmartyPants used named entities like `—` 273 | instead of decimal-encoded entites like `—`. 274 | 275 | Output: 276 | 277 |

I strongly recommend against using any 278 | <blink> tags.

279 | 280 |

I wish SmartyPants used named entities like 281 | &mdash; instead of decimal-encoded 282 | entites like &#8212;.

283 | 284 | 285 | To specify an entire block of pre-formatted code, indent every line of 286 | the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, 287 | and `>` characters will be escaped automatically. 288 | 289 | Markdown: 290 | 291 | If you want your page to validate under XHTML 1.0 Strict, 292 | you've got to put paragraph tags in your blockquotes: 293 | 294 |
295 |

For example.

296 |
297 | 298 | Output: 299 | 300 |

If you want your page to validate under XHTML 1.0 Strict, 301 | you've got to put paragraph tags in your blockquotes:

302 | 303 |
<blockquote>
304 |         <p>For example.</p>
305 |     </blockquote>
306 |     
307 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/nested_blockquotes.html: -------------------------------------------------------------------------------- 1 |
2 |

foo

3 | 4 |
5 |

bar

6 |
7 | 8 |

foo

9 |
10 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/nested_blockquotes.text: -------------------------------------------------------------------------------- 1 | > foo 2 | > 3 | > > bar 4 | > 5 | > foo 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/ordered_and_unordered_lists.html: -------------------------------------------------------------------------------- 1 |

Unordered

2 | 3 |

Asterisks tight:

4 | 5 |
    6 |
  • asterisk 1
  • 7 |
  • asterisk 2
  • 8 |
  • asterisk 3
  • 9 |
10 | 11 |

Asterisks loose:

12 | 13 |
    14 |
  • asterisk 1

  • 15 |
  • asterisk 2

  • 16 |
  • asterisk 3

  • 17 |
18 | 19 |
20 | 21 |

Pluses tight:

22 | 23 |
    24 |
  • Plus 1
  • 25 |
  • Plus 2
  • 26 |
  • Plus 3
  • 27 |
28 | 29 |

Pluses loose:

30 | 31 |
    32 |
  • Plus 1

  • 33 |
  • Plus 2

  • 34 |
  • Plus 3

  • 35 |
36 | 37 |
38 | 39 |

Minuses tight:

40 | 41 |
    42 |
  • Minus 1
  • 43 |
  • Minus 2
  • 44 |
  • Minus 3
  • 45 |
46 | 47 |

Minuses loose:

48 | 49 |
    50 |
  • Minus 1

  • 51 |
  • Minus 2

  • 52 |
  • Minus 3

  • 53 |
54 | 55 |

Ordered

56 | 57 |

Tight:

58 | 59 |
    60 |
  1. First
  2. 61 |
  3. Second
  4. 62 |
  5. Third
  6. 63 |
64 | 65 |

and:

66 | 67 |
    68 |
  1. One
  2. 69 |
  3. Two
  4. 70 |
  5. Three
  6. 71 |
72 | 73 |

Loose using tabs:

74 | 75 |
    76 |
  1. First

  2. 77 |
  3. Second

  4. 78 |
  5. Third

  6. 79 |
80 | 81 |

and using spaces:

82 | 83 |
    84 |
  1. One

  2. 85 |
  3. Two

  4. 86 |
  5. Three

  6. 87 |
88 | 89 |

Multiple paragraphs:

90 | 91 |
    92 |
  1. Item 1, graf one.

    93 | 94 |

    Item 2. graf two. The quick brown fox jumped over the lazy dog's 95 | back.

  2. 96 |
  3. Item 2.

  4. 97 |
  5. Item 3.

  6. 98 |
99 | 100 |

Nested

101 | 102 |
    103 |
  • Tab 104 |
      105 |
    • Tab 106 |
        107 |
      • Tab
      • 108 |
    • 109 |
  • 110 |
111 | 112 |

Here's another:

113 | 114 |
    115 |
  1. First
  2. 116 |
  3. Second: 117 |
      118 |
    • Fee
    • 119 |
    • Fie
    • 120 |
    • Foe
    • 121 |
  4. 122 |
  5. Third
  6. 123 |
124 | 125 |

Same thing but with paragraphs:

126 | 127 |
    128 |
  1. First

  2. 129 |
  3. Second:

    130 | 131 |
      132 |
    • Fee
    • 133 |
    • Fie
    • 134 |
    • Foe
    • 135 |
  4. 136 |
  5. Third

  6. 137 |
138 | 139 | 140 |

This was an error in Markdown 1.0.1:

141 | 142 |
    143 |
  • this

    144 | 145 |
    • sub
    146 | 147 |

    that

  • 148 |
149 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/ordered_and_unordered_lists.text: -------------------------------------------------------------------------------- 1 | ## Unordered 2 | 3 | Asterisks tight: 4 | 5 | * asterisk 1 6 | * asterisk 2 7 | * asterisk 3 8 | 9 | 10 | Asterisks loose: 11 | 12 | * asterisk 1 13 | 14 | * asterisk 2 15 | 16 | * asterisk 3 17 | 18 | * * * 19 | 20 | Pluses tight: 21 | 22 | + Plus 1 23 | + Plus 2 24 | + Plus 3 25 | 26 | 27 | Pluses loose: 28 | 29 | + Plus 1 30 | 31 | + Plus 2 32 | 33 | + Plus 3 34 | 35 | * * * 36 | 37 | 38 | Minuses tight: 39 | 40 | - Minus 1 41 | - Minus 2 42 | - Minus 3 43 | 44 | 45 | Minuses loose: 46 | 47 | - Minus 1 48 | 49 | - Minus 2 50 | 51 | - Minus 3 52 | 53 | 54 | ## Ordered 55 | 56 | Tight: 57 | 58 | 1. First 59 | 2. Second 60 | 3. Third 61 | 62 | and: 63 | 64 | 1. One 65 | 2. Two 66 | 3. Three 67 | 68 | 69 | Loose using tabs: 70 | 71 | 1. First 72 | 73 | 2. Second 74 | 75 | 3. Third 76 | 77 | and using spaces: 78 | 79 | 1. One 80 | 81 | 2. Two 82 | 83 | 3. Three 84 | 85 | Multiple paragraphs: 86 | 87 | 1. Item 1, graf one. 88 | 89 | Item 2. graf two. The quick brown fox jumped over the lazy dog's 90 | back. 91 | 92 | 2. Item 2. 93 | 94 | 3. Item 3. 95 | 96 | 97 | 98 | ## Nested 99 | 100 | * Tab 101 | * Tab 102 | * Tab 103 | 104 | Here's another: 105 | 106 | 1. First 107 | 2. Second: 108 | * Fee 109 | * Fie 110 | * Foe 111 | 3. Third 112 | 113 | Same thing but with paragraphs: 114 | 115 | 1. First 116 | 117 | 2. Second: 118 | * Fee 119 | * Fie 120 | * Foe 121 | 122 | 3. Third 123 | 124 | 125 | This was an error in Markdown 1.0.1: 126 | 127 | * this 128 | 129 | * sub 130 | 131 | that 132 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/strong_and_em_together.html: -------------------------------------------------------------------------------- 1 |

This is strong and em.

2 | 3 |

So is this word.

4 | 5 |

This is strong and em.

6 | 7 |

So is this word.

8 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/strong_and_em_together.text: -------------------------------------------------------------------------------- 1 | ***This is strong and em.*** 2 | 3 | So is ***this*** word. 4 | 5 | ___This is strong and em.___ 6 | 7 | So is ___this___ word. 8 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/tabs.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • this is a list item 3 | indented with tabs

  • 4 |
  • this is a list item 5 | indented with spaces

  • 6 |
7 | 8 |

Code:

9 | 10 |
this code block is indented by one tab
11 | 
12 | 13 |

And:

14 | 15 |
    this code block is indented by two tabs
16 | 
17 | 18 |

And:

19 | 20 |
+   this is an example list item
21 |     indented with tabs
22 | 
23 | +   this is an example list item
24 |     indented with spaces
25 | 
26 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/tabs.text: -------------------------------------------------------------------------------- 1 | + this is a list item 2 | indented with tabs 3 | 4 | + this is a list item 5 | indented with spaces 6 | 7 | Code: 8 | 9 | this code block is indented by one tab 10 | 11 | And: 12 | 13 | this code block is indented by two tabs 14 | 15 | And: 16 | 17 | + this is an example list item 18 | indented with tabs 19 | 20 | + this is an example list item 21 | indented with spaces 22 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/tidyness.html: -------------------------------------------------------------------------------- 1 |
2 |

A list within a blockquote:

3 |
    4 |
  • asterisk 1
  • 5 |
  • asterisk 2
  • 6 |
  • asterisk 3
  • 7 |
8 |
9 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/original/tidyness.text: -------------------------------------------------------------------------------- 1 | > A list within a blockquote: 2 | > 3 | > * asterisk 1 4 | > * asterisk 2 5 | > * asterisk 3 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/amps_and_angles_encoding.html: -------------------------------------------------------------------------------- 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 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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/auto_links.html: -------------------------------------------------------------------------------- 1 |

Link: http://example.com/.

2 | 3 |

With an ampersand: http://example.com/?foo=1&bar=2

4 | 5 | 10 | 11 |
12 |

Blockquoted: http://example.com/

13 |
14 | 15 |

Auto-links should not occur here: <http://example.com/>

16 | 17 |
or here: <http://example.com/>
18 | 
19 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/auto_links.text: -------------------------------------------------------------------------------- 1 | Link: . 2 | 3 | With an ampersand: 4 | 5 | * In a list? 6 | * 7 | * It should. 8 | 9 | > Blockquoted: 10 | 11 | Auto-links should not occur here: `` 12 | 13 | or here: 14 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/autolink_lines.html: -------------------------------------------------------------------------------- 1 |

hello world 2 | http://example.com 3 |

4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/autolink_lines.text: -------------------------------------------------------------------------------- 1 | hello world 2 | 3 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/backslash_escapes.html: -------------------------------------------------------------------------------- 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 |

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: \\

73 | 74 |

Backtick: \`

75 | 76 |

Asterisk: \*

77 | 78 |

Underscore: \_

79 | 80 |

Left brace: \{

81 | 82 |

Right brace: \}

83 | 84 |

Left bracket: \[

85 | 86 |

Right bracket: \]

87 | 88 |

Left paren: \(

89 | 90 |

Right paren: \)

91 | 92 |

Greater-than: \>

93 | 94 |

Hash: \#

95 | 96 |

Period: \.

97 | 98 |

Bang: \!

99 | 100 |

Plus: \+

101 | 102 |

Minus: \-

103 | 104 | 105 |

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: \`

115 | 116 |

This is a tag with unescaped backticks bar.

117 | 118 |

This is a tag with backslashes bar.

119 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/blockquote_list_item.html: -------------------------------------------------------------------------------- 1 |

This fails in markdown.pl and upskirt:

2 | 3 |
  • hello

    world

4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/blockquote_list_item.text: -------------------------------------------------------------------------------- 1 | This fails in markdown.pl and upskirt: 2 | 3 | * hello 4 | > world 5 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/blockquotes_with_code_blocks.html: -------------------------------------------------------------------------------- 1 |
2 |

Example:

3 | 4 |
sub status {
 5 |     print "working";
 6 | }
 7 | 
8 | 9 |

Or:

10 | 11 |
sub status {
12 |     return "working";
13 | }
14 | 
15 |
16 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/case_insensitive_refs.html: -------------------------------------------------------------------------------- 1 |

hi

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/case_insensitive_refs.text: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [HI]: /url 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/code_blocks.html: -------------------------------------------------------------------------------- 1 |
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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/code_spans.html: -------------------------------------------------------------------------------- 1 |

<test a=" content of attribute ">

2 | 3 |

Fix for backticks within HTML tag: like this

4 | 5 |

Here's how you put `backticks` in a code span.

6 | 7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/code_spans.text: -------------------------------------------------------------------------------- 1 | `` 2 | 3 | Fix for backticks within HTML tag: like this 4 | 5 | Here's how you put `` `backticks` `` in a code span. 6 | 7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/def_blocks.html: -------------------------------------------------------------------------------- 1 |
2 |

hello 3 | [1]: hello

4 |
5 | 6 |
7 | 8 |
9 |

hello

10 |
11 | 12 | 13 |
    14 |
  • hello
  • 15 |
  • [3]: hello
  • 16 |
17 | 18 | 19 |
    20 |
  • hello
  • 21 |
22 | 23 | 24 |
25 |

foo 26 | bar 27 | bar

28 |
29 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/def_blocks.text: -------------------------------------------------------------------------------- 1 | > hello 2 | > [1]: hello 3 | 4 | * * * 5 | 6 | > hello 7 | [2]: hello 8 | 9 | 10 | * hello 11 | * [3]: hello 12 | 13 | 14 | * hello 15 | [4]: hello 16 | 17 | 18 | > foo 19 | > bar 20 | [1]: foo 21 | > bar 22 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/double_link.html: -------------------------------------------------------------------------------- 1 |

Already linked: http://example.com/.

2 | 3 |

Already linked: http://example.com/.

4 | 5 |

Already linked: http://example.com/.

6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/double_link.text: -------------------------------------------------------------------------------- 1 |

Already linked: http://example.com/.

2 | 3 | Already linked: [http://example.com/](http://example.com/). 4 | 5 | Already linked: **http://example.com/**. 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/escaped_angles.html: -------------------------------------------------------------------------------- 1 |

>

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/escaped_angles.text: -------------------------------------------------------------------------------- 1 | \> 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_break.breaks.html: -------------------------------------------------------------------------------- 1 |

Look at the
pretty line
breaks.

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_break.breaks.text: -------------------------------------------------------------------------------- 1 | Look at the 2 | pretty line 3 | breaks. 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_code.html: -------------------------------------------------------------------------------- 1 |
var a = 'hello';
2 | console.log(a + ' world');
3 |
echo "hello, ${WORLD}"
4 |
Q: What do you call a tall person who sells stolen goods?
5 |
A longfence!
6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_code.text: -------------------------------------------------------------------------------- 1 | ``` js 2 | var a = 'hello'; 3 | console.log(a + ' world'); 4 | ``` 5 | 6 | ~~~bash 7 | echo "hello, ${WORLD}" 8 | ~~~ 9 | 10 | ```````longfence 11 | Q: What do you call a tall person who sells stolen goods? 12 | ``````` 13 | 14 | ~~~~~~~~~~ ManyTildes 15 | A longfence! 16 | ~~~~~~~~~~ 17 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_code_hr_list.html: -------------------------------------------------------------------------------- 1 |

foo

2 |
    3 |
  1. bar:

    4 |
    5 |
      6 |
    • one
        7 |
      • two
          8 |
        • three
        • 9 |
        • four
        • 10 |
        • five
        • 11 |
        12 |
      • 13 |
      14 |
    • 15 |
    16 |
    17 |
  2. 18 |
  3. foo:

    19 |
     line 1
    20 |  line 2
    21 |
  4. 22 |
  5. foo:

    23 |
      24 |
    1. foo bar bar:

      25 |
       some code here
      26 | 
      27 |
    2. 28 |
    3. foo bar bar:

      29 |
       foo
      30 |  ---
      31 |  bar
      32 |  ---
      33 |  foo
      34 |  bar
      35 |
    4. 36 |
    5. foo bar bar:

      37 |
       ---
      38 |  foo
      39 |  foo
      40 |  ---
      41 |  bar
      42 |
    6. 43 |
    7. foo bar bar:

      44 |
       foo
      45 |  ---
      46 |  bar
      47 |
    8. 48 |
    9. foo

      49 |
    10. 50 |
    51 |
  6. 52 |
53 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_code_hr_list.text: -------------------------------------------------------------------------------- 1 | ## foo 2 | 3 | 1. bar: 4 | 5 | > - one 6 | - two 7 | - three 8 | - four 9 | - five 10 | 11 | 1. foo: 12 | 13 | ``` 14 | line 1 15 | line 2 16 | ``` 17 | 18 | 1. foo: 19 | 20 | 1. foo `bar` bar: 21 | 22 | ``` erb 23 | some code here 24 | ``` 25 | 26 | 2. foo `bar` bar: 27 | 28 | ``` erb 29 | foo 30 | --- 31 | bar 32 | --- 33 | foo 34 | bar 35 | ``` 36 | 37 | 3. foo `bar` bar: 38 | 39 | ``` html 40 | --- 41 | foo 42 | foo 43 | --- 44 | bar 45 | ``` 46 | 47 | 4. foo `bar` bar: 48 | 49 | foo 50 | --- 51 | bar 52 | 53 | 5. foo 54 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_del.html: -------------------------------------------------------------------------------- 1 |

hello hi world

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_del.text: -------------------------------------------------------------------------------- 1 | hello ~~hi~~ world 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_em.html: -------------------------------------------------------------------------------- 1 |

These words should_not_be_emphasized.

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_em.text: -------------------------------------------------------------------------------- 1 | These words should_not_be_emphasized. 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_links.html: -------------------------------------------------------------------------------- 1 |

This should be a link: 2 | http://example.com/hello-world.

3 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_links.text: -------------------------------------------------------------------------------- 1 | This should be a link: http://example.com/hello-world. 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_tables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Heading 1Heading 2
Cell 1Cell 2
Cell 3Cell 4
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
Header 1Header 2Header 3Header 4
Cell 1Cell 2Cell 3Cell 4
Cell 5Cell 6Cell 7Cell 8
19 |
Test code
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Header 1Header 2
Cell 1Cell 2
Cell 3Cell 4
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
Header 1Header 2Header 3Header 4
Cell 1Cell 2Cell 3Cell 4
Cell 5Cell 6Cell 7Cell 8
38 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/gfm_tables.text: -------------------------------------------------------------------------------- 1 | | Heading 1 | Heading 2 2 | | --------- | --------- 3 | | Cell 1 | Cell 2 4 | | Cell 3 | Cell 4 5 | 6 | | Header 1 | Header 2 | Header 3 | Header 4 | 7 | | :------: | -------: | :------- | -------- | 8 | | Cell 1 | Cell 2 | Cell 3 | Cell 4 | 9 | | Cell 5 | Cell 6 | Cell 7 | Cell 8 | 10 | 11 | Test code 12 | 13 | Header 1 | Header 2 14 | -------- | -------- 15 | Cell 1 | Cell 2 16 | Cell 3 | Cell 4 17 | 18 | Header 1|Header 2|Header 3|Header 4 19 | :-------|:------:|-------:|-------- 20 | Cell 1 |Cell 2 |Cell 3 |Cell 4 21 | *Cell 5*|Cell 6 |Cell 7 |Cell 8 22 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.html: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/horizontal_rules.html: -------------------------------------------------------------------------------- 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 | 25 |

Asterisks:

26 | 27 |
28 | 29 |
30 | 31 |
32 | 33 |
34 | 35 |
***
36 | 
37 | 38 |
39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |
* * *
47 | 
48 | 49 |

Underscores:

50 | 51 |
52 | 53 |
54 | 55 |
56 | 57 |
58 | 59 |
___
60 | 
61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 |
_ _ _
71 | 
72 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/hr_list_break.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • hello 3 | world
  • 4 |
  • how 5 | are
  • 6 |
7 | 8 |
9 | 10 |

you today?

11 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/hr_list_break.text: -------------------------------------------------------------------------------- 1 | * hello 2 | world 3 | * how 4 | are 5 | * * * 6 | you today? 7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/inline_html_advanced.html: -------------------------------------------------------------------------------- 1 |

Simple block on one line:

2 | 3 |
foo
4 | 5 |

And nested without indentation:

6 | 7 |
8 |
9 |
10 | foo 11 |
12 |
13 |
14 |
bar
15 |
16 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/inline_html_advanced.text: -------------------------------------------------------------------------------- 1 | Simple block on one line: 2 | 3 |
foo
4 | 5 | And nested without indentation: 6 | 7 |
8 |
9 |
10 | foo 11 |
12 |
13 |
14 |
bar
15 |
16 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/inline_html_comments.html: -------------------------------------------------------------------------------- 1 |

Paragraph one.

2 | 3 | 4 | 5 | 8 | 9 |

Paragraph two.

10 | 11 | 12 | 13 |

The end.

14 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/inline_html_comments.text: -------------------------------------------------------------------------------- 1 | Paragraph one. 2 | 3 | 4 | 5 | 8 | 9 | Paragraph two. 10 | 11 | 12 | 13 | The end. 14 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/inline_html_simple.html: -------------------------------------------------------------------------------- 1 |

Here's a simple block:

2 | 3 |
4 | foo 5 |
6 | 7 |

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 |
22 |
23 |
24 | foo 25 |
26 |
27 |
28 | 29 |

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 |
57 | 58 |
59 | 60 |
61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 |
71 | 72 |
73 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/inline_html_simple.text: -------------------------------------------------------------------------------- 1 | Here's a simple block: 2 | 3 |
4 | foo 5 |
6 | 7 | This should be a code block, though: 8 | 9 |
10 | foo 11 |
12 | 13 | As should this: 14 | 15 |
foo
16 | 17 | Now, nested: 18 | 19 |
20 |
21 |
22 | foo 23 |
24 |
25 |
26 | 27 | This should just be an HTML comment: 28 | 29 | 30 | 31 | Multiline: 32 | 33 | 37 | 38 | Code block: 39 | 40 | 41 | 42 | Just plain comment, with trailing spaces on the line: 43 | 44 | 45 | 46 | Code: 47 | 48 |
49 | 50 | Hr's: 51 | 52 |
53 | 54 |
55 | 56 |
57 | 58 |
59 | 60 |
61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/lazy_blockquotes.html: -------------------------------------------------------------------------------- 1 |
2 |

hi there 3 | bud

4 |
5 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/lazy_blockquotes.text: -------------------------------------------------------------------------------- 1 | > hi there 2 | bud 3 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/links_inline_style.html: -------------------------------------------------------------------------------- 1 |

Just a URL.

2 | 3 |

URL and title.

4 | 5 |

URL and title.

6 | 7 |

URL and title.

8 | 9 |

URL and title.

10 | 11 |

URL and title.

12 | 13 |

URL and title.

14 | 15 |

Empty.

16 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | [URL and title]( /url/has space ). 12 | 13 | [URL and title]( /url/has space/ "url has space and title"). 14 | 15 | [Empty](). 16 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 |
21 | 22 |

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 |
47 | 48 |

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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 |

this and the other

10 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/list_item_text.html: -------------------------------------------------------------------------------- 1 |
  • item1

    • item2

    text

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/list_item_text.text: -------------------------------------------------------------------------------- 1 | * item1 2 | 3 | * item2 4 | 5 | text 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/literal_quotes_in_titles.html: -------------------------------------------------------------------------------- 1 |

Foo bar.

2 | 3 |

Foo bar.

4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/loose_lists.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • hello 3 | world

    4 | 5 |

    how 6 | are

  • 7 |
  • you
  • 8 |
9 | 10 | 11 | 12 |

better behavior:

13 | 14 |
  • hello

    • world 15 | how

      are 16 | you

    • today

  • hi
17 | 18 | 19 | 20 |
    21 |
  • hello

  • 22 |
  • world

  • 23 |
  • hi
  • 24 |
25 | 26 | 27 | 28 |
    29 |
  • hello
  • 30 |
  • world

  • 31 |
  • hi

  • 32 |
33 | 34 | 35 | 36 |
    37 |
  • hello
  • 38 |
  • world

    39 | 40 |

    how

  • 41 |
  • hi
  • 42 |
43 | 44 | 45 | 46 |
    47 |
  • hello
  • 48 |
  • world
  • 49 |
  • how

    50 | 51 |

    are

  • 52 |
53 | 54 | 55 | 56 |
    57 |
  • hello
  • 58 |
  • world

  • 59 |
  • how

    60 | 61 |

    are

  • 62 |
63 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/loose_lists.text: -------------------------------------------------------------------------------- 1 | * hello 2 | world 3 | 4 | how 5 | are 6 | * you 7 | 8 | 9 | 10 | better behavior: 11 | 12 | * hello 13 | * world 14 | how 15 | 16 | are 17 | you 18 | 19 | * today 20 | * hi 21 | 22 | 23 | 24 | * hello 25 | 26 | * world 27 | * hi 28 | 29 | 30 | 31 | * hello 32 | * world 33 | 34 | * hi 35 | 36 | 37 | 38 | * hello 39 | * world 40 | 41 | how 42 | * hi 43 | 44 | 45 | 46 | * hello 47 | * world 48 | * how 49 | 50 | are 51 | 52 | 53 | 54 | * hello 55 | * world 56 | 57 | * how 58 | 59 | are 60 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/main.html: -------------------------------------------------------------------------------- 1 |

A heading

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

    • New List Item 1 Hi, this is a list item.
    • New List Item 2 Another item
      Code goes here.
      3 | Lots of it...
    • New List Item 3 The last item
  • 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

Another Heading

Hello world. Here is a link. And an image alt.

Code goes here.
4 | Lots of it...
5 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 ![alt](src). 53 | 54 | Code goes here. 55 | Lots of it... 56 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/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 `

` and `

` are created by 44 | "underlining" with equal signs (`=`) and hyphens (`-`), respectively. 45 | To create an atx-style header, you put 1-6 hash marks (`#`) at the 46 | beginning of the line -- the number of hashes equals the resulting 47 | HTML header level. 48 | 49 | Blockquotes are indicated using email-style '`>`' angle brackets. 50 | 51 | Markdown: 52 | 53 | A First Level Header 54 | ==================== 55 | 56 | A Second Level Header 57 | --------------------- 58 | 59 | Now is the time for all good men to come to 60 | the aid of their country. This is just a 61 | regular paragraph. 62 | 63 | The quick brown fox jumped over the lazy 64 | dog's back. 65 | 66 | ### Header 3 67 | 68 | > This is a blockquote. 69 | > 70 | > This is the second paragraph in the blockquote. 71 | > 72 | > ## This is an H2 in a blockquote 73 | 74 | 75 | Output: 76 | 77 |

A First Level Header

78 | 79 |

A Second Level Header

80 | 81 |

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 |

Header 3

89 | 90 |
91 |

This is a blockquote.

92 | 93 |

This is the second paragraph in the blockquote.

94 | 95 |

This is an H2 in a blockquote

96 |
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 |

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 |
    147 |
  • Candy.
  • 148 |
  • Gum.
  • 149 |
  • Booze.
  • 150 |
151 | 152 | Ordered (numbered) lists use regular numbers, followed by periods, as 153 | list markers: 154 | 155 | 1. Red 156 | 2. Green 157 | 3. Blue 158 | 159 | Output: 160 | 161 |
    162 |
  1. Red
  2. 163 |
  3. Green
  4. 164 |
  5. Blue
  6. 165 |
166 | 167 | If you put blank lines between items, you'll get `

` 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 |

    180 |
  • A list item.

    181 |

    With multiple paragraphs.

  • 182 |
  • Another item in the list.

  • 183 |
184 | 185 | 186 | 187 | ### Links ### 188 | 189 | Markdown supports two styles for creating links: *inline* and 190 | *reference*. With both styles, you use square brackets to delimit the 191 | text you want to turn into a link. 192 | 193 | Inline-style links use parentheses immediately after the link text. 194 | For example: 195 | 196 | This is an [example link](http://example.com/). 197 | 198 | Output: 199 | 200 |

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 | ![alt text](/path/to/img.jpg "Title") 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 | alt text 260 | 261 | 262 | 263 | ### Code ### 264 | 265 | In a regular paragraph, you can create code span by wrapping text in 266 | backtick quotes. Any ampersands (`&`) and angle brackets (`<` or 267 | `>`) will automatically be translated into HTML entities. This makes 268 | it easy to use Markdown to write about HTML example code: 269 | 270 | I strongly recommend against using any `` tags. 271 | 272 | I wish SmartyPants used named entities like `—` 273 | instead of decimal-encoded entites like `—`. 274 | 275 | Output: 276 | 277 |

I strongly recommend against using any 278 | <blink> tags.

279 | 280 |

I wish SmartyPants used named entities like 281 | &mdash; instead of decimal-encoded 282 | entites like &#8212;.

283 | 284 | 285 | To specify an entire block of pre-formatted code, indent every line of 286 | the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, 287 | and `>` characters will be escaped automatically. 288 | 289 | Markdown: 290 | 291 | If you want your page to validate under XHTML 1.0 Strict, 292 | you've got to put paragraph tags in your blockquotes: 293 | 294 |
295 |

For example.

296 |
297 | 298 | Output: 299 | 300 |

If you want your page to validate under XHTML 1.0 Strict, 301 | you've got to put paragraph tags in your blockquotes:

302 | 303 |
<blockquote>
304 |         <p>For example.</p>
305 |     </blockquote>
306 |     
307 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/nested_blockquotes.html: -------------------------------------------------------------------------------- 1 |
2 |

foo

3 | 4 |
5 |

bar

6 |
7 | 8 |

foo

9 |
10 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/nested_blockquotes.text: -------------------------------------------------------------------------------- 1 | > foo 2 | > 3 | > > bar 4 | > 5 | > foo 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/nested_code.html: -------------------------------------------------------------------------------- 1 |

hi ther `` ok ```

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/nested_code.text: -------------------------------------------------------------------------------- 1 | ````` hi ther `` ok ``` ````` 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/nested_em.html: -------------------------------------------------------------------------------- 1 |

test test test

2 | 3 |

test test test

4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/nested_em.text: -------------------------------------------------------------------------------- 1 | *test **test** test* 2 | 3 | _test __test__ test_ 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/nested_square_link.html: -------------------------------------------------------------------------------- 1 |

the ] character

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/nested_square_link.text: -------------------------------------------------------------------------------- 1 | [the `]` character](/url) 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/not_a_link.html: -------------------------------------------------------------------------------- 1 |

[test](not a link)

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/not_a_link.text: -------------------------------------------------------------------------------- 1 | \[test](not a link) 2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/ordered_and_unordered_lists.html: -------------------------------------------------------------------------------- 1 |

Unordered

2 | 3 |

Asterisks tight:

4 | 5 |
    6 |
  • asterisk 1
  • 7 |
  • asterisk 2
  • 8 |
  • asterisk 3
  • 9 |
10 | 11 |

Asterisks loose:

12 | 13 |
    14 |
  • asterisk 1

  • 15 |
  • asterisk 2

  • 16 |
  • asterisk 3

  • 17 |
18 | 19 |
20 | 21 |

Pluses tight:

22 | 23 |
    24 |
  • Plus 1
  • 25 |
  • Plus 2
  • 26 |
  • Plus 3
  • 27 |
28 | 29 |

Pluses loose:

30 | 31 |
    32 |
  • Plus 1

  • 33 |
  • Plus 2

  • 34 |
  • Plus 3

  • 35 |
36 | 37 |
38 | 39 |

Minuses tight:

40 | 41 |
    42 |
  • Minus 1
  • 43 |
  • Minus 2
  • 44 |
  • Minus 3
  • 45 |
46 | 47 |

Minuses loose:

48 | 49 |
    50 |
  • Minus 1

  • 51 |
  • Minus 2

  • 52 |
  • Minus 3

  • 53 |
54 | 55 |

Ordered

56 | 57 |

Tight:

58 | 59 |
    60 |
  1. First
  2. 61 |
  3. Second
  4. 62 |
  5. Third
  6. 63 |
64 | 65 |

and:

66 | 67 |
    68 |
  1. One
  2. 69 |
  3. Two
  4. 70 |
  5. Three
  6. 71 |
72 | 73 |

Loose using tabs:

74 | 75 |
    76 |
  1. First

  2. 77 |
  3. Second

  4. 78 |
  5. Third

  6. 79 |
80 | 81 |

and using spaces:

82 | 83 |
    84 |
  1. One

  2. 85 |
  3. Two

  4. 86 |
  5. Three

  6. 87 |
88 | 89 |

Multiple paragraphs:

90 | 91 |
    92 |
  1. Item 1, graf one.

    93 | 94 |

    Item 2. graf two. The quick brown fox jumped over the lazy dog's 95 | back.

  2. 96 |
  3. Item 2.

  4. 97 |
  5. Item 3.

  6. 98 |
99 | 100 |

Nested

101 | 102 |
    103 |
  • Tab 104 |
      105 |
    • Tab 106 |
        107 |
      • Tab
      • 108 |
    • 109 |
  • 110 |
111 | 112 |

Here's another:

113 | 114 |
    115 |
  1. First
  2. 116 |
  3. Second: 117 |
      118 |
    • Fee
    • 119 |
    • Fie
    • 120 |
    • Foe
    • 121 |
  4. 122 |
  5. Third
  6. 123 |
124 | 125 |

Same thing but with paragraphs:

126 | 127 |
    128 |
  1. First

  2. 129 |
  3. Second:

    130 | 131 |
      132 |
    • Fee
    • 133 |
    • Fie
    • 134 |
    • Foe
    • 135 |
  4. 136 |
  5. Third

  6. 137 |
138 | 139 | 140 |

This was an error in Markdown 1.0.1:

141 | 142 |
    143 |
  • this

    144 | 145 |
    • sub
    146 | 147 |

    that

  • 148 |
149 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/ordered_and_unordered_lists.text: -------------------------------------------------------------------------------- 1 | ## Unordered 2 | 3 | Asterisks tight: 4 | 5 | * asterisk 1 6 | * asterisk 2 7 | * asterisk 3 8 | 9 | 10 | Asterisks loose: 11 | 12 | * asterisk 1 13 | 14 | * asterisk 2 15 | 16 | * asterisk 3 17 | 18 | * * * 19 | 20 | Pluses tight: 21 | 22 | + Plus 1 23 | + Plus 2 24 | + Plus 3 25 | 26 | 27 | Pluses loose: 28 | 29 | + Plus 1 30 | 31 | + Plus 2 32 | 33 | + Plus 3 34 | 35 | * * * 36 | 37 | 38 | Minuses tight: 39 | 40 | - Minus 1 41 | - Minus 2 42 | - Minus 3 43 | 44 | 45 | Minuses loose: 46 | 47 | - Minus 1 48 | 49 | - Minus 2 50 | 51 | - Minus 3 52 | 53 | 54 | ## Ordered 55 | 56 | Tight: 57 | 58 | 1. First 59 | 2. Second 60 | 3. Third 61 | 62 | and: 63 | 64 | 1. One 65 | 2. Two 66 | 3. Three 67 | 68 | 69 | Loose using tabs: 70 | 71 | 1. First 72 | 73 | 2. Second 74 | 75 | 3. Third 76 | 77 | and using spaces: 78 | 79 | 1. One 80 | 81 | 2. Two 82 | 83 | 3. Three 84 | 85 | Multiple paragraphs: 86 | 87 | 1. Item 1, graf one. 88 | 89 | Item 2. graf two. The quick brown fox jumped over the lazy dog's 90 | back. 91 | 92 | 2. Item 2. 93 | 94 | 3. Item 3. 95 | 96 | 97 | 98 | ## Nested 99 | 100 | * Tab 101 | * Tab 102 | * Tab 103 | 104 | Here's another: 105 | 106 | 1. First 107 | 2. Second: 108 | * Fee 109 | * Fie 110 | * Foe 111 | 3. Third 112 | 113 | Same thing but with paragraphs: 114 | 115 | 1. First 116 | 117 | 2. Second: 118 | * Fee 119 | * Fie 120 | * Foe 121 | 122 | 3. Third 123 | 124 | 125 | This was an error in Markdown 1.0.1: 126 | 127 | * this 128 | 129 | * sub 130 | 131 | that 132 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/ref_paren.html: -------------------------------------------------------------------------------- 1 |

hi

2 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/ref_paren.text: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [hi]: /url (there) 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/same_bullet.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • test
  • 3 |
  • test
  • 4 |
  • test
  • 5 |
6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/same_bullet.text: -------------------------------------------------------------------------------- 1 | * test 2 | + test 3 | - test 4 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/strong_and_em_together.html: -------------------------------------------------------------------------------- 1 |

This is strong and em.

2 | 3 |

So is this word.

4 | 5 |

This is strong and em.

6 | 7 |

So is this word.

8 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/strong_and_em_together.text: -------------------------------------------------------------------------------- 1 | ***This is strong and em.*** 2 | 3 | So is ***this*** word. 4 | 5 | ___This is strong and em.___ 6 | 7 | So is ___this___ word. 8 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/tabs.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • this is a list item 3 | indented with tabs

  • 4 |
  • this is a list item 5 | indented with spaces

  • 6 |
7 | 8 |

Code:

9 | 10 |
this code block is indented by one tab
11 | 
12 | 13 |

And:

14 | 15 |
    this code block is indented by two tabs
16 | 
17 | 18 |

And:

19 | 20 |
+   this is an example list item
21 |     indented with tabs
22 | 
23 | +   this is an example list item
24 |     indented with spaces
25 | 
26 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/tabs.text: -------------------------------------------------------------------------------- 1 | + this is a list item 2 | indented with tabs 3 | 4 | + this is a list item 5 | indented with spaces 6 | 7 | Code: 8 | 9 | this code block is indented by one tab 10 | 11 | And: 12 | 13 | this code block is indented by two tabs 14 | 15 | And: 16 | 17 | + this is an example list item 18 | indented with tabs 19 | 20 | + this is an example list item 21 | indented with spaces 22 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/text.smartypants.html: -------------------------------------------------------------------------------- 1 |

Hello world ‘how’ “are” you — today…

2 | 3 |

“It’s a more ‘challenging’ smartypants test…”

4 | 5 |

‘And,’ as a bonus — “one 6 | multiline” test!

7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/text.smartypants.text: -------------------------------------------------------------------------------- 1 | Hello world 'how' "are" you -- today... 2 | 3 | "It's a more 'challenging' smartypants test..." 4 | 5 | 'And,' as a bonus -- "one 6 | multiline" test! 7 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/tidyness.html: -------------------------------------------------------------------------------- 1 |
2 |

A list within a blockquote:

3 |
    4 |
  • asterisk 1
  • 5 |
  • asterisk 2
  • 6 |
  • asterisk 3
  • 7 |
8 |
9 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/tidyness.text: -------------------------------------------------------------------------------- 1 | > A list within a blockquote: 2 | > 3 | > * asterisk 1 4 | > * asterisk 2 5 | > * asterisk 3 6 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/toplevel_paragraphs.gfm.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 |
10 | 11 |

hello world

12 |

how are you

13 | 14 |

hello world

15 |

how are you

16 | 17 |

hello world

18 |

how are you

19 | 20 |

hello world

21 |
  • how are you
22 | 23 |

hello world

24 |
how are you
25 | 26 |

hello world 27 | how are you

28 | 29 |

hello world 30 |

31 | 32 |
hello
33 | 34 |

hello

35 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/toplevel_paragraphs.gfm.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 |
how are you
28 | 29 | hello world 30 | how are you 31 | 32 | hello [world][how] 33 | [how]: /are/you 34 | 35 |
hello
36 | 37 | hello 38 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/tricky_list.html: -------------------------------------------------------------------------------- 1 |

hello world

2 | 3 |
    4 |
  • hello world
  • 5 |
6 | 7 |

hello world

8 | 9 |
    10 |
  • hello world
  • 11 |
12 | 13 |

hello world

14 | 15 |
    16 |
  • Hello world
  • 17 |
18 | 19 |

hello world

20 | 21 |
    22 |
  • hello world
  • 23 |
24 | -------------------------------------------------------------------------------- /app/bower_components/marked/test/tests/tricky_list.text: -------------------------------------------------------------------------------- 1 | **hello** _world_ 2 | 3 | * hello world 4 | 5 | **hello** _world_ 6 | 7 | * hello world 8 | 9 | **hello** _world_ 10 | 11 | * Hello world 12 | 13 | **hello** _world_ 14 | 15 | * hello world 16 | -------------------------------------------------------------------------------- /app/bower_components/normalize-css/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "normalize-css", 3 | "version": "3.0.1", 4 | "main": "normalize.css", 5 | "author": "Nicolas Gallagher", 6 | "ignore": [ 7 | "CHANGELOG.md", 8 | "CONTRIBUTING.md", 9 | "component.json", 10 | "package.json", 11 | "test.html" 12 | ], 13 | "homepage": "https://github.com/necolas/normalize.css", 14 | "_release": "3.0.1", 15 | "_resolution": { 16 | "type": "version", 17 | "tag": "3.0.1", 18 | "commit": "e3c71c911b0c0ebc0ee14d2421543ce1476fd761" 19 | }, 20 | "_source": "git://github.com/necolas/normalize.css.git", 21 | "_target": "~3.0.1", 22 | "_originalSource": "normalize-css", 23 | "_direct": true 24 | } -------------------------------------------------------------------------------- /app/bower_components/normalize-css/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) Nicolas Gallagher and Jonathan Neal 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | 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 THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /app/bower_components/normalize-css/README.md: -------------------------------------------------------------------------------- 1 | # normalize.css v3 2 | 3 | Normalize.css is a customisable CSS file that makes browsers render all 4 | elements more consistently and in line with modern standards. 5 | 6 | The project relies on researching the differences between default browser 7 | styles in order to precisely target only the styles that need or benefit from 8 | normalizing. 9 | 10 | [View the test file](http://necolas.github.io/normalize.css/latest/test.html) 11 | 12 | ## Install 13 | 14 | Download from the [project page](http://necolas.github.io/normalize.css/). 15 | 16 | Install with [Component(1)](https://github.com/component/component/): `component install necolas/normalize.css` 17 | 18 | Install with [npm](http://npmjs.org/): `npm install --save normalize.css` 19 | 20 | Install with [Bower](http://bower.io/): `bower install --save normalize.css` 21 | 22 | ## What does it do? 23 | 24 | * Preserves useful defaults, unlike many CSS resets. 25 | * Normalizes styles for a wide range of elements. 26 | * Corrects bugs and common browser inconsistencies. 27 | * Improves usability with subtle improvements. 28 | * Explains what code does using detailed comments. 29 | 30 | ## How to use it 31 | 32 | No other styles should come before Normalize.css. 33 | 34 | It is recommended that you include the `normalize.css` file as untouched 35 | library code. 36 | 37 | ## Browser support 38 | 39 | * Google Chrome (latest) 40 | * Mozilla Firefox (latest) 41 | * Mozilla Firefox 4 42 | * Opera (latest) 43 | * Apple Safari 6+ 44 | * Internet Explorer 8+ 45 | 46 | [Normalize.css v1 provides legacy browser 47 | support](https://github.com/necolas/normalize.css/tree/v1) (IE 6+, Safari 4+), 48 | but is no longer actively developed. 49 | 50 | ## Contributing 51 | 52 | Please read the CONTRIBUTING.md 53 | 54 | ## Acknowledgements 55 | 56 | Normalize.css is a project by [Nicolas Gallagher](https://github.com/necolas), 57 | co-created with [Jonathan Neal](https://github.com/jonathantneal). 58 | -------------------------------------------------------------------------------- /app/bower_components/normalize-css/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "normalize-css", 3 | "version": "3.0.1", 4 | "main": "normalize.css", 5 | "author": "Nicolas Gallagher", 6 | "ignore": [ 7 | "CHANGELOG.md", 8 | "CONTRIBUTING.md", 9 | "component.json", 10 | "package.json", 11 | "test.html" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /app/bower_components/normalize-css/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v3.0.1 | MIT License | git.io/normalize */ 2 | 3 | /** 4 | * 1. Set default font family to sans-serif. 5 | * 2. Prevent iOS text size adjust after orientation change, without disabling 6 | * user zoom. 7 | */ 8 | 9 | html { 10 | font-family: sans-serif; /* 1 */ 11 | -ms-text-size-adjust: 100%; /* 2 */ 12 | -webkit-text-size-adjust: 100%; /* 2 */ 13 | } 14 | 15 | /** 16 | * Remove default margin. 17 | */ 18 | 19 | body { 20 | margin: 0; 21 | } 22 | 23 | /* HTML5 display definitions 24 | ========================================================================== */ 25 | 26 | /** 27 | * Correct `block` display not defined for any HTML5 element in IE 8/9. 28 | * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox. 29 | * Correct `block` display not defined for `main` in IE 11. 30 | */ 31 | 32 | article, 33 | aside, 34 | details, 35 | figcaption, 36 | figure, 37 | footer, 38 | header, 39 | hgroup, 40 | main, 41 | nav, 42 | section, 43 | summary { 44 | display: block; 45 | } 46 | 47 | /** 48 | * 1. Correct `inline-block` display not defined in IE 8/9. 49 | * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. 50 | */ 51 | 52 | audio, 53 | canvas, 54 | progress, 55 | video { 56 | display: inline-block; /* 1 */ 57 | vertical-align: baseline; /* 2 */ 58 | } 59 | 60 | /** 61 | * Prevent modern browsers from displaying `audio` without controls. 62 | * Remove excess height in iOS 5 devices. 63 | */ 64 | 65 | audio:not([controls]) { 66 | display: none; 67 | height: 0; 68 | } 69 | 70 | /** 71 | * Address `[hidden]` styling not present in IE 8/9/10. 72 | * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. 73 | */ 74 | 75 | [hidden], 76 | template { 77 | display: none; 78 | } 79 | 80 | /* Links 81 | ========================================================================== */ 82 | 83 | /** 84 | * Remove the gray background color from active links in IE 10. 85 | */ 86 | 87 | a { 88 | background: transparent; 89 | } 90 | 91 | /** 92 | * Improve readability when focused and also mouse hovered in all browsers. 93 | */ 94 | 95 | a:active, 96 | a:hover { 97 | outline: 0; 98 | } 99 | 100 | /* Text-level semantics 101 | ========================================================================== */ 102 | 103 | /** 104 | * Address styling not present in IE 8/9/10/11, Safari, and Chrome. 105 | */ 106 | 107 | abbr[title] { 108 | border-bottom: 1px dotted; 109 | } 110 | 111 | /** 112 | * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. 113 | */ 114 | 115 | b, 116 | strong { 117 | font-weight: bold; 118 | } 119 | 120 | /** 121 | * Address styling not present in Safari and Chrome. 122 | */ 123 | 124 | dfn { 125 | font-style: italic; 126 | } 127 | 128 | /** 129 | * Address variable `h1` font-size and margin within `section` and `article` 130 | * contexts in Firefox 4+, Safari, and Chrome. 131 | */ 132 | 133 | h1 { 134 | font-size: 2em; 135 | margin: 0.67em 0; 136 | } 137 | 138 | /** 139 | * Address styling not present in IE 8/9. 140 | */ 141 | 142 | mark { 143 | background: #ff0; 144 | color: #000; 145 | } 146 | 147 | /** 148 | * Address inconsistent and variable font size in all browsers. 149 | */ 150 | 151 | small { 152 | font-size: 80%; 153 | } 154 | 155 | /** 156 | * Prevent `sub` and `sup` affecting `line-height` in all browsers. 157 | */ 158 | 159 | sub, 160 | sup { 161 | font-size: 75%; 162 | line-height: 0; 163 | position: relative; 164 | vertical-align: baseline; 165 | } 166 | 167 | sup { 168 | top: -0.5em; 169 | } 170 | 171 | sub { 172 | bottom: -0.25em; 173 | } 174 | 175 | /* Embedded content 176 | ========================================================================== */ 177 | 178 | /** 179 | * Remove border when inside `a` element in IE 8/9/10. 180 | */ 181 | 182 | img { 183 | border: 0; 184 | } 185 | 186 | /** 187 | * Correct overflow not hidden in IE 9/10/11. 188 | */ 189 | 190 | svg:not(:root) { 191 | overflow: hidden; 192 | } 193 | 194 | /* Grouping content 195 | ========================================================================== */ 196 | 197 | /** 198 | * Address margin not present in IE 8/9 and Safari. 199 | */ 200 | 201 | figure { 202 | margin: 1em 40px; 203 | } 204 | 205 | /** 206 | * Address differences between Firefox and other browsers. 207 | */ 208 | 209 | hr { 210 | -moz-box-sizing: content-box; 211 | box-sizing: content-box; 212 | height: 0; 213 | } 214 | 215 | /** 216 | * Contain overflow in all browsers. 217 | */ 218 | 219 | pre { 220 | overflow: auto; 221 | } 222 | 223 | /** 224 | * Address odd `em`-unit font size rendering in all browsers. 225 | */ 226 | 227 | code, 228 | kbd, 229 | pre, 230 | samp { 231 | font-family: monospace, monospace; 232 | font-size: 1em; 233 | } 234 | 235 | /* Forms 236 | ========================================================================== */ 237 | 238 | /** 239 | * Known limitation: by default, Chrome and Safari on OS X allow very limited 240 | * styling of `select`, unless a `border` property is set. 241 | */ 242 | 243 | /** 244 | * 1. Correct color not being inherited. 245 | * Known issue: affects color of disabled elements. 246 | * 2. Correct font properties not being inherited. 247 | * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. 248 | */ 249 | 250 | button, 251 | input, 252 | optgroup, 253 | select, 254 | textarea { 255 | color: inherit; /* 1 */ 256 | font: inherit; /* 2 */ 257 | margin: 0; /* 3 */ 258 | } 259 | 260 | /** 261 | * Address `overflow` set to `hidden` in IE 8/9/10/11. 262 | */ 263 | 264 | button { 265 | overflow: visible; 266 | } 267 | 268 | /** 269 | * Address inconsistent `text-transform` inheritance for `button` and `select`. 270 | * All other form control elements do not inherit `text-transform` values. 271 | * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. 272 | * Correct `select` style inheritance in Firefox. 273 | */ 274 | 275 | button, 276 | select { 277 | text-transform: none; 278 | } 279 | 280 | /** 281 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 282 | * and `video` controls. 283 | * 2. Correct inability to style clickable `input` types in iOS. 284 | * 3. Improve usability and consistency of cursor style between image-type 285 | * `input` and others. 286 | */ 287 | 288 | button, 289 | html input[type="button"], /* 1 */ 290 | input[type="reset"], 291 | input[type="submit"] { 292 | -webkit-appearance: button; /* 2 */ 293 | cursor: pointer; /* 3 */ 294 | } 295 | 296 | /** 297 | * Re-set default cursor for disabled elements. 298 | */ 299 | 300 | button[disabled], 301 | html input[disabled] { 302 | cursor: default; 303 | } 304 | 305 | /** 306 | * Remove inner padding and border in Firefox 4+. 307 | */ 308 | 309 | button::-moz-focus-inner, 310 | input::-moz-focus-inner { 311 | border: 0; 312 | padding: 0; 313 | } 314 | 315 | /** 316 | * Address Firefox 4+ setting `line-height` on `input` using `!important` in 317 | * the UA stylesheet. 318 | */ 319 | 320 | input { 321 | line-height: normal; 322 | } 323 | 324 | /** 325 | * It's recommended that you don't attempt to style these elements. 326 | * Firefox's implementation doesn't respect box-sizing, padding, or width. 327 | * 328 | * 1. Address box sizing set to `content-box` in IE 8/9/10. 329 | * 2. Remove excess padding in IE 8/9/10. 330 | */ 331 | 332 | input[type="checkbox"], 333 | input[type="radio"] { 334 | box-sizing: border-box; /* 1 */ 335 | padding: 0; /* 2 */ 336 | } 337 | 338 | /** 339 | * Fix the cursor style for Chrome's increment/decrement buttons. For certain 340 | * `font-size` values of the `input`, it causes the cursor style of the 341 | * decrement button to change from `default` to `text`. 342 | */ 343 | 344 | input[type="number"]::-webkit-inner-spin-button, 345 | input[type="number"]::-webkit-outer-spin-button { 346 | height: auto; 347 | } 348 | 349 | /** 350 | * 1. Address `appearance` set to `searchfield` in Safari and Chrome. 351 | * 2. Address `box-sizing` set to `border-box` in Safari and Chrome 352 | * (include `-moz` to future-proof). 353 | */ 354 | 355 | input[type="search"] { 356 | -webkit-appearance: textfield; /* 1 */ 357 | -moz-box-sizing: content-box; 358 | -webkit-box-sizing: content-box; /* 2 */ 359 | box-sizing: content-box; 360 | } 361 | 362 | /** 363 | * Remove inner padding and search cancel button in Safari and Chrome on OS X. 364 | * Safari (but not Chrome) clips the cancel button when the search input has 365 | * padding (and `textfield` appearance). 366 | */ 367 | 368 | input[type="search"]::-webkit-search-cancel-button, 369 | input[type="search"]::-webkit-search-decoration { 370 | -webkit-appearance: none; 371 | } 372 | 373 | /** 374 | * Define consistent border, margin, and padding. 375 | */ 376 | 377 | fieldset { 378 | border: 1px solid #c0c0c0; 379 | margin: 0 2px; 380 | padding: 0.35em 0.625em 0.75em; 381 | } 382 | 383 | /** 384 | * 1. Correct `color` not being inherited in IE 8/9/10/11. 385 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 386 | */ 387 | 388 | legend { 389 | border: 0; /* 1 */ 390 | padding: 0; /* 2 */ 391 | } 392 | 393 | /** 394 | * Remove default vertical scrollbar in IE 8/9/10/11. 395 | */ 396 | 397 | textarea { 398 | overflow: auto; 399 | } 400 | 401 | /** 402 | * Don't inherit the `font-weight` (applied by a rule above). 403 | * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. 404 | */ 405 | 406 | optgroup { 407 | font-weight: bold; 408 | } 409 | 410 | /* Tables 411 | ========================================================================== */ 412 | 413 | /** 414 | * Remove most spacing between table cells. 415 | */ 416 | 417 | table { 418 | border-collapse: collapse; 419 | border-spacing: 0; 420 | } 421 | 422 | td, 423 | th { 424 | padding: 0; 425 | } 426 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | var CONFIG = { 2 | // your website's title 3 | document_title: "ECMAScript 6入门", 4 | 5 | // index page 6 | index: "README.md", 7 | 8 | // sidebar file 9 | sidebar_file: "sidebar.md", 10 | 11 | // where the docs are actually stored on github - so you can edit 12 | base_url: "https://github.com/ruanyf/es6tutorial/edit/gh-pages", 13 | }; 14 | 15 | // ************************** 16 | // DON'T EDIT FOLLOWING CODES 17 | // ************************** 18 | 19 | addConfig(ditto, CONFIG); 20 | 21 | function addConfig(obj, conf) { 22 | Object.keys(conf).forEach(function (key) { 23 | obj[key] = conf[key]; 24 | }); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /css/app.css: -------------------------------------------------------------------------------- 1 | /* General Setting */ 2 | 3 | /* Small screens (default) */ 4 | html { font-size: 100%; } 5 | 6 | /* Medium screens (640px) */ 7 | @media (min-width: 40rem) { 8 | html { font-size: 112%; } 9 | } 10 | 11 | /* Large screens (1024px) */ 12 | @media (min-width: 64rem) { 13 | html { font-size: 120%; } 14 | } 15 | 16 | /* Grid */ 17 | 18 | /* Ditto */ 19 | 20 | body { 21 | color: #333; 22 | margin: 0; 23 | padding: 0; 24 | 25 | font-family: Verdana, Arial; 26 | font-size: 0.8rem; 27 | } 28 | 29 | #sidebar { 30 | margin-top: 0; 31 | padding-left: 25px; 32 | padding-bottom:25px; 33 | padding-top: 25px; 34 | 35 | box-shadow: 0 0 40px #CCC; 36 | -webkit-box-shadow: 0 0 40px #CCC; 37 | -moz-box-shadow: 0 0 40px #CCC; 38 | border-right: 1px solid #BBB; 39 | } 40 | 41 | @media (min-width: 40rem) { 42 | #sidebar { 43 | width: 280px; 44 | position: fixed; 45 | height: 100%; 46 | margin-right: 20px; 47 | padding-bottom:0px; 48 | padding-top: 0px; 49 | overflow-y: scroll; 50 | overflow: -moz-scrollbars-vertical; 51 | } 52 | } 53 | 54 | #sidebar h1 { 55 | font-size: 25px; 56 | margin-bottom: 0px; 57 | padding-bottom: 0px; 58 | } 59 | 60 | #sidebar h1 a:link, #sidebar h1 a:visited { 61 | color: #333; 62 | } 63 | 64 | #sidebar h2 { 65 | font-size: 0.7rem; 66 | } 67 | 68 | #sidebar h5 { 69 | margin-top: 20px; 70 | margin-bottom: 0; 71 | } 72 | 73 | #sidebar a:visited, #sidebar a:link { 74 | color: #4682BE; 75 | text-decoration: none; 76 | } 77 | 78 | #sidebar ul { 79 | list-style-type: none; 80 | margin: 0; 81 | padding-left: 10px; 82 | padding-top: 0; 83 | } 84 | 85 | #sidebar ol { 86 | margin: 0; 87 | padding-left: 30px; 88 | padding-top: 0; 89 | } 90 | 91 | #sidebar ul li:before { /* a hack to have dashes as a list style */ 92 | content: "-"; 93 | position: relative; 94 | left: -5px; 95 | } 96 | 97 | #sidebar ul li, 98 | #sidebar ol li { 99 | margin-top: 0; 100 | margin-bottom: 0.2rem; 101 | margin-left: 10px; 102 | padding: 0; 103 | 104 | text-indent: -5px; /* to compensate for the padding for the dash */ 105 | font-size: 0.7rem; 106 | } 107 | 108 | form.searchBox { 109 | width: 180px; 110 | border: 1px solid #4682BE; 111 | height:20px; 112 | position: relative; 113 | } 114 | 115 | input[type=search] { 116 | position: absolute; 117 | top: 0; 118 | left: 0; 119 | width: 160px; 120 | height: 18px; 121 | text-align: left; 122 | border: none; 123 | } 124 | 125 | input.searchButton { 126 | position: absolute; 127 | top: 0; 128 | left: 160px; 129 | height: 18px; 130 | } 131 | 132 | #content { 133 | padding-top: 10px; 134 | padding-bottom: 150px; 135 | margin-left: 20px; 136 | margin-right: 20px; 137 | font-size: 0.8rem; 138 | line-height:1.3rem; 139 | 140 | /* border: 1px solid black; */ 141 | 142 | counter-reset: section; 143 | } 144 | 145 | @media (min-width: 40rem) { 146 | #content { 147 | width: 580px; 148 | padding-left:330px; 149 | margin-left: 0px; 150 | margin-right: 0px; 151 | } 152 | } 153 | 154 | #content pre{ 155 | margin-left: auto; 156 | margin-right: auto; 157 | padding-top: 10px; 158 | padding-bottom: 10px; 159 | padding-left: 0.7rem; 160 | line-height: 1.2; 161 | 162 | color: #FFF; 163 | 164 | background: #111; 165 | border-radius: 5px; 166 | } 167 | 168 | #content code { 169 | color: #a6e22e; 170 | font-size: 0.7rem; 171 | font-weight: normal; 172 | font-family: Consolas,"Courier New",Courier,FreeMono,monospace; 173 | 174 | background: #111; 175 | border-radius: 2px; 176 | } 177 | 178 | #content p code, 179 | #content li>code, 180 | #content h2>code, 181 | #content h3>code{ 182 | padding-left: 3px; 183 | padding-right: 3px; 184 | color: #c7254e; 185 | background: #f9f2f4; 186 | } 187 | 188 | #content h2 { 189 | margin-top: 50px; 190 | margin-bottom: 0px; 191 | 192 | padding-top: 20px; 193 | padding-bottom: 0px; 194 | 195 | font-size: 18px; 196 | text-align: left; 197 | 198 | border-top: 2px solid #666; 199 | 200 | counter-increment: section; 201 | } 202 | 203 | #content h2:before { 204 | content: counter(section) ". "; 205 | } 206 | 207 | #content h3 { 208 | margin-top: 50px; 209 | margin-bottom: 0px; 210 | 211 | padding-top: 20px; 212 | padding-bottom: 0px; 213 | 214 | text-align: left; 215 | border-top: 1px dotted #777; 216 | } 217 | 218 | #content h2:hover, 219 | #content h3:hover { 220 | color: #ED1C24; 221 | } 222 | 223 | #content img { 224 | max-width: 90%; 225 | display: block; 226 | 227 | margin-left: auto; 228 | margin-right: auto; 229 | margin-top: 40px; 230 | margin-bottom: 40px; 231 | 232 | border-radius: 5px; 233 | } 234 | 235 | #content ul { 236 | display: block; 237 | list-style-type: none; 238 | padding-top: 0.5rem; 239 | padding-bottom:0.5rem; 240 | } 241 | 242 | #content ol { 243 | display: block; 244 | padding-top: 0.5rem; 245 | padding-bottom:0.5rem; 246 | } 247 | 248 | 249 | #content ul li:before { /* a hack to have dashes as a list style */ 250 | content: "-"; 251 | position: relative; 252 | left: -5px; 253 | } 254 | 255 | #content ul li, 256 | #content ol li{ 257 | text-indent: -5px; /* to compensate for the padding for the dash */ 258 | font-size: 0.8rem; 259 | } 260 | 261 | #content ul li.link, 262 | #content ol li.link { 263 | color: #2980b9; 264 | text-decoration: none; 265 | font-size: 0.7rem; 266 | font-weight: bold; 267 | cursor: pointer; 268 | } 269 | 270 | #content a:link, #content a:visited { 271 | color: #4682BE; 272 | text-decoration: none; 273 | } 274 | 275 | #content .content-toc{ 276 | background: #bdc3c7; 277 | border-radius: 5px; 278 | } 279 | 280 | #content table{display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all} 281 | 282 | #content table th{font-weight:bold} 283 | 284 | #content table th, 285 | #content table td{padding:6px 13px;border:1px solid #ddd} 286 | 287 | #content table tr{background-color:#fff;border-top:1px solid #ccc} 288 | #content table tr:nth-child(2n){background-color:#f8f8f8} 289 | 290 | #back_to_top { 291 | display: none; 292 | position: fixed; 293 | 294 | height: 20px; 295 | width: 70px; 296 | top: 20px; 297 | 298 | margin-left: 930px; 299 | margin-top: 0px; 300 | 301 | color: #FFF; 302 | line-height: 20px; 303 | text-align: center; 304 | font-size: 10px; 305 | 306 | 307 | border-radius: 5px; 308 | background-color: #AAA; 309 | } 310 | 311 | #back_to_top:hover { 312 | background-color: #444; 313 | cursor: pointer; 314 | } 315 | 316 | #edit { 317 | display: none; 318 | position: fixed; 319 | 320 | height: 17px; 321 | width: 70px; 322 | top: 45px; 323 | 324 | margin-left: 930px; 325 | margin-top: 0px; 326 | 327 | color: #FFF; 328 | line-height: 17px; 329 | text-align: center; 330 | font-size: 10px; 331 | 332 | 333 | border-radius: 5px; 334 | background-color: #AAA; 335 | } 336 | 337 | #edit:hover { 338 | background-color: #444; 339 | cursor: pointer; 340 | } 341 | 342 | #loading, #error { 343 | display: none; 344 | position: fixed; 345 | 346 | top: 0; 347 | height: 17px; 348 | 349 | font-size: 14px; 350 | } 351 | 352 | @media (min-width: 40rem) { 353 | #loading, #error { 354 | display: none; 355 | position: fixed; 356 | 357 | height: 17px; 358 | top: 45%; 359 | 360 | margin-left: 560px; 361 | 362 | font-size: 14px; 363 | } 364 | } 365 | 366 | #flip{ 367 | position:fixed; 368 | height:20px; 369 | width:100%; 370 | bottom:10px; 371 | font-size:10px; 372 | text-align:center; 373 | } 374 | 375 | #pageup,#pagedown{ 376 | height:20px; 377 | width:70px; 378 | display:inline-block; 379 | border-radius: 5px; 380 | background-color: #AAA; 381 | text-align: center; 382 | line-height:20px; 383 | color: #FFF; 384 | } 385 | 386 | #pageup{ 387 | margin-right:5px; 388 | } 389 | 390 | #pageup:hover, 391 | #pagedown:hover{ 392 | background-color: #444; 393 | cursor: pointer; 394 | } 395 | 396 | #pagedown{ 397 | margin-left:5px; 398 | } 399 | 400 | @media (min-width: 40rem) { 401 | #flip{ 402 | margin-left:545px; 403 | width:150px; 404 | } 405 | } 406 | 407 | .progress-indicator-2 { 408 | position: fixed; 409 | top: 0; 410 | left: 0; 411 | height: 3px; 412 | background-color: #0A74DA; 413 | } 414 | 415 | /** 416 | * okaidia theme for JavaScript, CSS and HTML 417 | * Loosely based on Monokai textmate theme by http://www.monokai.nl/ 418 | * @author ocodia 419 | */ 420 | 421 | code[class*="language-"], 422 | pre[class*="language-"] { 423 | color: #a6e22e; 424 | text-shadow: 0 1px rgba(0,0,0,0.3); 425 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 426 | direction: ltr; 427 | text-align: left; 428 | white-space: pre; 429 | word-spacing: normal; 430 | word-break: normal; 431 | 432 | -moz-tab-size: 4; 433 | -o-tab-size: 4; 434 | tab-size: 4; 435 | 436 | -webkit-hyphens: none; 437 | -moz-hyphens: none; 438 | -ms-hyphens: none; 439 | hyphens: none; 440 | } 441 | 442 | /* Code blocks */ 443 | pre[class*="language-"] { 444 | padding: 1em; 445 | margin: .5em 0; 446 | overflow: auto; 447 | border-radius: 0.3em; 448 | } 449 | 450 | :not(pre) > code[class*="language-"], 451 | pre[class*="language-"] { 452 | background: #272822; 453 | } 454 | 455 | /* Inline code */ 456 | :not(pre) > code[class*="language-"] { 457 | padding: .1em; 458 | border-radius: .3em; 459 | } 460 | 461 | .token.comment, 462 | .token.prolog, 463 | .token.doctype, 464 | .token.cdata { 465 | color: #75715e; 466 | } 467 | 468 | .token.punctuation { 469 | color: #f8f8f2; 470 | } 471 | 472 | .namespace { 473 | opacity: .7; 474 | } 475 | 476 | .token.property, 477 | .token.tag, 478 | .token.constant, 479 | .token.symbol { 480 | color: #f92672; 481 | } 482 | 483 | .token.boolean, 484 | .token.number{ 485 | color: #ae81ff; 486 | } 487 | 488 | .token.selector, 489 | .token.attr-name, 490 | .token.string, 491 | .token.builtin { 492 | color: #a6e22e; 493 | } 494 | 495 | 496 | .token.operator, 497 | .token.entity, 498 | .token.url, 499 | .language-css .token.string, 500 | .style .token.string, 501 | .token.variable { 502 | color: #f92672; 503 | } 504 | 505 | .token.atrule, 506 | .token.attr-value 507 | { 508 | color: #e6db74; 509 | } 510 | 511 | 512 | .token.keyword{ 513 | color: #66d9ef; 514 | } 515 | 516 | .token.regex, 517 | .token.important { 518 | color: #fd971f; 519 | } 520 | 521 | .token.important { 522 | font-weight: bold; 523 | } 524 | 525 | .token.entity { 526 | cursor: help; 527 | } 528 | -------------------------------------------------------------------------------- /css/normalize.css: -------------------------------------------------------------------------------- 1 | ../app/bower_components/normalize-css/normalize.css -------------------------------------------------------------------------------- /docs/fp.md: -------------------------------------------------------------------------------- 1 | # 函数式编程 2 | 3 | JavaScript语言从一诞生,就具有函数式编程的烙印。它将函数作为一种独立的数据类型,与其他数据类型处于完全平等的地位。在JavaScript语言中,你可以采用面向对象编程,也可以采用函数式编程。有人甚至说,JavaScript是有史以来第一种被大规模采用的函数式编程语言。 4 | 5 | ES6的种种新增功能,使得函数式编程变得更方便、更强大。本章介绍ES6如何进行函数式编程。 6 | 7 | ## 柯里化 8 | 9 | 柯里化(currying)指的是将一个多参数的函数拆分成一系列函数,每个拆分后的函数都只接受一个参数(unary)。 10 | 11 | ```javascript 12 | function add (a, b) { 13 | return a + b; 14 | } 15 | 16 | add(1, 1) // 2 17 | ``` 18 | 19 | 上面代码中,函数`add`接受两个参数`a`和`b`。 20 | 21 | 柯里化就是将上面的函数拆分成两个函数,每个函数都只接受一个参数。 22 | 23 | ```javascript 24 | function add (a) { 25 | return function (b) { 26 | return a + b; 27 | } 28 | } 29 | // 或者采用箭头函数写法 30 | const add = x => y => x + y; 31 | 32 | const f = add(1); 33 | f(1) // 2 34 | ``` 35 | 36 | 上面代码中,函数`add`只接受一个参数`a`,返回一个函数`f`。函数`f`也只接受一个参数`b`。 37 | 38 | ## 函数合成 39 | 40 | 函数合成(function composition)指的是,将多个函数合成一个函数。 41 | 42 | ```javascript 43 | const compose = f => g => x => f(g(x)); 44 | 45 | const f = compose (x => x * 4) (x => x + 3); 46 | f(2) // 20 47 | ``` 48 | 49 | 上面代码中,`compose`就是一个函数合成器,用于将两个函数合成一个函数。 50 | 51 | 可以发现,柯里化与函数合成有着密切的联系。前者用于将一个函数拆成多个函数,后者用于将多个函数合并成一个函数。 52 | 53 | ## 参数倒置 54 | 55 | 参数倒置(flip)指的是改变函数前两个参数的顺序。 56 | 57 | ```javascript 58 | var divide = (a, b) => a / b; 59 | var flip = f.flip(divide); 60 | 61 | flip(10, 5) // 0.5 62 | flip(1, 10) // 10 63 | 64 | var three = (a, b, c) => [a, b, c]; 65 | var flip = f.flip(three); 66 | flip(1, 2, 3); // => [2, 1, 3] 67 | ``` 68 | 69 | 上面代码中,如果按照正常的参数顺序,10除以5等于2。但是,参数倒置以后得到的新函数,结果就是5除以10,结果得到0.5。如果原函数有3个参数,则只颠倒前两个参数的位置。 70 | 71 | 参数倒置的代码非常简单。 72 | 73 | ```javascript 74 | let f = {}; 75 | f.flip = 76 | fn => 77 | (a, b, ...args) => fn(b, a, ...args.reverse()); 78 | ``` 79 | 80 | ## 执行边界 81 | 82 | 执行边界(until)指的是函数执行到满足条件为止。 83 | 84 | ```javascript 85 | let condition = x => x > 100; 86 | let inc = x => x + 1; 87 | let until = f.until(condition, inc); 88 | 89 | until(0) // 101 90 | 91 | condition = x => x === 5; 92 | until = f.until(condition, inc); 93 | 94 | until(3) // 5 95 | ``` 96 | 97 | 上面代码中,第一段的条件是执行到`x`大于100为止,所以`x`初值为0时,会一直执行到101。第二段的条件是执行到等于5为止,所以`x`最后的值是5。 98 | 99 | 执行边界的实现如下。 100 | 101 | ```javascript 102 | let f = {}; 103 | f.until = (condition, f) => 104 | (...args) => { 105 | var r = f.apply(null, args); 106 | return condition(r) ? r : f.until(condition, f)(r); 107 | }; 108 | ``` 109 | 110 | 上面代码的关键就是,如果满足条件就返回结果,否则不断递归执行。 111 | 112 | ## 队列操作 113 | 114 | 队列(list)操作包括以下几种。 115 | 116 | - `head`: 取出队列的第一个非空成员。 117 | - `last`: 取出有限队列的最后一个非空成员。 118 | - `tail`: 取出除了“队列头”以外的其他非空成员。 119 | - `init`: 取出除了“队列尾”以外的其他非空成员。 120 | 121 | 下面是例子。 122 | 123 | ```javascript 124 | f.head(5, 27, 3, 1) // 5 125 | f.last(5, 27, 3, 1) // 1 126 | f.tail(5, 27, 3, 1) // [27, 3, 1] 127 | f.init(5, 27, 3, 1) // [5, 27, 3] 128 | ``` 129 | 130 | 这些方法的实现如下。 131 | 132 | ```javascript 133 | let f = {}; 134 | f.head = (...xs) => xs[0]; 135 | f.last = (...xs) => xs.slice(-1); 136 | f.tail = (...xs) => Array.prototype.slice.call(xs, 1); 137 | f.init = (...xs) => xs.slice(0, -1); 138 | ``` 139 | 140 | ## 合并操作 141 | 142 | 合并操作分为`concat`和`concatMap`两种。前者就是将多个数组合成一个,后者则是先处理一下参数,然后再将处理结果合成一个数组。 143 | 144 | ```javascript 145 | f.concat([5], [27], [3]) // [5, 27, 3] 146 | f.concatMap(x => 'hi ' + x, 1, [[2]], 3) // ['hi 1', 'hi 2', 'hi 3'] 147 | ``` 148 | 149 | 这两种方法的实现代码如下。 150 | 151 | ```javascript 152 | let f = {}; 153 | f.concat = 154 | (...xs) => xs.reduce((a, b) => a.concat(b)); 155 | f.concatMap = 156 | (f, ...xs) => f.concat(xs.map(f)); 157 | ``` 158 | 159 | ## 配对操作 160 | 161 | 配对操作分为`zip`和`zipWith`两种方法。`zip`操作将两个队列的成员,一一配对,合成一个新的队列。如果两个队列不等长,较长的那个队列多出来的成员,会被忽略。`zipWith`操作的第一个参数是一个函数,然后会将后面的队列成员一一配对,输入该函数,返回值就组成一个新的队列。 162 | 163 | 下面是例子。 164 | 165 | ```javascript 166 | let a = [0, 1, 2]; 167 | let b = [3, 4, 5]; 168 | let c = [6, 7, 8]; 169 | 170 | f.zip(a, b) // [[0, 3], [1, 4], [2, 5]] 171 | f.zipWith((a, b) => a + b, a, b, c) // [9, 12, 15] 172 | ``` 173 | 174 | 上面代码中,`zipWith`方法的第一个参数是一个求和函数,它将后面三个队列的成员,一一配对进行相加。 175 | 176 | 这两个方法的实现如下。 177 | 178 | ```javascript 179 | let f = {}; 180 | 181 | f.zip = (...xs) => { 182 | let r = []; 183 | let nple = []; 184 | let length = Math.min.apply(null, xs.map(x => x.length)); 185 | 186 | for (var i = 0; i < length; i++) { 187 | xs.forEach( 188 | x => nple.push(x[i]) 189 | ); 190 | 191 | r.push(nple); 192 | nple = []; 193 | } 194 | 195 | return r; 196 | }; 197 | 198 | f.zipWith = (op, ...xs) => 199 | f.zip.apply(null, xs).map( 200 | (x) => x.reduce(op) 201 | ); 202 | ``` 203 | 204 | ## 参考链接 205 | 206 | - Mateo Gianolio, [Haskell in ES6: Part 1](http://casualjavascript.com/?1) 207 | -------------------------------------------------------------------------------- /docs/mixin.md: -------------------------------------------------------------------------------- 1 | # Mixin 2 | 3 | JavaScript语言的设计是单一继承,即子类只能继承一个父类,不允许继承多个父类。这种设计保证了对象继承的层次结构是树状的,而不是复杂的[网状结构](https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem)。 4 | 5 | 但是,这大大降低了编程的灵活性。因为实际开发中,有时不可避免,子类需要继承多个父类。举例来说,“猫”可以继承“哺乳类动物”,也可以继承“宠物”。 6 | 7 | 各种单一继承的编程语言,有不同的多重继承解决方案。比如,Java语言也是子类只能继承一个父类,但是还允许继承多个界面(interface),这样就间接实现了多重继承。Interface与父类一样,也是一个类,只不过它只定义接口(method signature),不定义实现,因此又被称为“抽象类”。凡是继承于Interface的方法,都必须自己定义实现,否则就会报错。这样就避免了多重继承的最大问题:多个父类的同名方法的碰撞(naming collision)。 8 | 9 | JavaScript语言没有采用Interface的方案,而是通过代理(delegation)实现了从其他类引入方法。 10 | 11 | ```javascript 12 | var Enumerable_first = function () { 13 | this.first = function () { 14 | return this[0]; 15 | }; 16 | }; 17 | 18 | var list = ["foo", "bar", "baz"]; 19 | Enumerable_first.call(list); // explicit delegation 20 | list.first() // "foo" 21 | ``` 22 | 23 | 上面代码中,`list`是一个数组,本身并没有`first`方法。通过`call`方法,可以把`Enumerable_first`里面的方法,绑定到`list`,从而`list`就具有`first`方法。这就叫做“代理”(delegation),`list`对象代理了`Enumerable_first`的`first`方法。 24 | 25 | ## 含义 26 | 27 | Mixin这个名字来自于冰淇淋,在基本口味的冰淇淋上面混入其他口味,这就叫做Mix-in。 28 | 29 | 它允许向一个类里面注入一些代码,使得一个类的功能能够“混入”另一个类。实质上是多重继承的一种解决方案,但是避免了多重继承的复杂性,而且有利于代码复用。 30 | 31 | Mixin就是一个正常的类,不仅定义了接口,还定义了接口的实现。 32 | 33 | 子类通过在`this`对象上面绑定方法,达到多重继承的目的。 34 | 35 | 很多库提供了Mixin功能。下面以Lodash为例。 36 | 37 | ```javascript 38 | function vowels(string) { 39 | return /[aeiou]/i.test(this.value); 40 | } 41 | 42 | var obj = { value: 'hello' }; 43 | _.mixin(obj, {vowels: vowels}) 44 | obj.vowels() // true 45 | ``` 46 | 47 | 上面代码通过Lodash库的`_.mixin`方法,让`obj`对象继承了`vowels`方法。 48 | 49 | Underscore的类似方法是`_.extend`。 50 | 51 | ```javascript 52 | var Person = function (fName, lName) { 53 | this.firstName = fName; 54 | this.lastName = lName; 55 | } 56 | 57 | var sam = new Person('Sam', 'Lowry'); 58 | 59 | var NameMixin = { 60 | fullName: function () { 61 | return this.firstName + ' ' + this.lastName; 62 | }, 63 | rename: function(first, last) { 64 | this.firstName = first; 65 | this.lastName = last; 66 | return this; 67 | } 68 | }; 69 | _.extend(Person.prototype, NameMixin); 70 | sam.rename('Samwise', 'Gamgee'); 71 | sam.fullName() // "Samwise Gamgee" 72 | ``` 73 | 74 | 上面代码通过`_.extend`方法,在`sam`对象上面(准确说是它的原型对象`Person.prototype`上面),混入了`NameMixin`类。 75 | 76 | `extend`方法的实现非常简单。 77 | 78 | ```javascript 79 | function extend(destination, source) { 80 | for (var k in source) { 81 | if (source.hasOwnProperty(k)) { 82 | destination[k] = source[k]; 83 | } 84 | } 85 | return destination; 86 | } 87 | ``` 88 | 89 | 上面代码将`source`对象的所有方法,添加到`destination`对象。 90 | 91 | ## Trait 92 | 93 | Trait是另外一种多重继承的解决方案。它与Mixin很相似,但是有一些细微的差别。 94 | 95 | - Mixin可以包含状态(state),Trait不包含,即Trait里面的方法都是互不相干,可以线性包含的。比如,`Trait1`包含方法`A`和`B`,`Trait2`继承了`Trait1`,同时还包含一个自己的方法`C`,实际上就等同于直接包含方法`A`、`B`、`C`。 96 | - 对于同名方法的碰撞,Mixin包含了解决规则,Trait则是报错。 97 | -------------------------------------------------------------------------------- /docs/spec.md: -------------------------------------------------------------------------------- 1 | # 读懂 ECMAScript 规格 2 | 3 | ## 概述 4 | 5 | 规格文件是计算机语言的官方标准,详细描述语法规则和实现方法。 6 | 7 | 一般来说,没有必要阅读规格,除非你要写编译器。因为规格写得非常抽象和精炼,又缺乏实例,不容易理解,而且对于解决实际的应用问题,帮助不大。但是,如果你遇到疑难的语法问题,实在找不到答案,这时可以去查看规格文件,了解语言标准是怎么说的。规格是解决问题的“最后一招”。 8 | 9 | 这对JavaScript语言很有必要。因为它的使用场景复杂,语法规则不统一,例外很多,各种运行环境的行为不一致,导致奇怪的语法问题层出不穷,任何语法书都不可能囊括所有情况。查看规格,不失为一种解决语法问题的最可靠、最权威的终极方法。 10 | 11 | 本章介绍如何读懂ECMAScript 6的规格文件。 12 | 13 | ECMAScript 6的规格,可以在ECMA国际标准组织的官方网站([www.ecma-international.org/ecma-262/6.0/](http://www.ecma-international.org/ecma-262/6.0/))免费下载和在线阅读。 14 | 15 | 这个规格文件相当庞大,一共有26章,A4打印的话,足足有545页。它的特点就是规定得非常细致,每一个语法行为、每一个函数的实现都做了详尽的清晰的描述。基本上,编译器作者只要把每一步翻译成代码就可以了。这很大程度上,保证了所有ES6实现都有一致的行为。 16 | 17 | ECMAScript 6规格的26章之中,第1章到第3章是对文件本身的介绍,与语言关系不大。第4章是对这门语言总体设计的描述,有兴趣的读者可以读一下。第5章到第8章是语言宏观层面的描述。第5章是规格的名词解释和写法的介绍,第6章介绍数据类型,第7章介绍语言内部用到的抽象操作,第8章介绍代码如何运行。第9章到第26章介绍具体的语法。 18 | 19 | 对于一般用户来说,除了第4章,其他章节都涉及某一方面的细节,不用通读,只要在用到的时候,查阅相关章节即可。下面通过一些例子,介绍如何使用这份规格。 20 | 21 | ## 相等运算符 22 | 23 | 相等运算符(`==`)是一个很让人头痛的运算符,它的语法行为多变,不符合直觉。这个小节就看看规格怎么规定它的行为。 24 | 25 | 请看下面这个表达式,请问它的值是多少。 26 | 27 | ```javascript 28 | 0 == null 29 | ``` 30 | 31 | 如果你不确定答案,或者想知道语言内部怎么处理,就可以去查看规格,[7.2.12小节](http://www.ecma-international.org/ecma-262/6.0/#sec-7.2.12)是对相等运算符(`==`)的描述。 32 | 33 | 规格对每一种语法行为的描述,都分成两部分:先是总体的行为描述,然后是实现的算法细节。相等运算符的总体描述,只有一句话。 34 | 35 | > “The comparison `x == y`, where `x` and `y` are values, produces `true` or `false`.” 36 | 37 | 上面这句话的意思是,相等运算符用于比较两个值,返回`true`或`false`。 38 | 39 | 下面是算法细节。 40 | 41 | > 1. ReturnIfAbrupt(x). 42 | > 1. ReturnIfAbrupt(y). 43 | > 1. If `Type(x)` is the same as `Type(y)`, then 44 | > Return the result of performing Strict Equality Comparison `x === y`. 45 | > 1. If `x` is `null` and `y` is `undefined`, return `true`. 46 | > 1. If `x` is `undefined` and `y` is `null`, return `true`. 47 | > 1. If `Type(x)` is Number and `Type(y)` is String, 48 | > return the result of the comparison `x == ToNumber(y)`. 49 | > 1. If `Type(x)` is String and `Type(y)` is Number, 50 | > return the result of the comparison `ToNumber(x) == y`. 51 | > 1. If `Type(x)` is Boolean, return the result of the comparison `ToNumber(x) == y`. 52 | > 1. If `Type(y)` is Boolean, return the result of the comparison `x == ToNumber(y)`. 53 | > 1. If `Type(x)` is either String, Number, or Symbol and `Type(y)` is Object, then 54 | > return the result of the comparison `x == ToPrimitive(y)`. 55 | > 1. If `Type(x)` is Object and `Type(y)` is either String, Number, or Symbol, then 56 | > return the result of the comparison `ToPrimitive(x) == y`. 57 | > 1. Return `false`. 58 | 59 | 上面这段算法,一共有12步,翻译如下。 60 | 61 | > 1. 如果`x`不是正常值(比如抛出一个错误),中断执行。 62 | > 1. 如果`y`不是正常值,中断执行。 63 | > 1. 如果`Type(x)`与`Type(y)`相同,执行严格相等运算`x === y`。 64 | > 1. 如果`x`是`null`,`y`是`undefined`,返回`true`。 65 | > 1. 如果`x`是`undefined`,`y`是`null`,返回`true`。 66 | > 1. 如果`Type(x)`是数值,`Type(y)`是字符串,返回`x == ToNumber(y)`的结果。 67 | > 1. 如果`Type(x)`是字符串,`Type(y)`是数值,返回`ToNumber(x) == y`的结果。 68 | > 1. 如果`Type(x)`是布尔值,返回`ToNumber(x) == y`的结果。 69 | > 1. 如果`Type(y)`是布尔值,返回`x == ToNumber(y)`的结果。 70 | > 1. 如果`Type(x)`是字符串或数值或`Symbol`值,`Type(y)`是对象,返回`x == ToPrimitive(y)`的结果。 71 | > 1. 如果`Type(x)`是对象,`Type(y)`是字符串或数值或`Symbol`值,返回`ToPrimitive(x) == y`的结果。 72 | > 1. 返回`false`。 73 | 74 | 由于`0`的类型是数值,`null`的类型是Null(这是规格[4.3.13小节](http://www.ecma-international.org/ecma-262/6.0/#sec-4.3.13)的规定,是内部Type运算的结果,跟`typeof`运算符无关)。因此上面的前11步都得不到结果,要到第12步才能得到`false`。 75 | 76 | ```javascript 77 | 0 == null // false 78 | ``` 79 | 80 | ## 数组的空位 81 | 82 | 下面再看另一个例子。 83 | 84 | ```javascript 85 | const a1 = [undefined, undefined, undefined]; 86 | const a2 = [, , ,]; 87 | 88 | a1.length // 3 89 | a2.length // 3 90 | 91 | a1[0] // undefined 92 | a2[0] // undefined 93 | 94 | a1[0] === a2[0] // true 95 | ``` 96 | 97 | 上面代码中,数组`a1`的成员是三个`undefined`,数组`a2`的成员是三个空位。这两个数组很相似,长度都是3,每个位置的成员读取出来都是`undefined`。 98 | 99 | 但是,它们实际上存在重大差异。 100 | 101 | ```javascript 102 | 0 in a1 // true 103 | 0 in a2 // false 104 | 105 | a1.hasOwnProperty(0) // true 106 | a2.hasOwnProperty(0) // false 107 | 108 | Object.keys(a1) // ["0", "1", "2"] 109 | Object.keys(a2) // [] 110 | 111 | a1.map(n => 1) // [1, 1, 1] 112 | a2.map(n => 1) // [, , ,] 113 | ``` 114 | 115 | 上面代码一共列出了四种运算,数组`a1`和`a2`的结果都不一样。前三种运算(`in`运算符、数组的`hasOwnProperty`方法、`Object.keys`方法)都说明,数组`a2`取不到属性名。最后一种运算(数组的`map`方法)说明,数组`a2`没有发生遍历。 116 | 117 | 为什么`a1`与`a2`成员的行为不一致?数组的成员是`undefined`或空位,到底有什么不同? 118 | 119 | 规格的[12.2.5小节《数组的初始化》](http://www.ecma-international.org/ecma-262/6.0/#sec-12.2.5)给出了答案。 120 | 121 | > “Array elements may be elided at the beginning, middle or end of the element list. Whenever a comma in the element list is not preceded by an AssignmentExpression (i.e., a comma at the beginning or after another comma), the missing array element contributes to the length of the Array and increases the index of subsequent elements. Elided array elements are not defined. If an element is elided at the end of an array, that element does not contribute to the length of the Array.” 122 | 123 | 翻译如下。 124 | 125 | > "数组成员可以省略。只要逗号前面没有任何表达式,数组的`length`属性就会加1,并且相应增加其后成员的位置索引。被省略的成员不会被定义。如果被省略的成员是数组最后一个成员,则不会导致数组`length`属性增加。” 126 | 127 | 上面的规格说得很清楚,数组的空位会反映在`length`属性,也就是说空位有自己的位置,但是这个位置的值是未定义,即这个值是不存在的。如果一定要读取,结果就是`undefined`(因为`undefined`在JavaScript语言中表示不存在)。 128 | 129 | 这就解释了为什么`in`运算符、数组的`hasOwnProperty`方法、`Object.keys`方法,都取不到空位的属性名。因为这个属性名根本就不存在,规格里面没说要为空位分配属性名(位置索引),只说要为下一个元素的位置索引加1。 130 | 131 | 至于为什么数组的`map`方法会跳过空位,请看下一节。 132 | 133 | ## 数组的map方法 134 | 135 | 规格的[22.1.3.15小节](http://www.ecma-international.org/ecma-262/6.0/#sec-22.1.3.15)定义了数组的`map`方法。该小节先是总体描述`map`方法的行为,里面没有提到数组空位。 136 | 137 | 后面的算法描述是这样的。 138 | 139 | > 1. Let `O` be `ToObject(this value)`. 140 | > 1. `ReturnIfAbrupt(O)`. 141 | > 1. Let `len` be `ToLength(Get(O, "length"))`. 142 | > 1. `ReturnIfAbrupt(len)`. 143 | > 1. If `IsCallable(callbackfn)` is `false`, throw a TypeError exception. 144 | > 1. If `thisArg` was supplied, let `T` be `thisArg`; else let `T` be `undefined`. 145 | > 1. Let `A` be `ArraySpeciesCreate(O, len)`. 146 | > 1. `ReturnIfAbrupt(A)`. 147 | > 1. Let `k` be 0. 148 | > 1. Repeat, while `k` < `len` 149 | > a. Let `Pk` be `ToString(k)`. 150 | > b. Let `kPresent` be `HasProperty(O, Pk)`. 151 | > c. `ReturnIfAbrupt(kPresent)`. 152 | > d. If `kPresent` is `true`, then 153 | > d-1. Let `kValue` be `Get(O, Pk)`. 154 | > d-2. `ReturnIfAbrupt(kValue)`. 155 | > d-3. Let `mappedValue` be `Call(callbackfn, T, «kValue, k, O»)`. 156 | > d-4. `ReturnIfAbrupt(mappedValue)`. 157 | > d-5. Let `status` be `CreateDataPropertyOrThrow (A, Pk, mappedValue)`. 158 | > d-6. `ReturnIfAbrupt(status)`. 159 | > e. Increase `k` by 1. 160 | > 1. Return `A`. 161 | 162 | 翻译如下。 163 | 164 | > 1. 得到当前数组的`this`对象 165 | > 1. 如果报错就返回 166 | > 1. 求出当前数组的`length`属性 167 | > 1. 如果报错就返回 168 | > 1. 如果map方法的参数`callbackfn`不可执行,就报错 169 | > 1. 如果map方法的参数之中,指定了`this`,就让`T`等于该参数,否则`T`为`undefined` 170 | > 1. 生成一个新的数组`A`,跟当前数组的`length`属性保持一致 171 | > 1. 如果报错就返回 172 | > 1. 设定`k`等于0 173 | > 1. 只要`k`小于当前数组的`length`属性,就重复下面步骤 174 | > a. 设定`Pk`等于`ToString(k)`,即将`K`转为字符串 175 | > b. 设定`kPresent`等于`HasProperty(O, Pk)`,即求当前数组有没有指定属性 176 | > c. 如果报错就返回 177 | > d. 如果`kPresent`等于`true`,则进行下面步骤 178 | > d-1. 设定`kValue`等于`Get(O, Pk)`,取出当前数组的指定属性 179 | > d-2. 如果报错就返回 180 | > d-3. 设定`mappedValue`等于`Call(callbackfn, T, «kValue, k, O»)`,即执行回调函数 181 | > d-4. 如果报错就返回 182 | > d-5. 设定`status`等于`CreateDataPropertyOrThrow (A, Pk, mappedValue)`,即将回调函数的值放入`A`数组的指定位置 183 | > d-6. 如果报错就返回 184 | > e. `k`增加1 185 | > 1. 返回`A` 186 | 187 | 仔细查看上面的算法,可以发现,当处理一个全是空位的数组时,前面步骤都没有问题。进入第10步的b时,`kpresent`会报错,因为空位对应的属性名,对于数组来说是不存在的,因此就会返回,不会进行后面的步骤。 188 | 189 | ```javascript 190 | const arr = [, , ,]; 191 | arr.map(n => { 192 | console.log(n); 193 | return 1; 194 | }) // [, , ,] 195 | ``` 196 | 197 | 上面代码中,`arr`是一个全是空位的数组,`map`方法遍历成员时,发现是空位,就直接跳过,不会进入回调函数。因此,回调函数里面的`console.log`语句根本不会执行,整个`map`方法返回一个全是空位的新数组。 198 | 199 | V8引擎对`map`方法的[实现](https://github.com/v8/v8/blob/44c44521ae11859478b42004f57ea93df52526ee/src/js/array.js#L1347)如下,可以看到跟规格的算法描述完全一致。 200 | 201 | ```javascript 202 | function ArrayMap(f, receiver) { 203 | CHECK_OBJECT_COERCIBLE(this, "Array.prototype.map"); 204 | 205 | // Pull out the length so that modifications to the length in the 206 | // loop will not affect the looping and side effects are visible. 207 | var array = TO_OBJECT(this); 208 | var length = TO_LENGTH_OR_UINT32(array.length); 209 | return InnerArrayMap(f, receiver, array, length); 210 | } 211 | 212 | function InnerArrayMap(f, receiver, array, length) { 213 | if (!IS_CALLABLE(f)) throw MakeTypeError(kCalledNonCallable, f); 214 | 215 | var accumulator = new InternalArray(length); 216 | var is_array = IS_ARRAY(array); 217 | var stepping = DEBUG_IS_STEPPING(f); 218 | for (var i = 0; i < length; i++) { 219 | if (HAS_INDEX(array, i, is_array)) { 220 | var element = array[i]; 221 | // Prepare break slots for debugger step in. 222 | if (stepping) %DebugPrepareStepInIfStepping(f); 223 | accumulator[i] = %_Call(f, receiver, element, i, array); 224 | } 225 | } 226 | var result = new GlobalArray(); 227 | %MoveArrayContents(accumulator, result); 228 | return result; 229 | } 230 | ``` 231 | -------------------------------------------------------------------------------- /docs/style.md: -------------------------------------------------------------------------------- 1 | # 编程风格 2 | 3 | 本章探讨如何将ES6的新语法,运用到编码实践之中,与传统的JavaScript语法结合在一起,写出合理的、易于阅读和维护的代码。 4 | 5 | 多家公司和组织已经公开了它们的风格规范,具体可参阅[jscs.info](http://jscs.info/),下面的内容主要参考了[Airbnb](https://github.com/airbnb/javascript)的JavaScript风格规范。 6 | 7 | ## 块级作用域 8 | 9 | **(1)let 取代 var** 10 | 11 | ES6提出了两个新的声明变量的命令:`let`和`const`。其中,`let`完全可以取代`var`,因为两者语义相同,而且`let`没有副作用。 12 | 13 | ```javascript 14 | 'use strict'; 15 | 16 | if (true) { 17 | let x = 'hello'; 18 | } 19 | 20 | for (let i = 0; i < 10; i++) { 21 | console.log(i); 22 | } 23 | ``` 24 | 25 | 上面代码如果用`var`替代`let`,实际上就声明了两个全局变量,这显然不是本意。变量应该只在其声明的代码块内有效,`var`命令做不到这一点。 26 | 27 | `var`命令存在变量提升效用,`let`命令没有这个问题。 28 | 29 | ```javascript 30 | 'use strict'; 31 | 32 | if(true) { 33 | console.log(x); // ReferenceError 34 | let x = 'hello'; 35 | } 36 | ``` 37 | 38 | 上面代码如果使用`var`替代`let`,`console.log`那一行就不会报错,而是会输出`undefined`,因为变量声明提升到代码块的头部。这违反了变量先声明后使用的原则。 39 | 40 | 所以,建议不再使用`var`命令,而是使用`let`命令取代。 41 | 42 | **(2)全局常量和线程安全** 43 | 44 | 在`let`和`const`之间,建议优先使用`const`,尤其是在全局环境,不应该设置变量,只应设置常量。 45 | 46 | `const`优于`let`有几个原因。一个是`const`可以提醒阅读程序的人,这个变量不应该改变;另一个是`const`比较符合函数式编程思想,运算不改变值,只是新建值,而且这样也有利于将来的分布式运算;最后一个原因是 JavaScript 编译器会对`const`进行优化,所以多使用`const`,有利于提供程序的运行效率,也就是说`let`和`const`的本质区别,其实是编译器内部的处理不同。 47 | 48 | ```javascript 49 | // bad 50 | var a = 1, b = 2, c = 3; 51 | 52 | // good 53 | const a = 1; 54 | const b = 2; 55 | const c = 3; 56 | 57 | // best 58 | const [a, b, c] = [1, 2, 3]; 59 | ``` 60 | 61 | `const`声明常量还有两个好处,一是阅读代码的人立刻会意识到不应该修改这个值,二是防止了无意间修改变量值所导致的错误。 62 | 63 | 所有的函数都应该设置为常量。 64 | 65 | 长远来看,JavaScript可能会有多线程的实现(比如Intel的River Trail那一类的项目),这时`let`表示的变量,只应出现在单线程运行的代码中,不能是多线程共享的,这样有利于保证线程安全。 66 | 67 | ## 字符串 68 | 69 | 静态字符串一律使用单引号或反引号,不使用双引号。动态字符串使用反引号。 70 | 71 | ```javascript 72 | // bad 73 | const a = "foobar"; 74 | const b = 'foo' + a + 'bar'; 75 | 76 | // acceptable 77 | const c = `foobar`; 78 | 79 | // good 80 | const a = 'foobar'; 81 | const b = `foo${a}bar`; 82 | const c = 'foobar'; 83 | ``` 84 | 85 | ## 解构赋值 86 | 87 | 使用数组成员对变量赋值时,优先使用解构赋值。 88 | 89 | ```javascript 90 | const arr = [1, 2, 3, 4]; 91 | 92 | // bad 93 | const first = arr[0]; 94 | const second = arr[1]; 95 | 96 | // good 97 | const [first, second] = arr; 98 | ``` 99 | 100 | 函数的参数如果是对象的成员,优先使用解构赋值。 101 | 102 | ```javascript 103 | // bad 104 | function getFullName(user) { 105 | const firstName = user.firstName; 106 | const lastName = user.lastName; 107 | } 108 | 109 | // good 110 | function getFullName(obj) { 111 | const { firstName, lastName } = obj; 112 | } 113 | 114 | // best 115 | function getFullName({ firstName, lastName }) { 116 | } 117 | ``` 118 | 119 | 如果函数返回多个值,优先使用对象的解构赋值,而不是数组的解构赋值。这样便于以后添加返回值,以及更改返回值的顺序。 120 | 121 | ```javascript 122 | // bad 123 | function processInput(input) { 124 | return [left, right, top, bottom]; 125 | } 126 | 127 | // good 128 | function processInput(input) { 129 | return { left, right, top, bottom }; 130 | } 131 | 132 | const { left, right } = processInput(input); 133 | ``` 134 | 135 | ## 对象 136 | 137 | 单行定义的对象,最后一个成员不以逗号结尾。多行定义的对象,最后一个成员以逗号结尾。 138 | 139 | ```javascript 140 | // bad 141 | const a = { k1: v1, k2: v2, }; 142 | const b = { 143 | k1: v1, 144 | k2: v2 145 | }; 146 | 147 | // good 148 | const a = { k1: v1, k2: v2 }; 149 | const b = { 150 | k1: v1, 151 | k2: v2, 152 | }; 153 | ``` 154 | 155 | 对象尽量静态化,一旦定义,就不得随意添加新的属性。如果添加属性不可避免,要使用`Object.assign`方法。 156 | 157 | ```javascript 158 | // bad 159 | const a = {}; 160 | a.x = 3; 161 | 162 | // if reshape unavoidable 163 | const a = {}; 164 | Object.assign(a, { x: 3 }); 165 | 166 | // good 167 | const a = { x: null }; 168 | a.x = 3; 169 | ``` 170 | 171 | 如果对象的属性名是动态的,可以在创造对象的时候,使用属性表达式定义。 172 | 173 | ```javascript 174 | // bad 175 | const obj = { 176 | id: 5, 177 | name: 'San Francisco', 178 | }; 179 | obj[getKey('enabled')] = true; 180 | 181 | // good 182 | const obj = { 183 | id: 5, 184 | name: 'San Francisco', 185 | [getKey('enabled')]: true, 186 | }; 187 | ``` 188 | 189 | 上面代码中,对象`obj`的最后一个属性名,需要计算得到。这时最好采用属性表达式,在新建`obj`的时候,将该属性与其他属性定义在一起。这样一来,所有属性就在一个地方定义了。 190 | 191 | 另外,对象的属性和方法,尽量采用简洁表达法,这样易于描述和书写。 192 | 193 | ```javascript 194 | var ref = 'some value'; 195 | 196 | // bad 197 | const atom = { 198 | ref: ref, 199 | 200 | value: 1, 201 | 202 | addValue: function (value) { 203 | return atom.value + value; 204 | }, 205 | }; 206 | 207 | // good 208 | const atom = { 209 | ref, 210 | 211 | value: 1, 212 | 213 | addValue(value) { 214 | return atom.value + value; 215 | }, 216 | }; 217 | ``` 218 | 219 | ## 数组 220 | 221 | 使用扩展运算符(...)拷贝数组。 222 | 223 | ```javascript 224 | // bad 225 | const len = items.length; 226 | const itemsCopy = []; 227 | let i; 228 | 229 | for (i = 0; i < len; i++) { 230 | itemsCopy[i] = items[i]; 231 | } 232 | 233 | // good 234 | const itemsCopy = [...items]; 235 | ``` 236 | 237 | 使用Array.from方法,将类似数组的对象转为数组。 238 | 239 | ```javascript 240 | const foo = document.querySelectorAll('.foo'); 241 | const nodes = Array.from(foo); 242 | ``` 243 | 244 | ## 函数 245 | 246 | 立即执行函数可以写成箭头函数的形式。 247 | 248 | ```javascript 249 | (() => { 250 | console.log('Welcome to the Internet.'); 251 | })(); 252 | ``` 253 | 254 | 那些需要使用函数表达式的场合,尽量用箭头函数代替。因为这样更简洁,而且绑定了this。 255 | 256 | ```javascript 257 | // bad 258 | [1, 2, 3].map(function (x) { 259 | return x * x; 260 | }); 261 | 262 | // good 263 | [1, 2, 3].map((x) => { 264 | return x * x; 265 | }); 266 | 267 | // best 268 | [1, 2, 3].map(x => x * x); 269 | ``` 270 | 271 | 箭头函数取代`Function.prototype.bind`,不应再用self/\_this/that绑定 this。 272 | 273 | ```javascript 274 | // bad 275 | const self = this; 276 | const boundMethod = function(...params) { 277 | return method.apply(self, params); 278 | } 279 | 280 | // acceptable 281 | const boundMethod = method.bind(this); 282 | 283 | // best 284 | const boundMethod = (...params) => method.apply(this, params); 285 | ``` 286 | 287 | 简单的、单行的、不会复用的函数,建议采用箭头函数。如果函数体较为复杂,行数较多,还是应该采用传统的函数写法。 288 | 289 | 所有配置项都应该集中在一个对象,放在最后一个参数,布尔值不可以直接作为参数。 290 | 291 | ```javascript 292 | // bad 293 | function divide(a, b, option = false ) { 294 | } 295 | 296 | // good 297 | function divide(a, b, { option = false } = {}) { 298 | } 299 | ``` 300 | 301 | 不要在函数体内使用arguments变量,使用rest运算符(...)代替。因为rest运算符显式表明你想要获取参数,而且arguments是一个类似数组的对象,而rest运算符可以提供一个真正的数组。 302 | 303 | ```javascript 304 | // bad 305 | function concatenateAll() { 306 | const args = Array.prototype.slice.call(arguments); 307 | return args.join(''); 308 | } 309 | 310 | // good 311 | function concatenateAll(...args) { 312 | return args.join(''); 313 | } 314 | ``` 315 | 316 | 使用默认值语法设置函数参数的默认值。 317 | 318 | ```javascript 319 | // bad 320 | function handleThings(opts) { 321 | opts = opts || {}; 322 | } 323 | 324 | // good 325 | function handleThings(opts = {}) { 326 | // ... 327 | } 328 | ``` 329 | 330 | ## Map结构 331 | 332 | 注意区分Object和Map,只有模拟现实世界的实体对象时,才使用Object。如果只是需要`key: value`的数据结构,使用Map结构。因为Map有内建的遍历机制。 333 | 334 | ```javascript 335 | let map = new Map(arr); 336 | 337 | for (let key of map.keys()) { 338 | console.log(key); 339 | } 340 | 341 | for (let value of map.values()) { 342 | console.log(value); 343 | } 344 | 345 | for (let item of map.entries()) { 346 | console.log(item[0], item[1]); 347 | } 348 | ``` 349 | 350 | ## Class 351 | 352 | 总是用Class,取代需要prototype的操作。因为Class的写法更简洁,更易于理解。 353 | 354 | ```javascript 355 | // bad 356 | function Queue(contents = []) { 357 | this._queue = [...contents]; 358 | } 359 | Queue.prototype.pop = function() { 360 | const value = this._queue[0]; 361 | this._queue.splice(0, 1); 362 | return value; 363 | } 364 | 365 | // good 366 | class Queue { 367 | constructor(contents = []) { 368 | this._queue = [...contents]; 369 | } 370 | pop() { 371 | const value = this._queue[0]; 372 | this._queue.splice(0, 1); 373 | return value; 374 | } 375 | } 376 | ``` 377 | 378 | 使用`extends`实现继承,因为这样更简单,不会有破坏`instanceof`运算的危险。 379 | 380 | ```javascript 381 | // bad 382 | const inherits = require('inherits'); 383 | function PeekableQueue(contents) { 384 | Queue.apply(this, contents); 385 | } 386 | inherits(PeekableQueue, Queue); 387 | PeekableQueue.prototype.peek = function() { 388 | return this._queue[0]; 389 | } 390 | 391 | // good 392 | class PeekableQueue extends Queue { 393 | peek() { 394 | return this._queue[0]; 395 | } 396 | } 397 | ``` 398 | 399 | ## 模块 400 | 401 | 首先,Module语法是JavaScript模块的标准写法,坚持使用这种写法。使用`import`取代`require`。 402 | 403 | ```javascript 404 | // bad 405 | const moduleA = require('moduleA'); 406 | const func1 = moduleA.func1; 407 | const func2 = moduleA.func2; 408 | 409 | // good 410 | import { func1, func2 } from 'moduleA'; 411 | ``` 412 | 413 | 使用`export`取代`module.exports`。 414 | 415 | ```javascript 416 | // commonJS的写法 417 | var React = require('react'); 418 | 419 | var Breadcrumbs = React.createClass({ 420 | render() { 421 | return