diff --git a/_site/CNAME b/_site/CNAME new file mode 100644 index 0000000..41a31a7 --- /dev/null +++ b/_site/CNAME @@ -0,0 +1 @@ +es6.ruanyifeng.com diff --git a/_site/LICENSE b/_site/LICENSE new file mode 100644 index 0000000..eecb76b --- /dev/null +++ b/_site/LICENSE @@ -0,0 +1,22 @@ +# Creative Commons Attribution-NonCommercial 4.0 International License + +Disclaimer: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-nc/4.0/legalcode). + +You are free to: + +- Share — copy and redistribute the material in any medium or format +- Adapt — remix, transform, and build upon the material + +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +- 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. +- NonCommercial — You may not use the material for commercial purposes. +- No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. + +Notices: + +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. + +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. diff --git a/_site/README.md b/_site/README.md new file mode 100644 index 0000000..d27f103 --- /dev/null +++ b/_site/README.md @@ -0,0 +1,17 @@ +# ECMAScript 6入门 + +《ECMAScript 6入门》是一本开源的JavaScript语言教程,全面介绍ECMAScript 6新增的语法特性。 + +[![cover](images/cover_thumbnail.jpg)](images/cover.jpg) + +本书力争覆盖ES6与ES5的所有不同之处,对涉及的语法知识给予详细介绍,并给出大量简洁易懂的示例代码。 + +本书为中级难度,适合已有一定JavaScript语言基础的读者,了解这门语言的最新进展;也可当作参考手册,查寻新增的语法点。 + +### 版权许可 + +本书采用“保持署名—非商用”创意共享4.0许可证。 + +只要保持原作者署名和非商用,您可以自由地阅读、分享、修改本书。 + +详细的法律条文请参见[创意共享](http://creativecommons.org/licenses/by-nc/4.0/)网站。 diff --git a/_site/app/bower_components/marked/LICENSE b/_site/app/bower_components/marked/LICENSE new file mode 100644 index 0000000..a7b812e --- /dev/null +++ b/_site/app/bower_components/marked/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/_site/app/bower_components/marked/Makefile b/_site/app/bower_components/marked/Makefile new file mode 100644 index 0000000..20ac2d4 --- /dev/null +++ b/_site/app/bower_components/marked/Makefile @@ -0,0 +1,12 @@ +all: + @cp lib/marked.js marked.js + @uglifyjs -o marked.min.js marked.js + +clean: + @rm marked.js + @rm marked.min.js + +bench: + @node test --bench + +.PHONY: clean all diff --git a/_site/app/bower_components/marked/README.md b/_site/app/bower_components/marked/README.md new file mode 100644 index 0000000..441c1eb --- /dev/null +++ b/_site/app/bower_components/marked/README.md @@ -0,0 +1,386 @@ +# marked + +> A full-featured markdown parser and compiler, written in JavaScript. Built +> for speed. + +[![NPM version](https://badge.fury.io/js/marked.png)][badge] + +## Install + +``` bash +npm install marked --save +``` + +## Usage + +Minimal usage: + +```js +var marked = require('marked'); +console.log(marked('I am using __markdown__.')); +// Outputs:

I am using markdown.

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

+ + + + heading+ +

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

hello world

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

+``` + + +``` +$ marked + * item1 + + * item2 + + text +^D + +``` + +Which looks correct to you? + +- - - + +``` +$ markdown.pl +* hello + > world +^D +

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

+``` + +Misnested tags. + + +``` +$ marked + * item1 + + * item2 + + text +^D + +``` + +Which looks correct to you? + +- - - + +``` +$ markdown.pl +* hello + > world +^D +

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

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

<div>hello</div>

+ +

<span>hello</span>

+``` + +``` bash +$ marked +
hello
+ +hello +^D +
hello
+ + +

hello +

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

![an image

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

an image +

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

a

bundefined> c

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

a + +

+

b + +

+

c +

+``` + +- - - + +``` bash +$ markdown.pl +* hello + * world + how + + are + you + + * today +* hi +^D + +``` + +``` bash +$ marked +* hello + * world + how + + are + you + + * today +* hi +^D + +``` diff --git a/_site/app/bower_components/marked/doc/todo.md b/_site/app/bower_components/marked/doc/todo.md new file mode 100644 index 0000000..2e60b16 --- /dev/null +++ b/_site/app/bower_components/marked/doc/todo.md @@ -0,0 +1,2 @@ +# Todo + diff --git a/_site/app/bower_components/marked/index.js b/_site/app/bower_components/marked/index.js new file mode 100644 index 0000000..a12f905 --- /dev/null +++ b/_site/app/bower_components/marked/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/marked'); diff --git a/_site/app/bower_components/marked/lib/marked.js b/_site/app/bower_components/marked/lib/marked.js new file mode 100644 index 0000000..e2f08c9 --- /dev/null +++ b/_site/app/bower_components/marked/lib/marked.js @@ -0,0 +1,1266 @@ +/** + * marked - a markdown parser + * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) + * https://github.com/chjj/marked + */ + +;(function() { + +/** + * Block-Level Grammar + */ + +var block = { + newline: /^\n+/, + code: /^( {4}[^\n]+\n*)+/, + fences: noop, + hr: /^( *[-*_]){3,} *(?:\n+|$)/, + heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, + nptable: noop, + lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, + blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/, + list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, + html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/, + def: /^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, + table: noop, + paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/, + text: /^[^\n]+/ +}; + +block.bullet = /(?:[*+-]|\d+\.)/; +block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; +block.item = replace(block.item, 'gm') + (/bull/g, block.bullet) + (); + +block.list = replace(block.list) + (/bull/g, block.bullet) + ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))') + ('def', '\\n+(?=' + block.def.source + ')') + (); + +block.blockquote = replace(block.blockquote) + ('def', block.def) + (); + +block._tag = '(?!(?:' + + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' + + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' + + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b'; + +block.html = replace(block.html) + ('comment', //) + ('closed', /<(tag)[\s\S]+?<\/\1>/) + ('closing', /])*?>/) + (/tag/g, block._tag) + (); + +block.paragraph = replace(block.paragraph) + ('hr', block.hr) + ('heading', block.heading) + ('lheading', block.lheading) + ('blockquote', block.blockquote) + ('tag', '<' + block._tag) + ('def', block.def) + (); + +/** + * Normal Block Grammar + */ + +block.normal = merge({}, block); + +/** + * GFM Block Grammar + */ + +block.gfm = merge({}, block.normal, { + fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/, + paragraph: /^/ +}); + +block.gfm.paragraph = replace(block.paragraph) + ('(?!', '(?!' + + block.gfm.fences.source.replace('\\1', '\\2') + '|' + + block.list.source.replace('\\1', '\\3') + '|') + (); + +/** + * GFM + Tables Block Grammar + */ + +block.tables = merge({}, block.gfm, { + nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/, + table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ +}); + +/** + * Block Lexer + */ + +function Lexer(options) { + this.tokens = []; + this.tokens.links = {}; + this.options = options || marked.defaults; + this.rules = block.normal; + + if (this.options.gfm) { + if (this.options.tables) { + this.rules = block.tables; + } else { + this.rules = block.gfm; + } + } +} + +/** + * Expose Block Rules + */ + +Lexer.rules = block; + +/** + * Static Lex Method + */ + +Lexer.lex = function(src, options) { + var lexer = new Lexer(options); + return lexer.lex(src); +}; + +/** + * Preprocessing + */ + +Lexer.prototype.lex = function(src) { + src = src + .replace(/\r\n|\r/g, '\n') + .replace(/\t/g, ' ') + .replace(/\u00a0/g, ' ') + .replace(/\u2424/g, '\n'); + + return this.token(src, true); +}; + +/** + * Lexing + */ + +Lexer.prototype.token = function(src, top, bq) { + var src = src.replace(/^ +$/gm, '') + , next + , loose + , cap + , bull + , b + , item + , space + , i + , l; + + while (src) { + // newline + if (cap = this.rules.newline.exec(src)) { + src = src.substring(cap[0].length); + if (cap[0].length > 1) { + this.tokens.push({ + type: 'space' + }); + } + } + + // code + if (cap = this.rules.code.exec(src)) { + src = src.substring(cap[0].length); + cap = cap[0].replace(/^ {4}/gm, ''); + this.tokens.push({ + type: 'code', + text: !this.options.pedantic + ? cap.replace(/\n+$/, '') + : cap + }); + continue; + } + + // fences (gfm) + if (cap = this.rules.fences.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'code', + lang: cap[2], + text: cap[3] + }); + continue; + } + + // heading + if (cap = this.rules.heading.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'heading', + depth: cap[1].length, + text: cap[2] + }); + continue; + } + + // table no leading pipe (gfm) + if (top && (cap = this.rules.nptable.exec(src))) { + src = src.substring(cap[0].length); + + item = { + type: 'table', + header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), + align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), + cells: cap[3].replace(/\n$/, '').split('\n') + }; + + for (i = 0; i < item.align.length; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = 'right'; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = 'center'; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = 'left'; + } else { + item.align[i] = null; + } + } + + for (i = 0; i < item.cells.length; i++) { + item.cells[i] = item.cells[i].split(/ *\| */); + } + + this.tokens.push(item); + + continue; + } + + // lheading + if (cap = this.rules.lheading.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'heading', + depth: cap[2] === '=' ? 1 : 2, + text: cap[1] + }); + continue; + } + + // hr + if (cap = this.rules.hr.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'hr' + }); + continue; + } + + // blockquote + if (cap = this.rules.blockquote.exec(src)) { + src = src.substring(cap[0].length); + + this.tokens.push({ + type: 'blockquote_start' + }); + + cap = cap[0].replace(/^ *> ?/gm, ''); + + // Pass `top` to keep the current + // "toplevel" state. This is exactly + // how markdown.pl works. + this.token(cap, top, true); + + this.tokens.push({ + type: 'blockquote_end' + }); + + continue; + } + + // list + if (cap = this.rules.list.exec(src)) { + src = src.substring(cap[0].length); + bull = cap[2]; + + this.tokens.push({ + type: 'list_start', + ordered: bull.length > 1 + }); + + // Get each top-level item. + cap = cap[0].match(this.rules.item); + + next = false; + l = cap.length; + i = 0; + + for (; i < l; i++) { + item = cap[i]; + + // Remove the list item's bullet + // so it is seen as the next token. + space = item.length; + item = item.replace(/^ *([*+-]|\d+\.) +/, ''); + + // Outdent whatever the + // list item contains. Hacky. + if (~item.indexOf('\n ')) { + space -= item.length; + item = !this.options.pedantic + ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') + : item.replace(/^ {1,4}/gm, ''); + } + + // Determine whether the next list item belongs here. + // Backpedal if it does not belong in this list. + if (this.options.smartLists && i !== l - 1) { + b = block.bullet.exec(cap[i + 1])[0]; + if (bull !== b && !(bull.length > 1 && b.length > 1)) { + src = cap.slice(i + 1).join('\n') + src; + i = l - 1; + } + } + + // Determine whether item is loose or not. + // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ + // for discount behavior. + loose = next || /\n\n(?!\s*$)/.test(item); + if (i !== l - 1) { + next = item.charAt(item.length - 1) === '\n'; + if (!loose) loose = next; + } + + this.tokens.push({ + type: loose + ? 'loose_item_start' + : 'list_item_start' + }); + + // Recurse. + this.token(item, false, bq); + + this.tokens.push({ + type: 'list_item_end' + }); + } + + this.tokens.push({ + type: 'list_end' + }); + + continue; + } + + // html + if (cap = this.rules.html.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: this.options.sanitize + ? 'paragraph' + : 'html', + pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style', + text: cap[0] + }); + continue; + } + + // def + if ((!bq && top) && (cap = this.rules.def.exec(src))) { + src = src.substring(cap[0].length); + this.tokens.links[cap[1].toLowerCase()] = { + href: cap[2], + title: cap[3] + }; + continue; + } + + // table (gfm) + if (top && (cap = this.rules.table.exec(src))) { + src = src.substring(cap[0].length); + + item = { + type: 'table', + header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), + align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), + cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') + }; + + for (i = 0; i < item.align.length; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = 'right'; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = 'center'; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = 'left'; + } else { + item.align[i] = null; + } + } + + for (i = 0; i < item.cells.length; i++) { + item.cells[i] = item.cells[i] + .replace(/^ *\| *| *\| *$/g, '') + .split(/ *\| */); + } + + this.tokens.push(item); + + continue; + } + + // top-level paragraph + if (top && (cap = this.rules.paragraph.exec(src))) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'paragraph', + text: cap[1].charAt(cap[1].length - 1) === '\n' + ? cap[1].slice(0, -1) + : cap[1] + }); + continue; + } + + // text + if (cap = this.rules.text.exec(src)) { + // Top-level should never reach here. + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'text', + text: cap[0] + }); + continue; + } + + if (src) { + throw new + Error('Infinite loop on byte: ' + src.charCodeAt(0)); + } + } + + return this.tokens; +}; + +/** + * Inline-Level Grammar + */ + +var inline = { + escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, + autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, + url: noop, + tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, + link: /^!?\[(inside)\]\(href\)/, + reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, + nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, + strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, + em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, + code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/, + br: /^ {2,}\n(?!\s*$)/, + del: noop, + text: /^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/; + +inline.link = replace(inline.link) + ('inside', inline._inside) + ('href', inline._href) + (); + +inline.reflink = replace(inline.reflink) + ('inside', inline._inside) + (); + +/** + * Normal Inline Grammar + */ + +inline.normal = merge({}, inline); + +/** + * Pedantic Inline Grammar + */ + +inline.pedantic = merge({}, inline.normal, { + strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, + em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ +}); + +/** + * GFM Inline Grammar + */ + +inline.gfm = merge({}, inline.normal, { + escape: replace(inline.escape)('])', '~|])')(), + url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, + del: /^~~(?=\S)([\s\S]*?\S)~~/, + text: replace(inline.text) + (']|', '~]|') + ('|', '|https?://|') + () +}); + +/** + * GFM + Line Breaks Inline Grammar + */ + +inline.breaks = merge({}, inline.gfm, { + br: replace(inline.br)('{2,}', '*')(), + text: replace(inline.gfm.text)('{2,}', '*')() +}); + +/** + * Inline Lexer & Compiler + */ + +function InlineLexer(links, options) { + this.options = options || marked.defaults; + this.links = links; + this.rules = inline.normal; + this.renderer = this.options.renderer || new Renderer; + this.renderer.options = this.options; + + if (!this.links) { + throw new + Error('Tokens array requires a `links` property.'); + } + + if (this.options.gfm) { + if (this.options.breaks) { + this.rules = inline.breaks; + } else { + this.rules = inline.gfm; + } + } else if (this.options.pedantic) { + this.rules = inline.pedantic; + } +} + +/** + * Expose Inline Rules + */ + +InlineLexer.rules = inline; + +/** + * Static Lexing/Compiling Method + */ + +InlineLexer.output = function(src, links, options) { + var inline = new InlineLexer(links, options); + return inline.output(src); +}; + +/** + * Lexing/Compiling + */ + +InlineLexer.prototype.output = function(src) { + var out = '' + , link + , text + , href + , cap; + + while (src) { + // escape + if (cap = this.rules.escape.exec(src)) { + src = src.substring(cap[0].length); + out += cap[1]; + continue; + } + + // autolink + if (cap = this.rules.autolink.exec(src)) { + src = src.substring(cap[0].length); + if (cap[2] === '@') { + text = cap[1].charAt(6) === ':' + ? this.mangle(cap[1].substring(7)) + : this.mangle(cap[1]); + href = this.mangle('mailto:') + text; + } else { + text = escape(cap[1]); + href = text; + } + out += this.renderer.link(href, null, text); + continue; + } + + // url (gfm) + if (!this.inLink && (cap = this.rules.url.exec(src))) { + src = src.substring(cap[0].length); + text = escape(cap[1]); + href = text; + out += this.renderer.link(href, null, text); + continue; + } + + // tag + if (cap = this.rules.tag.exec(src)) { + if (!this.inLink && /^/i.test(cap[0])) { + this.inLink = false; + } + src = src.substring(cap[0].length); + out += this.options.sanitize + ? escape(cap[0]) + : cap[0]; + continue; + } + + // link + if (cap = this.rules.link.exec(src)) { + src = src.substring(cap[0].length); + this.inLink = true; + out += this.outputLink(cap, { + href: cap[2], + title: cap[3] + }); + this.inLink = false; + continue; + } + + // reflink, nolink + if ((cap = this.rules.reflink.exec(src)) + || (cap = this.rules.nolink.exec(src))) { + src = src.substring(cap[0].length); + link = (cap[2] || cap[1]).replace(/\s+/g, ' '); + link = this.links[link.toLowerCase()]; + if (!link || !link.href) { + out += cap[0].charAt(0); + src = cap[0].substring(1) + src; + continue; + } + this.inLink = true; + out += this.outputLink(cap, link); + this.inLink = false; + continue; + } + + // strong + if (cap = this.rules.strong.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.strong(this.output(cap[2] || cap[1])); + continue; + } + + // em + if (cap = this.rules.em.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.em(this.output(cap[2] || cap[1])); + continue; + } + + // code + if (cap = this.rules.code.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.codespan(escape(cap[2], true)); + continue; + } + + // br + if (cap = this.rules.br.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.br(); + continue; + } + + // del (gfm) + if (cap = this.rules.del.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.del(this.output(cap[1])); + continue; + } + + // text + if (cap = this.rules.text.exec(src)) { + src = src.substring(cap[0].length); + out += escape(this.smartypants(cap[0])); + continue; + } + + if (src) { + throw new + Error('Infinite loop on byte: ' + src.charCodeAt(0)); + } + } + + return out; +}; + +/** + * Compile Link + */ + +InlineLexer.prototype.outputLink = function(cap, link) { + var href = escape(link.href) + , title = link.title ? escape(link.title) : null; + + return cap[0].charAt(0) !== '!' + ? this.renderer.link(href, title, this.output(cap[1])) + : this.renderer.image(href, title, escape(cap[1])); +}; + +/** + * Smartypants Transformations + */ + +InlineLexer.prototype.smartypants = function(text) { + if (!this.options.smartypants) return text; + return text + // em-dashes + .replace(/--/g, '\u2014') + // opening singles + .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') + // closing singles & apostrophes + .replace(/'/g, '\u2019') + // opening doubles + .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c') + // closing doubles + .replace(/"/g, '\u201d') + // ellipses + .replace(/\.{3}/g, '\u2026'); +}; + +/** + * Mangle Links + */ + +InlineLexer.prototype.mangle = function(text) { + var out = '' + , l = text.length + , i = 0 + , ch; + + for (; i < l; i++) { + ch = text.charCodeAt(i); + if (Math.random() > 0.5) { + ch = 'x' + ch.toString(16); + } + out += '&#' + ch + ';'; + } + + return out; +}; + +/** + * Renderer + */ + +function Renderer(options) { + this.options = options || {}; +} + +Renderer.prototype.code = function(code, lang, escaped) { + if (this.options.highlight) { + var out = this.options.highlight(code, lang); + if (out != null && out !== code) { + escaped = true; + code = out; + } + } + + if (!lang) { + return '
'
+      + (escaped ? code : escape(code, true))
+      + '\n
'; + } + + return '
'
+    + (escaped ? code : escape(code, true))
+    + '\n
\n'; +}; + +Renderer.prototype.blockquote = function(quote) { + return '
\n' + quote + '
\n'; +}; + +Renderer.prototype.html = function(html) { + return html; +}; + +Renderer.prototype.heading = function(text, level, raw) { + return '' + + text + + '\n'; +}; + +Renderer.prototype.hr = function() { + return this.options.xhtml ? '
\n' : '
\n'; +}; + +Renderer.prototype.list = function(body, ordered) { + var type = ordered ? 'ol' : 'ul'; + return '<' + type + '>\n' + body + '\n'; +}; + +Renderer.prototype.listitem = function(text) { + return '
  • ' + text + '
  • \n'; +}; + +Renderer.prototype.paragraph = function(text) { + return '

    ' + text + '

    \n'; +}; + +Renderer.prototype.table = function(header, body) { + return '\n' + + '\n' + + header + + '\n' + + '\n' + + body + + '\n' + + '
    \n'; +}; + +Renderer.prototype.tablerow = function(content) { + return '\n' + content + '\n'; +}; + +Renderer.prototype.tablecell = function(content, flags) { + var type = flags.header ? 'th' : 'td'; + var tag = flags.align + ? '<' + type + ' style="text-align:' + flags.align + '">' + : '<' + type + '>'; + return tag + content + '\n'; +}; + +// span level renderer +Renderer.prototype.strong = function(text) { + return '' + text + ''; +}; + +Renderer.prototype.em = function(text) { + return '' + text + ''; +}; + +Renderer.prototype.codespan = function(text) { + return '' + text + ''; +}; + +Renderer.prototype.br = function() { + return this.options.xhtml ? '
    ' : '
    '; +}; + +Renderer.prototype.del = function(text) { + return '' + text + ''; +}; + +Renderer.prototype.link = function(href, title, text) { + if (this.options.sanitize) { + try { + var prot = decodeURIComponent(unescape(href)) + .replace(/[^\w:]/g, '') + .toLowerCase(); + } catch (e) { + return ''; + } + if (prot.indexOf('javascript:') === 0) { + return ''; + } + } + var out = '
    '; + return out; +}; + +Renderer.prototype.image = function(href, title, text) { + var out = '' + text + '' : '>'; + return out; +}; + +/** + * Parsing & Compiling + */ + +function Parser(options) { + this.tokens = []; + this.token = null; + this.options = options || marked.defaults; + this.options.renderer = this.options.renderer || new Renderer; + this.renderer = this.options.renderer; + this.renderer.options = this.options; +} + +/** + * Static Parse Method + */ + +Parser.parse = function(src, options, renderer) { + var parser = new Parser(options, renderer); + return parser.parse(src); +}; + +/** + * Parse Loop + */ + +Parser.prototype.parse = function(src) { + this.inline = new InlineLexer(src.links, this.options, this.renderer); + this.tokens = src.reverse(); + + var out = ''; + while (this.next()) { + out += this.tok(); + } + + return out; +}; + +/** + * Next Token + */ + +Parser.prototype.next = function() { + return this.token = this.tokens.pop(); +}; + +/** + * Preview Next Token + */ + +Parser.prototype.peek = function() { + return this.tokens[this.tokens.length - 1] || 0; +}; + +/** + * Parse Text Tokens + */ + +Parser.prototype.parseText = function() { + var body = this.token.text; + + while (this.peek().type === 'text') { + body += '\n' + this.next().text; + } + + return this.inline.output(body); +}; + +/** + * Parse Current Token + */ + +Parser.prototype.tok = function() { + switch (this.token.type) { + case 'space': { + return ''; + } + case 'hr': { + return this.renderer.hr(); + } + case 'heading': { + return this.renderer.heading( + this.inline.output(this.token.text), + this.token.depth, + this.token.text); + } + case 'code': { + return this.renderer.code(this.token.text, + this.token.lang, + this.token.escaped); + } + case 'table': { + var header = '' + , body = '' + , i + , row + , cell + , flags + , j; + + // header + cell = ''; + for (i = 0; i < this.token.header.length; i++) { + flags = { header: true, align: this.token.align[i] }; + cell += this.renderer.tablecell( + this.inline.output(this.token.header[i]), + { header: true, align: this.token.align[i] } + ); + } + header += this.renderer.tablerow(cell); + + for (i = 0; i < this.token.cells.length; i++) { + row = this.token.cells[i]; + + cell = ''; + for (j = 0; j < row.length; j++) { + cell += this.renderer.tablecell( + this.inline.output(row[j]), + { header: false, align: this.token.align[j] } + ); + } + + body += this.renderer.tablerow(cell); + } + return this.renderer.table(header, body); + } + case 'blockquote_start': { + var body = ''; + + while (this.next().type !== 'blockquote_end') { + body += this.tok(); + } + + return this.renderer.blockquote(body); + } + case 'list_start': { + var body = '' + , ordered = this.token.ordered; + + while (this.next().type !== 'list_end') { + body += this.tok(); + } + + return this.renderer.list(body, ordered); + } + case 'list_item_start': { + var body = ''; + + while (this.next().type !== 'list_item_end') { + body += this.token.type === 'text' + ? this.parseText() + : this.tok(); + } + + return this.renderer.listitem(body); + } + case 'loose_item_start': { + var body = ''; + + while (this.next().type !== 'list_item_end') { + body += this.tok(); + } + + return this.renderer.listitem(body); + } + case 'html': { + var html = !this.token.pre && !this.options.pedantic + ? this.inline.output(this.token.text) + : this.token.text; + return this.renderer.html(html); + } + case 'paragraph': { + return this.renderer.paragraph(this.inline.output(this.token.text)); + } + case 'text': { + return this.renderer.paragraph(this.parseText()); + } + } +}; + +/** + * Helpers + */ + +function escape(html, encode) { + return html + .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} + +function unescape(html) { + return html.replace(/&([#\w]+);/g, function(_, n) { + n = n.toLowerCase(); + if (n === 'colon') return ':'; + if (n.charAt(0) === '#') { + return n.charAt(1) === 'x' + ? String.fromCharCode(parseInt(n.substring(2), 16)) + : String.fromCharCode(+n.substring(1)); + } + return ''; + }); +} + +function replace(regex, opt) { + regex = regex.source; + opt = opt || ''; + return function self(name, val) { + if (!name) return new RegExp(regex, opt); + val = val.source || val; + val = val.replace(/(^|[^\[])\^/g, '$1'); + regex = regex.replace(name, val); + return self; + }; +} + +function noop() {} +noop.exec = noop; + +function merge(obj) { + var i = 1 + , target + , key; + + for (; i < arguments.length; i++) { + target = arguments[i]; + for (key in target) { + if (Object.prototype.hasOwnProperty.call(target, key)) { + obj[key] = target[key]; + } + } + } + + return obj; +} + + +/** + * Marked + */ + +function marked(src, opt, callback) { + if (callback || typeof opt === 'function') { + if (!callback) { + callback = opt; + opt = null; + } + + opt = merge({}, marked.defaults, opt || {}); + + var highlight = opt.highlight + , tokens + , pending + , i = 0; + + try { + tokens = Lexer.lex(src, opt) + } catch (e) { + return callback(e); + } + + pending = tokens.length; + + var done = function() { + var out, err; + + try { + out = Parser.parse(tokens, opt); + } catch (e) { + err = e; + } + + opt.highlight = highlight; + + return err + ? callback(err) + : callback(null, out); + }; + + if (!highlight || highlight.length < 3) { + return done(); + } + + delete opt.highlight; + + if (!pending) return done(); + + for (; i < tokens.length; i++) { + (function(token) { + if (token.type !== 'code') { + return --pending || done(); + } + return highlight(token.text, token.lang, function(err, code) { + if (code == null || code === token.text) { + return --pending || done(); + } + token.text = code; + token.escaped = true; + --pending || done(); + }); + })(tokens[i]); + } + + return; + } + try { + if (opt) opt = merge({}, marked.defaults, opt); + return Parser.parse(Lexer.lex(src, opt), opt); + } catch (e) { + e.message += '\nPlease report this to https://github.com/chjj/marked.'; + if ((opt || marked.defaults).silent) { + return '

    An error occured:

    '
    +        + escape(e.message + '', true)
    +        + '
    '; + } + throw e; + } +} + +/** + * Options + */ + +marked.options = +marked.setOptions = function(opt) { + merge(marked.defaults, opt); + return marked; +}; + +marked.defaults = { + gfm: true, + tables: true, + breaks: false, + pedantic: false, + sanitize: false, + smartLists: false, + silent: false, + highlight: null, + langPrefix: 'lang-', + smartypants: false, + headerPrefix: '', + renderer: new Renderer, + xhtml: false +}; + +/** + * Expose + */ + +marked.Parser = Parser; +marked.parser = Parser.parse; + +marked.Renderer = Renderer; + +marked.Lexer = Lexer; +marked.lexer = Lexer.lex; + +marked.InlineLexer = InlineLexer; +marked.inlineLexer = InlineLexer.output; + +marked.parse = marked; + +if (typeof exports === 'object') { + module.exports = marked; +} else if (typeof define === 'function' && define.amd) { + define(function() { return marked; }); +} else { + this.marked = marked; +} + +}).call(function() { + return this || (typeof window !== 'undefined' ? window : global); +}()); diff --git a/_site/app/bower_components/marked/man/marked.1 b/_site/app/bower_components/marked/man/marked.1 new file mode 100644 index 0000000..f89f1a7 --- /dev/null +++ b/_site/app/bower_components/marked/man/marked.1 @@ -0,0 +1,88 @@ +.ds q \N'34' +.TH marked 1 "2014-01-31" "v0.3.1" "marked.js" + +.SH NAME +marked \- a javascript markdown parser + +.SH SYNOPSIS +.B marked +[\-o \fI\fP] [\-i \fI\fP] [\-\-help] +[\-\-tokens] [\-\-pedantic] [\-\-gfm] +[\-\-breaks] [\-\-tables] [\-\-sanitize] +[\-\-smart\-lists] [\-\-lang\-prefix \fI\fP] +[\-\-no\-etc...] [\-\-silent] [\fIfilename\fP] + +.SH DESCRIPTION +.B marked +is a full-featured javascript markdown parser, built for speed. It also includes +multiple GFM features. + +.SH EXAMPLES +.TP +cat in.md | marked > out.html +.TP +echo "hello *world*" | marked +.TP +marked \-o out.html in.md \-\-gfm +.TP +marked \-\-output="hello world.html" \-i in.md \-\-no-breaks + +.SH OPTIONS +.TP +.BI \-o,\ \-\-output\ [\fIoutput\fP] +Specify file output. If none is specified, write to stdout. +.TP +.BI \-i,\ \-\-input\ [\fIinput\fP] +Specify file input, otherwise use last argument as input file. If no input file +is specified, read from stdin. +.TP +.BI \-t,\ \-\-tokens +Output a token stream instead of html. +.TP +.BI \-\-pedantic +Conform to obscure parts of markdown.pl as much as possible. Don't fix original +markdown bugs. +.TP +.BI \-\-gfm +Enable github flavored markdown. +.TP +.BI \-\-breaks +Enable GFM line breaks. Only works with the gfm option. +.TP +.BI \-\-tables +Enable GFM tables. Only works with the gfm option. +.TP +.BI \-\-sanitize +Sanitize output. Ignore any HTML input. +.TP +.BI \-\-smart\-lists +Use smarter list behavior than the original markdown. +.TP +.BI \-\-lang\-prefix\ [\fIprefix\fP] +Set the prefix for code block classes. +.TP +.BI \-\-no\-sanitize,\ \-no-etc... +The inverse of any of the marked options above. +.TP +.BI \-\-silent +Silence error output. +.TP +.BI \-h,\ \-\-help +Display help information. + +.SH CONFIGURATION +For configuring and running programmatically. + +.B Example + + require('marked')('*foo*', { gfm: true }); + +.SH BUGS +Please report any bugs to https://github.com/chjj/marked. + +.SH LICENSE +Copyright (c) 2011-2014, Christopher Jeffrey (MIT License). + +.SH "SEE ALSO" +.BR markdown(1), +.BR node.js(1) diff --git a/_site/app/bower_components/marked/package.json b/_site/app/bower_components/marked/package.json new file mode 100644 index 0000000..4eb60d5 --- /dev/null +++ b/_site/app/bower_components/marked/package.json @@ -0,0 +1,22 @@ +{ + "name": "marked", + "description": "A markdown parser built for speed", + "author": "Christopher Jeffrey", + "version": "0.3.2", + "main": "./lib/marked.js", + "bin": "./bin/marked", + "man": "./man/marked.1", + "preferGlobal": true, + "repository": "git://github.com/chjj/marked.git", + "homepage": "https://github.com/chjj/marked", + "bugs": { "url": "http://github.com/chjj/marked/issues" }, + "license": "MIT", + "keywords": ["markdown", "markup", "html"], + "tags": ["markdown", "markup", "html"], + "devDependencies": { + "markdown": "*", + "showdown": "*", + "robotskirt": "*" + }, + "scripts": { "test": "node test", "bench": "node test --bench" } +} diff --git a/_site/app/bower_components/marked/test/README b/_site/app/bower_components/marked/test/README new file mode 100644 index 0000000..51f6560 --- /dev/null +++ b/_site/app/bower_components/marked/test/README @@ -0,0 +1,10 @@ +In this directory: + +# +# MarkdownTester -- Run tests for Markdown implementations +# +# Copyright (c) 2004-2005 John Gruber +# +# + +Partially modified for testing purposes. diff --git a/_site/app/bower_components/marked/test/browser/index.html b/_site/app/bower_components/marked/test/browser/index.html new file mode 100644 index 0000000..fbde129 --- /dev/null +++ b/_site/app/bower_components/marked/test/browser/index.html @@ -0,0 +1,5 @@ + +marked tests +

    testing...

    + + diff --git a/_site/app/bower_components/marked/test/browser/index.js b/_site/app/bower_components/marked/test/browser/index.js new file mode 100644 index 0000000..d5d7ee6 --- /dev/null +++ b/_site/app/bower_components/marked/test/browser/index.js @@ -0,0 +1,41 @@ +var fs = require('fs'); + +var test = require('../') + , runTests = test.runTests + , load = test.load; + +var express = require('express') + , app = express(); + +app.use(function(req, res, next) { + var setHeader = res.setHeader; + res.setHeader = function(name) { + switch (name) { + case 'Cache-Control': + case 'Last-Modified': + case 'ETag': + return; + } + return setHeader.apply(res, arguments); + }; + next(); +}); + +var dir = __dirname + '/../tests' + , files = {}; + +app.get('/test.js', function(req, res, next) { + var test = fs.readFileSync(__dirname + '/test.js', 'utf8') + , files = load(); + + test = test.replace('__TESTS__', JSON.stringify(files)); + test = test.replace('__MAIN__', runTests + ''); + + res.contentType('.js'); + res.send(test); +}); + +app.use(express.static(__dirname + '/../../lib')); +app.use(express.static(__dirname)); + +app.listen(8080); diff --git a/_site/app/bower_components/marked/test/browser/test.js b/_site/app/bower_components/marked/test/browser/test.js new file mode 100644 index 0000000..cef9e37 --- /dev/null +++ b/_site/app/bower_components/marked/test/browser/test.js @@ -0,0 +1,62 @@ +;(function() { + +var console = {} + , files = __TESTS__; + +console.log = function(text) { + var args = Array.prototype.slice.call(arguments, 1) + , i = 0; + + text = text.replace(/%\w/g, function() { + return args[i++] || ''; + }); + + if (window.console) window.console.log(text); + document.body.innerHTML += '
    ' + escape(text) + '
    '; +}; + +if (!Object.keys) { + Object.keys = function(obj) { + var out = [] + , key; + + for (key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + out.push(key); + } + } + + return out; + }; +} + +if (!Array.prototype.forEach) { + Array.prototype.forEach = function(callback, context) { + for (var i = 0; i < this.length; i++) { + callback.call(context || null, this[i], i, obj); + } + }; +} + +if (!String.prototype.trim) { + String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ''); + }; +} + +function load() { + return files; +} + +function escape(html, encode) { + return html + .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} + +(__MAIN__)(); + +}).call(this); diff --git a/_site/app/bower_components/marked/test/index.js b/_site/app/bower_components/marked/test/index.js new file mode 100644 index 0000000..35b52e2 --- /dev/null +++ b/_site/app/bower_components/marked/test/index.js @@ -0,0 +1,543 @@ +#!/usr/bin/env node + +/** + * marked tests + * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed) + * https://github.com/chjj/marked + */ + +/** + * Modules + */ + +var fs = require('fs') + , path = require('path') + , marked = require('../'); + +/** + * Load Tests + */ + +function load() { + var dir = __dirname + '/tests' + , files = {} + , list + , file + , i + , l; + + list = fs + .readdirSync(dir) + .filter(function(file) { + return path.extname(file) !== '.html'; + }) + .sort(function(a, b) { + a = path.basename(a).toLowerCase().charCodeAt(0); + b = path.basename(b).toLowerCase().charCodeAt(0); + return a > b ? 1 : (a < b ? -1 : 0); + }); + + i = 0; + l = list.length; + + for (; i < l; i++) { + file = path.join(dir, list[i]); + files[path.basename(file)] = { + text: fs.readFileSync(file, 'utf8'), + html: fs.readFileSync(file.replace(/[^.]+$/, 'html'), 'utf8') + }; + } + + return files; +} + +/** + * Test Runner + */ + +function runTests(engine, options) { + if (typeof engine !== 'function') { + options = engine; + engine = null; + } + + var engine = engine || marked + , options = options || {} + , files = options.files || load() + , complete = 0 + , failed = 0 + , failures = [] + , keys = Object.keys(files) + , i = 0 + , len = keys.length + , filename + , file + , flags + , text + , html + , j + , l; + + if (options.marked) { + marked.setOptions(options.marked); + } + +main: + for (; i < len; i++) { + filename = keys[i]; + file = files[filename]; + + if (marked._original) { + marked.defaults = marked._original; + delete marked._original; + } + + flags = filename.split('.').slice(1, -1); + if (flags.length) { + marked._original = marked.defaults; + marked.defaults = {}; + Object.keys(marked._original).forEach(function(key) { + marked.defaults[key] = marked._original[key]; + }); + flags.forEach(function(key) { + var val = true; + if (key.indexOf('no') === 0) { + key = key.substring(2); + val = false; + } + if (marked.defaults.hasOwnProperty(key)) { + marked.defaults[key] = val; + } + }); + } + + try { + text = engine(file.text).replace(/\s/g, ''); + html = file.html.replace(/\s/g, ''); + } catch(e) { + console.log('%s failed.', filename); + throw e; + } + + j = 0; + l = html.length; + + for (; j < l; j++) { + if (text[j] !== html[j]) { + failed++; + failures.push(filename); + + text = text.substring( + Math.max(j - 30, 0), + Math.min(j + 30, text.length)); + + html = html.substring( + Math.max(j - 30, 0), + Math.min(j + 30, html.length)); + + console.log( + '\n#%d. %s failed at offset %d. Near: "%s".\n', + i + 1, filename, j, text); + + console.log('\nGot:\n%s\n', text.trim() || text); + console.log('\nExpected:\n%s\n', html.trim() || html); + + if (options.stop) { + break main; + } + + continue main; + } + } + + complete++; + console.log('#%d. %s completed.', i + 1, filename); + } + + console.log('%d/%d tests completed successfully.', complete, len); + if (failed) console.log('%d/%d tests failed.', failed, len); + + // Tests currently failing. + if (~failures.indexOf('def_blocks.text') + && ~failures.indexOf('double_link.text') + && ~failures.indexOf('gfm_code_hr_list.text')) { + failed -= 3; + } + + return !failed; +} + +/** + * Benchmark a function + */ + +function bench(name, func) { + var files = bench.files || load(); + + if (!bench.files) { + bench.files = files; + + // Change certain tests to allow + // comparison to older benchmark times. + fs.readdirSync(__dirname + '/new').forEach(function(name) { + if (path.extname(name) === '.html') return; + if (name === 'main.text') return; + delete files[name]; + }); + + files['backslash_escapes.text'] = { + text: 'hello world \\[how](are you) today' + }; + + files['main.text'].text = files['main.text'].text.replace('* * *\n\n', ''); + } + + var start = Date.now() + , times = 1000 + , keys = Object.keys(files) + , i + , l = keys.length + , filename + , file; + + while (times--) { + for (i = 0; i < l; i++) { + filename = keys[i]; + file = files[filename]; + func(file.text); + } + } + + console.log('%s completed in %dms.', name, Date.now() - start); +} + +/** + * Benchmark all engines + */ + +function runBench(options) { + var options = options || {}; + + // Non-GFM, Non-pedantic + marked.setOptions({ + gfm: false, + tables: false, + breaks: false, + pedantic: false, + sanitize: false, + smartLists: false + }); + if (options.marked) { + marked.setOptions(options.marked); + } + bench('marked', marked); + + // GFM + marked.setOptions({ + gfm: true, + tables: false, + breaks: false, + pedantic: false, + sanitize: false, + smartLists: false + }); + if (options.marked) { + marked.setOptions(options.marked); + } + bench('marked (gfm)', marked); + + // Pedantic + marked.setOptions({ + gfm: false, + tables: false, + breaks: false, + pedantic: true, + sanitize: false, + smartLists: false + }); + if (options.marked) { + marked.setOptions(options.marked); + } + bench('marked (pedantic)', marked); + + // robotskirt + try { + bench('robotskirt', (function() { + var rs = require('robotskirt'); + return function(text) { + var parser = rs.Markdown.std(); + return parser.render(text); + }; + })()); + } catch (e) { + console.log('Could not bench robotskirt.'); + } + + // showdown + try { + bench('showdown (reuse converter)', (function() { + var Showdown = require('showdown'); + var convert = new Showdown.converter(); + return function(text) { + return convert.makeHtml(text); + }; + })()); + bench('showdown (new converter)', (function() { + var Showdown = require('showdown'); + return function(text) { + var convert = new Showdown.converter(); + return convert.makeHtml(text); + }; + })()); + } catch (e) { + console.log('Could not bench showdown.'); + } + + // markdown.js + try { + bench('markdown.js', require('markdown').parse); + } catch (e) { + console.log('Could not bench markdown.js.'); + } +} + +/** + * A simple one-time benchmark + */ + +function time(options) { + var options = options || {}; + if (options.marked) { + marked.setOptions(options.marked); + } + bench('marked', marked); +} + +/** + * Markdown Test Suite Fixer + * This function is responsible for "fixing" + * the markdown test suite. There are + * certain aspects of the suite that + * are strange or might make tests + * fail for reasons unrelated to + * conformance. + */ + +function fix(options) { + ['tests', 'original', 'new'].forEach(function(dir) { + try { + fs.mkdirSync(path.resolve(__dirname, dir), 0755); + } catch (e) { + ; + } + }); + + // rm -rf tests + fs.readdirSync(path.resolve(__dirname, 'tests')).forEach(function(file) { + fs.unlinkSync(path.resolve(__dirname, 'tests', file)); + }); + + // cp -r original tests + fs.readdirSync(path.resolve(__dirname, 'original')).forEach(function(file) { + var nfile = file; + if (file.indexOf('hard_wrapped_paragraphs_with_list_like_lines.') === 0) { + nfile = file.replace(/\.(text|html)$/, '.nogfm.$1'); + } + fs.writeFileSync(path.resolve(__dirname, 'tests', nfile), + fs.readFileSync(path.resolve(__dirname, 'original', file))); + }); + + // node fix.js + var dir = __dirname + '/tests'; + + fs.readdirSync(dir).filter(function(file) { + return path.extname(file) === '.html'; + }).forEach(function(file) { + var file = path.join(dir, file) + , html = fs.readFileSync(file, 'utf8'); + + // fix unencoded quotes + html = html + .replace(/='([^\n']*)'(?=[^<>\n]*>)/g, '=&__APOS__;$1&__APOS__;') + .replace(/="([^\n"]*)"(?=[^<>\n]*>)/g, '=&__QUOT__;$1&__QUOT__;') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(/&__QUOT__;/g, '"') + .replace(/&__APOS__;/g, '\''); + + // add heading id's + html = html.replace(/<(h[1-6])>([^<]+)<\/\1>/g, function(s, h, text) { + var id = text + .replace(/'/g, '\'') + .replace(/"/g, '"') + .replace(/>/g, '>') + .replace(/</g, '<') + .replace(/&/g, '&'); + + id = id.toLowerCase().replace(/[^\w]+/g, '-'); + + return '<' + h + ' id="' + id + '">' + text + ''; + }); + + fs.writeFileSync(file, html); + }); + + // turn
    into
    + fs.readdirSync(dir).forEach(function(file) { + var file = path.join(dir, file) + , text = fs.readFileSync(file, 'utf8'); + + text = text.replace(/(<|<)hr\s*\/(>|>)/g, '$1hr$2'); + + fs.writeFileSync(file, text); + }); + + // markdown does some strange things. + // it does not encode naked `>`, marked does. + (function() { + var file = dir + '/amps_and_angles_encoding.html'; + var html = fs.readFileSync(file, 'utf8') + .replace('6 > 5.', '6 > 5.'); + + fs.writeFileSync(file, html); + })(); + + // cp new/* tests/ + fs.readdirSync(path.resolve(__dirname, 'new')).forEach(function(file) { + fs.writeFileSync(path.resolve(__dirname, 'tests', file), + fs.readFileSync(path.resolve(__dirname, 'new', file))); + }); +} + +/** + * Argument Parsing + */ + +function parseArg(argv) { + var argv = process.argv.slice(2) + , options = {} + , orphans = [] + , arg; + + function getarg() { + var arg = argv.shift(); + + if (arg.indexOf('--') === 0) { + // e.g. --opt + arg = arg.split('='); + if (arg.length > 1) { + // e.g. --opt=val + argv.unshift(arg.slice(1).join('=')); + } + arg = arg[0]; + } else if (arg[0] === '-') { + if (arg.length > 2) { + // e.g. -abc + argv = arg.substring(1).split('').map(function(ch) { + return '-' + ch; + }).concat(argv); + arg = argv.shift(); + } else { + // e.g. -a + } + } else { + // e.g. foo + } + + return arg; + } + + while (argv.length) { + arg = getarg(); + switch (arg) { + case '-f': + case '--fix': + case 'fix': + options.fix = true; + break; + case '-b': + case '--bench': + options.bench = true; + break; + case '-s': + case '--stop': + options.stop = true; + break; + case '-t': + case '--time': + options.time = true; + break; + default: + if (arg.indexOf('--') === 0) { + opt = camelize(arg.replace(/^--(no-)?/, '')); + if (!marked.defaults.hasOwnProperty(opt)) { + continue; + } + options.marked = options.marked || {}; + if (arg.indexOf('--no-') === 0) { + options.marked[opt] = typeof marked.defaults[opt] !== 'boolean' + ? null + : false; + } else { + options.marked[opt] = typeof marked.defaults[opt] !== 'boolean' + ? argv.shift() + : true; + } + } else { + orphans.push(arg); + } + break; + } + } + + return options; +} + +/** + * Helpers + */ + +function camelize(text) { + return text.replace(/(\w)-(\w)/g, function(_, a, b) { + return a + b.toUpperCase(); + }); +} + +/** + * Main + */ + +function main(argv) { + var opt = parseArg(); + + if (opt.fix) { + return fix(opt); + } + + if (opt.bench) { + return runBench(opt); + } + + if (opt.time) { + return time(opt); + } + + return runTests(opt); +} + +/** + * Execute + */ + +if (!module.parent) { + process.title = 'marked'; + process.exit(main(process.argv.slice()) ? 0 : 1); +} else { + exports = main; + exports.main = main; + exports.runTests = runTests; + exports.runBench = runBench; + exports.load = load; + exports.bench = bench; + module.exports = exports; +} diff --git a/_site/app/bower_components/marked/test/new/autolink_lines.html b/_site/app/bower_components/marked/test/new/autolink_lines.html new file mode 100644 index 0000000..aa2bed4 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/autolink_lines.html @@ -0,0 +1,3 @@ +

    hello world +http://example.com +

    diff --git a/_site/app/bower_components/marked/test/new/autolink_lines.text b/_site/app/bower_components/marked/test/new/autolink_lines.text new file mode 100644 index 0000000..c9b61a2 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/autolink_lines.text @@ -0,0 +1,2 @@ +hello world + diff --git a/_site/app/bower_components/marked/test/new/blockquote_list_item.html b/_site/app/bower_components/marked/test/new/blockquote_list_item.html new file mode 100644 index 0000000..83cf0bd --- /dev/null +++ b/_site/app/bower_components/marked/test/new/blockquote_list_item.html @@ -0,0 +1,3 @@ +

    This fails in markdown.pl and upskirt:

    + + diff --git a/_site/app/bower_components/marked/test/new/blockquote_list_item.text b/_site/app/bower_components/marked/test/new/blockquote_list_item.text new file mode 100644 index 0000000..19e9382 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/blockquote_list_item.text @@ -0,0 +1,4 @@ +This fails in markdown.pl and upskirt: + +* hello + > world diff --git a/_site/app/bower_components/marked/test/new/case_insensitive_refs.html b/_site/app/bower_components/marked/test/new/case_insensitive_refs.html new file mode 100644 index 0000000..c54388e --- /dev/null +++ b/_site/app/bower_components/marked/test/new/case_insensitive_refs.html @@ -0,0 +1 @@ +

    hi

    diff --git a/_site/app/bower_components/marked/test/new/case_insensitive_refs.text b/_site/app/bower_components/marked/test/new/case_insensitive_refs.text new file mode 100644 index 0000000..598915a --- /dev/null +++ b/_site/app/bower_components/marked/test/new/case_insensitive_refs.text @@ -0,0 +1,3 @@ +[hi] + +[HI]: /url diff --git a/_site/app/bower_components/marked/test/new/def_blocks.html b/_site/app/bower_components/marked/test/new/def_blocks.html new file mode 100644 index 0000000..14edc97 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/def_blocks.html @@ -0,0 +1,28 @@ +
    +

    hello +[1]: hello

    +
    + +
    + +
    +

    hello

    +
    + + + + + + + + +
    +

    foo +bar +bar

    +
    diff --git a/_site/app/bower_components/marked/test/new/def_blocks.text b/_site/app/bower_components/marked/test/new/def_blocks.text new file mode 100644 index 0000000..4d16292 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/def_blocks.text @@ -0,0 +1,21 @@ +> hello +> [1]: hello + +* * * + +> hello +[2]: hello + + +* hello +* [3]: hello + + +* hello +[4]: hello + + +> foo +> bar +[1]: foo +> bar diff --git a/_site/app/bower_components/marked/test/new/double_link.html b/_site/app/bower_components/marked/test/new/double_link.html new file mode 100644 index 0000000..ff68395 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/double_link.html @@ -0,0 +1,5 @@ +

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

    + +

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

    + +

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

    diff --git a/_site/app/bower_components/marked/test/new/double_link.text b/_site/app/bower_components/marked/test/new/double_link.text new file mode 100644 index 0000000..5021673 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/double_link.text @@ -0,0 +1,5 @@ +

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

    + +Already linked: [http://example.com/](http://example.com/). + +Already linked: **http://example.com/**. diff --git a/_site/app/bower_components/marked/test/new/escaped_angles.html b/_site/app/bower_components/marked/test/new/escaped_angles.html new file mode 100644 index 0000000..7cf47c4 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/escaped_angles.html @@ -0,0 +1 @@ +

    >

    diff --git a/_site/app/bower_components/marked/test/new/escaped_angles.text b/_site/app/bower_components/marked/test/new/escaped_angles.text new file mode 100644 index 0000000..db7422f --- /dev/null +++ b/_site/app/bower_components/marked/test/new/escaped_angles.text @@ -0,0 +1 @@ +\> diff --git a/_site/app/bower_components/marked/test/new/gfm_break.breaks.html b/_site/app/bower_components/marked/test/new/gfm_break.breaks.html new file mode 100644 index 0000000..398ba01 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_break.breaks.html @@ -0,0 +1 @@ +

    Look at the
    pretty line
    breaks.

    diff --git a/_site/app/bower_components/marked/test/new/gfm_break.breaks.text b/_site/app/bower_components/marked/test/new/gfm_break.breaks.text new file mode 100644 index 0000000..71097d2 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_break.breaks.text @@ -0,0 +1,3 @@ +Look at the +pretty line +breaks. diff --git a/_site/app/bower_components/marked/test/new/gfm_code.html b/_site/app/bower_components/marked/test/new/gfm_code.html new file mode 100644 index 0000000..fe3522e --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_code.html @@ -0,0 +1,5 @@ +
    var a = 'hello';
    +console.log(a + ' world');
    +
    echo "hello, ${WORLD}"
    +
    Q: What do you call a tall person who sells stolen goods?
    +
    A longfence!
    diff --git a/_site/app/bower_components/marked/test/new/gfm_code.text b/_site/app/bower_components/marked/test/new/gfm_code.text new file mode 100644 index 0000000..c594387 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_code.text @@ -0,0 +1,16 @@ +``` js +var a = 'hello'; +console.log(a + ' world'); +``` + +~~~bash +echo "hello, ${WORLD}" +~~~ + +```````longfence +Q: What do you call a tall person who sells stolen goods? +``````` + +~~~~~~~~~~ ManyTildes +A longfence! +~~~~~~~~~~ diff --git a/_site/app/bower_components/marked/test/new/gfm_code_hr_list.html b/_site/app/bower_components/marked/test/new/gfm_code_hr_list.html new file mode 100644 index 0000000..9fbd0fb --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_code_hr_list.html @@ -0,0 +1,52 @@ +

    foo

    +
      +
    1. bar:

      +
      +
        +
      • one
          +
        • two
            +
          • three
          • +
          • four
          • +
          • five
          • +
          +
        • +
        +
      • +
      +
      +
    2. +
    3. foo:

      +
       line 1
      + line 2
      +
    4. +
    5. foo:

      +
        +
      1. foo bar bar:

        +
         some code here
        +
        +
      2. +
      3. foo bar bar:

        +
         foo
        + ---
        + bar
        + ---
        + foo
        + bar
        +
      4. +
      5. foo bar bar:

        +
         ---
        + foo
        + foo
        + ---
        + bar
        +
      6. +
      7. foo bar bar:

        +
         foo
        + ---
        + bar
        +
      8. +
      9. foo

        +
      10. +
      +
    6. +
    diff --git a/_site/app/bower_components/marked/test/new/gfm_code_hr_list.text b/_site/app/bower_components/marked/test/new/gfm_code_hr_list.text new file mode 100644 index 0000000..0eba405 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_code_hr_list.text @@ -0,0 +1,53 @@ +## foo + +1. bar: + + > - one + - two + - three + - four + - five + +1. foo: + + ``` + line 1 + line 2 + ``` + +1. foo: + + 1. foo `bar` bar: + + ``` erb + some code here + ``` + + 2. foo `bar` bar: + + ``` erb + foo + --- + bar + --- + foo + bar + ``` + + 3. foo `bar` bar: + + ``` html + --- + foo + foo + --- + bar + ``` + + 4. foo `bar` bar: + + foo + --- + bar + + 5. foo diff --git a/_site/app/bower_components/marked/test/new/gfm_del.html b/_site/app/bower_components/marked/test/new/gfm_del.html new file mode 100644 index 0000000..95e9ec7 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_del.html @@ -0,0 +1 @@ +

    hello hi world

    diff --git a/_site/app/bower_components/marked/test/new/gfm_del.text b/_site/app/bower_components/marked/test/new/gfm_del.text new file mode 100644 index 0000000..d29ca77 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_del.text @@ -0,0 +1 @@ +hello ~~hi~~ world diff --git a/_site/app/bower_components/marked/test/new/gfm_em.html b/_site/app/bower_components/marked/test/new/gfm_em.html new file mode 100644 index 0000000..8fac346 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_em.html @@ -0,0 +1 @@ +

    These words should_not_be_emphasized.

    diff --git a/_site/app/bower_components/marked/test/new/gfm_em.text b/_site/app/bower_components/marked/test/new/gfm_em.text new file mode 100644 index 0000000..6319874 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_em.text @@ -0,0 +1 @@ +These words should_not_be_emphasized. diff --git a/_site/app/bower_components/marked/test/new/gfm_links.html b/_site/app/bower_components/marked/test/new/gfm_links.html new file mode 100644 index 0000000..4f62ae1 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_links.html @@ -0,0 +1,2 @@ +

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

    diff --git a/_site/app/bower_components/marked/test/new/gfm_links.text b/_site/app/bower_components/marked/test/new/gfm_links.text new file mode 100644 index 0000000..c133666 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_links.text @@ -0,0 +1 @@ +This should be a link: http://example.com/hello-world. diff --git a/_site/app/bower_components/marked/test/new/gfm_tables.html b/_site/app/bower_components/marked/test/new/gfm_tables.html new file mode 100644 index 0000000..70bec82 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_tables.html @@ -0,0 +1,37 @@ + + + + + + + + +
    Heading 1Heading 2
    Cell 1Cell 2
    Cell 3Cell 4
    + + + + + + + + +
    Header 1Header 2Header 3Header 4
    Cell 1Cell 2Cell 3Cell 4
    Cell 5Cell 6Cell 7Cell 8
    +
    Test code
    + + + + + + + + +
    Header 1Header 2
    Cell 1Cell 2
    Cell 3Cell 4
    + + + + + + + + +
    Header 1Header 2Header 3Header 4
    Cell 1Cell 2Cell 3Cell 4
    Cell 5Cell 6Cell 7Cell 8
    diff --git a/_site/app/bower_components/marked/test/new/gfm_tables.text b/_site/app/bower_components/marked/test/new/gfm_tables.text new file mode 100644 index 0000000..5fd6321 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/gfm_tables.text @@ -0,0 +1,21 @@ +| Heading 1 | Heading 2 +| --------- | --------- +| Cell 1 | Cell 2 +| Cell 3 | Cell 4 + +| Header 1 | Header 2 | Header 3 | Header 4 | +| :------: | -------: | :------- | -------- | +| Cell 1 | Cell 2 | Cell 3 | Cell 4 | +| Cell 5 | Cell 6 | Cell 7 | Cell 8 | + + Test code + +Header 1 | Header 2 +-------- | -------- +Cell 1 | Cell 2 +Cell 3 | Cell 4 + +Header 1|Header 2|Header 3|Header 4 +:-------|:------:|-------:|-------- +Cell 1 |Cell 2 |Cell 3 |Cell 4 +*Cell 5*|Cell 6 |Cell 7 |Cell 8 diff --git a/_site/app/bower_components/marked/test/new/hr_list_break.html b/_site/app/bower_components/marked/test/new/hr_list_break.html new file mode 100644 index 0000000..bd3ad1f --- /dev/null +++ b/_site/app/bower_components/marked/test/new/hr_list_break.html @@ -0,0 +1,10 @@ + + +
    + +

    you today?

    diff --git a/_site/app/bower_components/marked/test/new/hr_list_break.text b/_site/app/bower_components/marked/test/new/hr_list_break.text new file mode 100644 index 0000000..036fe47 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/hr_list_break.text @@ -0,0 +1,6 @@ +* hello +world +* how +are +* * * +you today? diff --git a/_site/app/bower_components/marked/test/new/lazy_blockquotes.html b/_site/app/bower_components/marked/test/new/lazy_blockquotes.html new file mode 100644 index 0000000..a701d42 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/lazy_blockquotes.html @@ -0,0 +1,4 @@ +
    +

    hi there +bud

    +
    diff --git a/_site/app/bower_components/marked/test/new/lazy_blockquotes.text b/_site/app/bower_components/marked/test/new/lazy_blockquotes.text new file mode 100644 index 0000000..c0e0b15 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/lazy_blockquotes.text @@ -0,0 +1,2 @@ +> hi there +bud diff --git a/_site/app/bower_components/marked/test/new/list_item_text.html b/_site/app/bower_components/marked/test/new/list_item_text.html new file mode 100644 index 0000000..142df36 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/list_item_text.html @@ -0,0 +1 @@ + diff --git a/_site/app/bower_components/marked/test/new/list_item_text.text b/_site/app/bower_components/marked/test/new/list_item_text.text new file mode 100644 index 0000000..a8f81b1 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/list_item_text.text @@ -0,0 +1,5 @@ + * item1 + + * item2 + + text diff --git a/_site/app/bower_components/marked/test/new/loose_lists.html b/_site/app/bower_components/marked/test/new/loose_lists.html new file mode 100644 index 0000000..c1bd82a --- /dev/null +++ b/_site/app/bower_components/marked/test/new/loose_lists.html @@ -0,0 +1,62 @@ + + + + +

    better behavior:

    + + + + + + + + + + + + + + + + + + + + + + diff --git a/_site/app/bower_components/marked/test/new/loose_lists.text b/_site/app/bower_components/marked/test/new/loose_lists.text new file mode 100644 index 0000000..cb360a1 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/loose_lists.text @@ -0,0 +1,59 @@ +* hello + world + + how + are +* you + + + +better behavior: + +* hello + * world + how + + are + you + + * today +* hi + + + +* hello + +* world +* hi + + + +* hello +* world + +* hi + + + +* hello +* world + + how +* hi + + + +* hello +* world +* how + + are + + + +* hello +* world + +* how + + are diff --git a/_site/app/bower_components/marked/test/new/main.html b/_site/app/bower_components/marked/test/new/main.html new file mode 100644 index 0000000..8f78c4d --- /dev/null +++ b/_site/app/bower_components/marked/test/new/main.html @@ -0,0 +1,4 @@ +

    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.

    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.
    +Lots of it...
    diff --git a/_site/app/bower_components/marked/test/new/main.text b/_site/app/bower_components/marked/test/new/main.text new file mode 100644 index 0000000..58e17a6 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/main.text @@ -0,0 +1,55 @@ +[test]: http://google.com/ "Google" + +# 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][test] 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. + 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](//hello). +And an image ![alt](src). + + Code goes here. + Lots of it... diff --git a/_site/app/bower_components/marked/test/new/nested_code.html b/_site/app/bower_components/marked/test/new/nested_code.html new file mode 100644 index 0000000..c370592 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/nested_code.html @@ -0,0 +1 @@ +

    hi ther `` ok ```

    diff --git a/_site/app/bower_components/marked/test/new/nested_code.text b/_site/app/bower_components/marked/test/new/nested_code.text new file mode 100644 index 0000000..910e3d4 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/nested_code.text @@ -0,0 +1 @@ +````` hi ther `` ok ``` ````` diff --git a/_site/app/bower_components/marked/test/new/nested_em.html b/_site/app/bower_components/marked/test/new/nested_em.html new file mode 100644 index 0000000..3ab4ec8 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/nested_em.html @@ -0,0 +1,3 @@ +

    test test test

    + +

    test test test

    diff --git a/_site/app/bower_components/marked/test/new/nested_em.text b/_site/app/bower_components/marked/test/new/nested_em.text new file mode 100644 index 0000000..550d0eb --- /dev/null +++ b/_site/app/bower_components/marked/test/new/nested_em.text @@ -0,0 +1,3 @@ +*test **test** test* + +_test __test__ test_ diff --git a/_site/app/bower_components/marked/test/new/nested_square_link.html b/_site/app/bower_components/marked/test/new/nested_square_link.html new file mode 100644 index 0000000..c8b7940 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/nested_square_link.html @@ -0,0 +1 @@ +

    the ] character

    diff --git a/_site/app/bower_components/marked/test/new/nested_square_link.text b/_site/app/bower_components/marked/test/new/nested_square_link.text new file mode 100644 index 0000000..82226ed --- /dev/null +++ b/_site/app/bower_components/marked/test/new/nested_square_link.text @@ -0,0 +1 @@ +[the `]` character](/url) diff --git a/_site/app/bower_components/marked/test/new/not_a_link.html b/_site/app/bower_components/marked/test/new/not_a_link.html new file mode 100644 index 0000000..a01685d --- /dev/null +++ b/_site/app/bower_components/marked/test/new/not_a_link.html @@ -0,0 +1 @@ +

    [test](not a link)

    diff --git a/_site/app/bower_components/marked/test/new/not_a_link.text b/_site/app/bower_components/marked/test/new/not_a_link.text new file mode 100644 index 0000000..26f6043 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/not_a_link.text @@ -0,0 +1 @@ +\[test](not a link) diff --git a/_site/app/bower_components/marked/test/new/ref_paren.html b/_site/app/bower_components/marked/test/new/ref_paren.html new file mode 100644 index 0000000..cff6977 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/ref_paren.html @@ -0,0 +1 @@ +

    hi

    diff --git a/_site/app/bower_components/marked/test/new/ref_paren.text b/_site/app/bower_components/marked/test/new/ref_paren.text new file mode 100644 index 0000000..aa97c91 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/ref_paren.text @@ -0,0 +1,3 @@ +[hi] + +[hi]: /url (there) diff --git a/_site/app/bower_components/marked/test/new/same_bullet.html b/_site/app/bower_components/marked/test/new/same_bullet.html new file mode 100644 index 0000000..9220741 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/same_bullet.html @@ -0,0 +1,5 @@ + diff --git a/_site/app/bower_components/marked/test/new/same_bullet.text b/_site/app/bower_components/marked/test/new/same_bullet.text new file mode 100644 index 0000000..27a8967 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/same_bullet.text @@ -0,0 +1,3 @@ +* test ++ test +- test diff --git a/_site/app/bower_components/marked/test/new/text.smartypants.html b/_site/app/bower_components/marked/test/new/text.smartypants.html new file mode 100644 index 0000000..22997c4 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/text.smartypants.html @@ -0,0 +1,6 @@ +

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

    + +

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

    + +

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

    diff --git a/_site/app/bower_components/marked/test/new/text.smartypants.text b/_site/app/bower_components/marked/test/new/text.smartypants.text new file mode 100644 index 0000000..d91c8dc --- /dev/null +++ b/_site/app/bower_components/marked/test/new/text.smartypants.text @@ -0,0 +1,6 @@ +Hello world 'how' "are" you -- today... + +"It's a more 'challenging' smartypants test..." + +'And,' as a bonus -- "one +multiline" test! diff --git a/_site/app/bower_components/marked/test/new/toplevel_paragraphs.gfm.html b/_site/app/bower_components/marked/test/new/toplevel_paragraphs.gfm.html new file mode 100644 index 0000000..970c6f1 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/toplevel_paragraphs.gfm.html @@ -0,0 +1,34 @@ +

    hello world + how are you + how are you

    + +

    hello world

    +
    how are you
    + +

    hello world

    +
    + +

    hello world

    +

    how are you

    + +

    hello world

    +

    how are you

    + +

    hello world

    +

    how are you

    + +

    hello world

    + + +

    hello world

    +
    how are you
    + +

    hello world +how are you

    + +

    hello world +

    + +
    hello
    + +

    hello

    diff --git a/_site/app/bower_components/marked/test/new/toplevel_paragraphs.gfm.text b/_site/app/bower_components/marked/test/new/toplevel_paragraphs.gfm.text new file mode 100644 index 0000000..66366c0 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/toplevel_paragraphs.gfm.text @@ -0,0 +1,37 @@ +hello world + how are you + how are you + +hello world +``` +how are you +``` + +hello world +* * * + +hello world +# how are you + +hello world +how are you +=========== + +hello world +> how are you + +hello world +* how are you + +hello world +
    how are you
    + +hello world +how are you + +hello [world][how] +[how]: /are/you + +
    hello
    + +hello diff --git a/_site/app/bower_components/marked/test/new/tricky_list.html b/_site/app/bower_components/marked/test/new/tricky_list.html new file mode 100644 index 0000000..764a335 --- /dev/null +++ b/_site/app/bower_components/marked/test/new/tricky_list.html @@ -0,0 +1,23 @@ +

    hello world

    + + + +

    hello world

    + + + +

    hello world

    + + + +

    hello world

    + + diff --git a/_site/app/bower_components/marked/test/new/tricky_list.text b/_site/app/bower_components/marked/test/new/tricky_list.text new file mode 100644 index 0000000..9aa76ce --- /dev/null +++ b/_site/app/bower_components/marked/test/new/tricky_list.text @@ -0,0 +1,15 @@ +**hello** _world_ + +* hello world + +**hello** _world_ + +* hello world + +**hello** _world_ + +* Hello world + +**hello** _world_ + +* hello world diff --git a/_site/app/bower_components/marked/test/original/amps_and_angles_encoding.html b/_site/app/bower_components/marked/test/original/amps_and_angles_encoding.html new file mode 100644 index 0000000..9606860 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/amps_and_angles_encoding.html @@ -0,0 +1,17 @@ +

    AT&T has an ampersand in their name.

    + +

    AT&T is another way to write it.

    + +

    This & that.

    + +

    4 < 5.

    + +

    6 > 5.

    + +

    Here's a link with an ampersand in the URL.

    + +

    Here's a link with an amersand in the link text: AT&T.

    + +

    Here's an inline link.

    + +

    Here's an inline link.

    diff --git a/_site/app/bower_components/marked/test/original/amps_and_angles_encoding.text b/_site/app/bower_components/marked/test/original/amps_and_angles_encoding.text new file mode 100644 index 0000000..89ec3ae --- /dev/null +++ b/_site/app/bower_components/marked/test/original/amps_and_angles_encoding.text @@ -0,0 +1,21 @@ +AT&T has an ampersand in their name. + +AT&T is another way to write it. + +This & that. + +4 < 5. + +6 > 5. + +Here's a [link] [1] with an ampersand in the URL. + +Here's a link with an amersand in the link text: [AT&T] [2]. + +Here's an inline [link](/script?foo=1&bar=2). + +Here's an inline [link](). + + +[1]: http://example.com/?foo=1&bar=2 +[2]: http://att.com/ "AT&T" diff --git a/_site/app/bower_components/marked/test/original/auto_links.html b/_site/app/bower_components/marked/test/original/auto_links.html new file mode 100644 index 0000000..f8df985 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/auto_links.html @@ -0,0 +1,18 @@ +

    Link: http://example.com/.

    + +

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

    + + + +
    +

    Blockquoted: http://example.com/

    +
    + +

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

    + +
    or here: <http://example.com/>
    +
    diff --git a/_site/app/bower_components/marked/test/original/auto_links.text b/_site/app/bower_components/marked/test/original/auto_links.text new file mode 100644 index 0000000..f85767b --- /dev/null +++ b/_site/app/bower_components/marked/test/original/auto_links.text @@ -0,0 +1,13 @@ +Link: . + +With an ampersand: + +* In a list? +* +* It should. + +> Blockquoted: + +Auto-links should not occur here: `` + + or here: diff --git a/_site/app/bower_components/marked/test/original/backslash_escapes.html b/_site/app/bower_components/marked/test/original/backslash_escapes.html new file mode 100644 index 0000000..29870da --- /dev/null +++ b/_site/app/bower_components/marked/test/original/backslash_escapes.html @@ -0,0 +1,118 @@ +

    These should all get escaped:

    + +

    Backslash: \

    + +

    Backtick: `

    + +

    Asterisk: *

    + +

    Underscore: _

    + +

    Left brace: {

    + +

    Right brace: }

    + +

    Left bracket: [

    + +

    Right bracket: ]

    + +

    Left paren: (

    + +

    Right paren: )

    + +

    Greater-than: >

    + +

    Hash: #

    + +

    Period: .

    + +

    Bang: !

    + +

    Plus: +

    + +

    Minus: -

    + +

    These should not, because they occur within a code block:

    + +
    Backslash: \\
    +
    +Backtick: \`
    +
    +Asterisk: \*
    +
    +Underscore: \_
    +
    +Left brace: \{
    +
    +Right brace: \}
    +
    +Left bracket: \[
    +
    +Right bracket: \]
    +
    +Left paren: \(
    +
    +Right paren: \)
    +
    +Greater-than: \>
    +
    +Hash: \#
    +
    +Period: \.
    +
    +Bang: \!
    +
    +Plus: \+
    +
    +Minus: \-
    +
    + +

    Nor should these, which occur in code spans:

    + +

    Backslash: \\

    + +

    Backtick: \`

    + +

    Asterisk: \*

    + +

    Underscore: \_

    + +

    Left brace: \{

    + +

    Right brace: \}

    + +

    Left bracket: \[

    + +

    Right bracket: \]

    + +

    Left paren: \(

    + +

    Right paren: \)

    + +

    Greater-than: \>

    + +

    Hash: \#

    + +

    Period: \.

    + +

    Bang: \!

    + +

    Plus: \+

    + +

    Minus: \-

    + + +

    These should get escaped, even though they're matching pairs for +other Markdown constructs:

    + +

    *asterisks*

    + +

    _underscores_

    + +

    `backticks`

    + +

    This is a code span with a literal backslash-backtick sequence: \`

    + +

    This is a tag with unescaped backticks bar.

    + +

    This is a tag with backslashes bar.

    diff --git a/_site/app/bower_components/marked/test/original/backslash_escapes.text b/_site/app/bower_components/marked/test/original/backslash_escapes.text new file mode 100644 index 0000000..5b014cb --- /dev/null +++ b/_site/app/bower_components/marked/test/original/backslash_escapes.text @@ -0,0 +1,120 @@ +These should all get escaped: + +Backslash: \\ + +Backtick: \` + +Asterisk: \* + +Underscore: \_ + +Left brace: \{ + +Right brace: \} + +Left bracket: \[ + +Right bracket: \] + +Left paren: \( + +Right paren: \) + +Greater-than: \> + +Hash: \# + +Period: \. + +Bang: \! + +Plus: \+ + +Minus: \- + + + +These should not, because they occur within a code block: + + Backslash: \\ + + Backtick: \` + + Asterisk: \* + + Underscore: \_ + + Left brace: \{ + + Right brace: \} + + Left bracket: \[ + + Right bracket: \] + + Left paren: \( + + Right paren: \) + + Greater-than: \> + + Hash: \# + + Period: \. + + Bang: \! + + Plus: \+ + + Minus: \- + + +Nor should these, which occur in code spans: + +Backslash: `\\` + +Backtick: `` \` `` + +Asterisk: `\*` + +Underscore: `\_` + +Left brace: `\{` + +Right brace: `\}` + +Left bracket: `\[` + +Right bracket: `\]` + +Left paren: `\(` + +Right paren: `\)` + +Greater-than: `\>` + +Hash: `\#` + +Period: `\.` + +Bang: `\!` + +Plus: `\+` + +Minus: `\-` + + +These should get escaped, even though they're matching pairs for +other Markdown constructs: + +\*asterisks\* + +\_underscores\_ + +\`backticks\` + +This is a code span with a literal backslash-backtick sequence: `` \` `` + +This is a tag with unescaped backticks bar. + +This is a tag with backslashes bar. diff --git a/_site/app/bower_components/marked/test/original/blockquotes_with_code_blocks.html b/_site/app/bower_components/marked/test/original/blockquotes_with_code_blocks.html new file mode 100644 index 0000000..990202a --- /dev/null +++ b/_site/app/bower_components/marked/test/original/blockquotes_with_code_blocks.html @@ -0,0 +1,15 @@ +
    +

    Example:

    + +
    sub status {
    +    print "working";
    +}
    +
    + +

    Or:

    + +
    sub status {
    +    return "working";
    +}
    +
    +
    diff --git a/_site/app/bower_components/marked/test/original/blockquotes_with_code_blocks.text b/_site/app/bower_components/marked/test/original/blockquotes_with_code_blocks.text new file mode 100644 index 0000000..c31d171 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/blockquotes_with_code_blocks.text @@ -0,0 +1,11 @@ +> Example: +> +> sub status { +> print "working"; +> } +> +> Or: +> +> sub status { +> return "working"; +> } diff --git a/_site/app/bower_components/marked/test/original/code_blocks.html b/_site/app/bower_components/marked/test/original/code_blocks.html new file mode 100644 index 0000000..32703f5 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/code_blocks.html @@ -0,0 +1,18 @@ +
    code block on the first line
    +
    + +

    Regular text.

    + +
    code block indented by spaces
    +
    + +

    Regular text.

    + +
    the lines in this block  
    +all contain trailing spaces  
    +
    + +

    Regular Text.

    + +
    code block on the last line
    +
    diff --git a/_site/app/bower_components/marked/test/original/code_blocks.text b/_site/app/bower_components/marked/test/original/code_blocks.text new file mode 100644 index 0000000..01f9a73 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/code_blocks.text @@ -0,0 +1,14 @@ + code block on the first line + +Regular text. + + code block indented by spaces + +Regular text. + + the lines in this block + all contain trailing spaces + +Regular Text. + + code block on the last line diff --git a/_site/app/bower_components/marked/test/original/code_spans.html b/_site/app/bower_components/marked/test/original/code_spans.html new file mode 100644 index 0000000..4b8afbb --- /dev/null +++ b/_site/app/bower_components/marked/test/original/code_spans.html @@ -0,0 +1,6 @@ +

    <test a=" content of attribute ">

    + +

    Fix for backticks within HTML tag: like this

    + +

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

    + diff --git a/_site/app/bower_components/marked/test/original/code_spans.text b/_site/app/bower_components/marked/test/original/code_spans.text new file mode 100644 index 0000000..750a197 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/code_spans.text @@ -0,0 +1,6 @@ +`` + +Fix for backticks within HTML tag: like this + +Here's how you put `` `backticks` `` in a code span. + diff --git a/_site/app/bower_components/marked/test/original/hard_wrapped_paragraphs_with_list_like_lines.html b/_site/app/bower_components/marked/test/original/hard_wrapped_paragraphs_with_list_like_lines.html new file mode 100644 index 0000000..e21ac79 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/hard_wrapped_paragraphs_with_list_like_lines.html @@ -0,0 +1,8 @@ +

    In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item.

    + +

    Here's one with a bullet. +* criminey.

    diff --git a/_site/app/bower_components/marked/test/original/hard_wrapped_paragraphs_with_list_like_lines.text b/_site/app/bower_components/marked/test/original/hard_wrapped_paragraphs_with_list_like_lines.text new file mode 100644 index 0000000..f8a5b27 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/hard_wrapped_paragraphs_with_list_like_lines.text @@ -0,0 +1,8 @@ +In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item. + +Here's one with a bullet. +* criminey. diff --git a/_site/app/bower_components/marked/test/original/horizontal_rules.html b/_site/app/bower_components/marked/test/original/horizontal_rules.html new file mode 100644 index 0000000..2dc2ab6 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/horizontal_rules.html @@ -0,0 +1,71 @@ +

    Dashes:

    + +
    + +
    + +
    + +
    + +
    ---
    +
    + +
    + +
    + +
    + +
    + +
    - - -
    +
    + +

    Asterisks:

    + +
    + +
    + +
    + +
    + +
    ***
    +
    + +
    + +
    + +
    + +
    + +
    * * *
    +
    + +

    Underscores:

    + +
    + +
    + +
    + +
    + +
    ___
    +
    + +
    + +
    + +
    + +
    + +
    _ _ _
    +
    diff --git a/_site/app/bower_components/marked/test/original/horizontal_rules.text b/_site/app/bower_components/marked/test/original/horizontal_rules.text new file mode 100644 index 0000000..1594bda --- /dev/null +++ b/_site/app/bower_components/marked/test/original/horizontal_rules.text @@ -0,0 +1,67 @@ +Dashes: + +--- + + --- + + --- + + --- + + --- + +- - - + + - - - + + - - - + + - - - + + - - - + + +Asterisks: + +*** + + *** + + *** + + *** + + *** + +* * * + + * * * + + * * * + + * * * + + * * * + + +Underscores: + +___ + + ___ + + ___ + + ___ + + ___ + +_ _ _ + + _ _ _ + + _ _ _ + + _ _ _ + + _ _ _ diff --git a/_site/app/bower_components/marked/test/original/inline_html_advanced.html b/_site/app/bower_components/marked/test/original/inline_html_advanced.html new file mode 100644 index 0000000..3af9caf --- /dev/null +++ b/_site/app/bower_components/marked/test/original/inline_html_advanced.html @@ -0,0 +1,15 @@ +

    Simple block on one line:

    + +
    foo
    + +

    And nested without indentation:

    + +
    +
    +
    +foo +
    +
    +
    +
    bar
    +
    diff --git a/_site/app/bower_components/marked/test/original/inline_html_advanced.text b/_site/app/bower_components/marked/test/original/inline_html_advanced.text new file mode 100644 index 0000000..86b7206 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/inline_html_advanced.text @@ -0,0 +1,15 @@ +Simple block on one line: + +
    foo
    + +And nested without indentation: + +
    +
    +
    +foo +
    +
    +
    +
    bar
    +
    diff --git a/_site/app/bower_components/marked/test/original/inline_html_comments.html b/_site/app/bower_components/marked/test/original/inline_html_comments.html new file mode 100644 index 0000000..3f167a1 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/inline_html_comments.html @@ -0,0 +1,13 @@ +

    Paragraph one.

    + + + + + +

    Paragraph two.

    + + + +

    The end.

    diff --git a/_site/app/bower_components/marked/test/original/inline_html_comments.text b/_site/app/bower_components/marked/test/original/inline_html_comments.text new file mode 100644 index 0000000..41d830d --- /dev/null +++ b/_site/app/bower_components/marked/test/original/inline_html_comments.text @@ -0,0 +1,13 @@ +Paragraph one. + + + + + +Paragraph two. + + + +The end. diff --git a/_site/app/bower_components/marked/test/original/inline_html_simple.html b/_site/app/bower_components/marked/test/original/inline_html_simple.html new file mode 100644 index 0000000..6bf78f8 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/inline_html_simple.html @@ -0,0 +1,72 @@ +

    Here's a simple block:

    + +
    + foo +
    + +

    This should be a code block, though:

    + +
    <div>
    +    foo
    +</div>
    +
    + +

    As should this:

    + +
    <div>foo</div>
    +
    + +

    Now, nested:

    + +
    +
    +
    + foo +
    +
    +
    + +

    This should just be an HTML comment:

    + + + +

    Multiline:

    + + + +

    Code block:

    + +
    <!-- Comment -->
    +
    + +

    Just plain comment, with trailing spaces on the line:

    + + + +

    Code:

    + +
    <hr />
    +
    + +

    Hr's:

    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    diff --git a/_site/app/bower_components/marked/test/original/inline_html_simple.text b/_site/app/bower_components/marked/test/original/inline_html_simple.text new file mode 100644 index 0000000..14aa2dc --- /dev/null +++ b/_site/app/bower_components/marked/test/original/inline_html_simple.text @@ -0,0 +1,69 @@ +Here's a simple block: + +
    + foo +
    + +This should be a code block, though: + +
    + foo +
    + +As should this: + +
    foo
    + +Now, nested: + +
    +
    +
    + foo +
    +
    +
    + +This should just be an HTML comment: + + + +Multiline: + + + +Code block: + + + +Just plain comment, with trailing spaces on the line: + + + +Code: + +
    + +Hr's: + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + diff --git a/_site/app/bower_components/marked/test/original/links_inline_style.html b/_site/app/bower_components/marked/test/original/links_inline_style.html new file mode 100644 index 0000000..09df236 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/links_inline_style.html @@ -0,0 +1,15 @@ +

    Just a URL.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    Empty.

    diff --git a/_site/app/bower_components/marked/test/original/links_inline_style.text b/_site/app/bower_components/marked/test/original/links_inline_style.text new file mode 100644 index 0000000..8c8eb49 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/links_inline_style.text @@ -0,0 +1,15 @@ +Just a [URL](/url/). + +[URL and title](/url/ "title"). + +[URL and title](/url/ "title preceded by two spaces"). + +[URL and title](/url/ "title preceded by a tab"). + +[URL and title](/url/ "title has spaces afterward" ). + +[URL and title]( /url/has space ). + +[URL and title]( /url/has space/ "url has space and title"). + +[Empty](). diff --git a/_site/app/bower_components/marked/test/original/links_reference_style.html b/_site/app/bower_components/marked/test/original/links_reference_style.html new file mode 100644 index 0000000..8e70c32 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/links_reference_style.html @@ -0,0 +1,52 @@ +

    Foo bar.

    + +

    Foo bar.

    + +

    Foo bar.

    + +

    With embedded [brackets].

    + +

    Indented once.

    + +

    Indented twice.

    + +

    Indented thrice.

    + +

    Indented [four][] times.

    + +
    [four]: /url
    +
    + +
    + +

    this should work

    + +

    So should this.

    + +

    And this.

    + +

    And this.

    + +

    And this.

    + +

    But not [that] [].

    + +

    Nor [that][].

    + +

    Nor [that].

    + +

    [Something in brackets like this should work]

    + +

    [Same with this.]

    + +

    In this case, this points to something else.

    + +

    Backslashing should suppress [this] and [this].

    + +
    + +

    Here's one where the link +breaks across lines.

    + +

    Here's another where the link +breaks across lines, but with a line-ending space.

    diff --git a/_site/app/bower_components/marked/test/original/links_reference_style.text b/_site/app/bower_components/marked/test/original/links_reference_style.text new file mode 100644 index 0000000..341ec88 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/links_reference_style.text @@ -0,0 +1,71 @@ +Foo [bar] [1]. + +Foo [bar][1]. + +Foo [bar] +[1]. + +[1]: /url/ "Title" + + +With [embedded [brackets]] [b]. + + +Indented [once][]. + +Indented [twice][]. + +Indented [thrice][]. + +Indented [four][] times. + + [once]: /url + + [twice]: /url + + [thrice]: /url + + [four]: /url + + +[b]: /url/ + +* * * + +[this] [this] should work + +So should [this][this]. + +And [this] []. + +And [this][]. + +And [this]. + +But not [that] []. + +Nor [that][]. + +Nor [that]. + +[Something in brackets like [this][] should work] + +[Same with [this].] + +In this case, [this](/somethingelse/) points to something else. + +Backslashing should suppress \[this] and [this\]. + +[this]: foo + + +* * * + +Here's one where the [link +breaks] across lines. + +Here's another where the [link +breaks] across lines, but with a line-ending space. + + +[link breaks]: /url/ diff --git a/_site/app/bower_components/marked/test/original/links_shortcut_references.html b/_site/app/bower_components/marked/test/original/links_shortcut_references.html new file mode 100644 index 0000000..bf81e93 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/links_shortcut_references.html @@ -0,0 +1,9 @@ +

    This is the simple case.

    + +

    This one has a line +break.

    + +

    This one has a line +break with a line-ending space.

    + +

    this and the other

    diff --git a/_site/app/bower_components/marked/test/original/links_shortcut_references.text b/_site/app/bower_components/marked/test/original/links_shortcut_references.text new file mode 100644 index 0000000..8c44c98 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/links_shortcut_references.text @@ -0,0 +1,20 @@ +This is the [simple case]. + +[simple case]: /simple + + + +This one has a [line +break]. + +This one has a [line +break] with a line-ending space. + +[line break]: /foo + + +[this] [that] and the [other] + +[this]: /this +[that]: /that +[other]: /other diff --git a/_site/app/bower_components/marked/test/original/literal_quotes_in_titles.html b/_site/app/bower_components/marked/test/original/literal_quotes_in_titles.html new file mode 100644 index 0000000..611c1ac --- /dev/null +++ b/_site/app/bower_components/marked/test/original/literal_quotes_in_titles.html @@ -0,0 +1,3 @@ +

    Foo bar.

    + +

    Foo bar.

    diff --git a/_site/app/bower_components/marked/test/original/literal_quotes_in_titles.text b/_site/app/bower_components/marked/test/original/literal_quotes_in_titles.text new file mode 100644 index 0000000..29d0e42 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/literal_quotes_in_titles.text @@ -0,0 +1,7 @@ +Foo [bar][]. + +Foo [bar](/url/ "Title with "quotes" inside"). + + + [bar]: /url/ "Title with "quotes" inside" + diff --git a/_site/app/bower_components/marked/test/original/markdown_documentation_basics.html b/_site/app/bower_components/marked/test/original/markdown_documentation_basics.html new file mode 100644 index 0000000..d5bdbb2 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/markdown_documentation_basics.html @@ -0,0 +1,314 @@ +

    Markdown: Basics

    + + + +

    Getting the Gist of Markdown's Formatting Syntax

    + +

    This page offers a brief overview of what it's like to use Markdown. +The syntax page provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown.

    + +

    It's also helpful to simply try Markdown out; the Dingus is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML.

    + +

    Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

    + +

    Paragraphs, Headers, Blockquotes

    + +

    A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs.

    + +

    Markdown offers two styles of headers: Setext and atx. +Setext-style headers for <h1> and <h2> are created by +"underlining" with equal signs (=) and hyphens (-), respectively. +To create an atx-style header, you put 1-6 hash marks (#) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level.

    + +

    Blockquotes are indicated using email-style '>' angle brackets.

    + +

    Markdown:

    + +
    A First Level Header
    +====================
    +
    +A Second Level Header
    +---------------------
    +
    +Now is the time for all good men to come to
    +the aid of their country. This is just a
    +regular paragraph.
    +
    +The quick brown fox jumped over the lazy
    +dog's back.
    +
    +### Header 3
    +
    +> This is a blockquote.
    +> 
    +> This is the second paragraph in the blockquote.
    +>
    +> ## This is an H2 in a blockquote
    +
    + +

    Output:

    + +
    <h1>A First Level Header</h1>
    +
    +<h2>A Second Level Header</h2>
    +
    +<p>Now is the time for all good men to come to
    +the aid of their country. This is just a
    +regular paragraph.</p>
    +
    +<p>The quick brown fox jumped over the lazy
    +dog's back.</p>
    +
    +<h3>Header 3</h3>
    +
    +<blockquote>
    +    <p>This is a blockquote.</p>
    +
    +    <p>This is the second paragraph in the blockquote.</p>
    +
    +    <h2>This is an H2 in a blockquote</h2>
    +</blockquote>
    +
    + +

    Phrase Emphasis

    + +

    Markdown uses asterisks and underscores to indicate spans of emphasis.

    + +

    Markdown:

    + +
    Some of these words *are emphasized*.
    +Some of these words _are emphasized also_.
    +
    +Use two asterisks for **strong emphasis**.
    +Or, if you prefer, __use two underscores instead__.
    +
    + +

    Output:

    + +
    <p>Some of these words <em>are emphasized</em>.
    +Some of these words <em>are emphasized also</em>.</p>
    +
    +<p>Use two asterisks for <strong>strong emphasis</strong>.
    +Or, if you prefer, <strong>use two underscores instead</strong>.</p>
    +
    + +

    Lists

    + +

    Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, ++, and -) as list markers. These three markers are +interchangable; this:

    + +
    *   Candy.
    +*   Gum.
    +*   Booze.
    +
    + +

    this:

    + +
    +   Candy.
    ++   Gum.
    ++   Booze.
    +
    + +

    and this:

    + +
    -   Candy.
    +-   Gum.
    +-   Booze.
    +
    + +

    all produce the same output:

    + +
    <ul>
    +<li>Candy.</li>
    +<li>Gum.</li>
    +<li>Booze.</li>
    +</ul>
    +
    + +

    Ordered (numbered) lists use regular numbers, followed by periods, as +list markers:

    + +
    1.  Red
    +2.  Green
    +3.  Blue
    +
    + +

    Output:

    + +
    <ol>
    +<li>Red</li>
    +<li>Green</li>
    +<li>Blue</li>
    +</ol>
    +
    + +

    If you put blank lines between items, you'll get <p> tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab:

    + +
    *   A list item.
    +
    +    With multiple paragraphs.
    +
    +*   Another item in the list.
    +
    + +

    Output:

    + +
    <ul>
    +<li><p>A list item.</p>
    +<p>With multiple paragraphs.</p></li>
    +<li><p>Another item in the list.</p></li>
    +</ul>
    +
    + +

    Links

    + +

    Markdown supports two styles for creating links: inline and +reference. With both styles, you use square brackets to delimit the +text you want to turn into a link.

    + +

    Inline-style links use parentheses immediately after the link text. +For example:

    + +
    This is an [example link](http://example.com/).
    +
    + +

    Output:

    + +
    <p>This is an <a href="http://example.com/">
    +example link</a>.</p>
    +
    + +

    Optionally, you may include a title attribute in the parentheses:

    + +
    This is an [example link](http://example.com/ "With a Title").
    +
    + +

    Output:

    + +
    <p>This is an <a href="http://example.com/" title="With a Title">
    +example link</a>.</p>
    +
    + +

    Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document:

    + +
    I get 10 times more traffic from [Google][1] than from
    +[Yahoo][2] or [MSN][3].
    +
    +[1]: http://google.com/        "Google"
    +[2]: http://search.yahoo.com/  "Yahoo Search"
    +[3]: http://search.msn.com/    "MSN Search"
    +
    + +

    Output:

    + +
    <p>I get 10 times more traffic from <a href="http://google.com/"
    +title="Google">Google</a> than from <a href="http://search.yahoo.com/"
    +title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
    +title="MSN Search">MSN</a>.</p>
    +
    + +

    The title attribute is optional. Link names may contain letters, +numbers and spaces, but are not case sensitive:

    + +
    I start my morning with a cup of coffee and
    +[The New York Times][NY Times].
    +
    +[ny times]: http://www.nytimes.com/
    +
    + +

    Output:

    + +
    <p>I start my morning with a cup of coffee and
    +<a href="http://www.nytimes.com/">The New York Times</a>.</p>
    +
    + +

    Images

    + +

    Image syntax is very much like link syntax.

    + +

    Inline (titles are optional):

    + +
    ![alt text](/path/to/img.jpg "Title")
    +
    + +

    Reference-style:

    + +
    ![alt text][id]
    +
    +[id]: /path/to/img.jpg "Title"
    +
    + +

    Both of the above examples produce the same output:

    + +
    <img src="/path/to/img.jpg" alt="alt text" title="Title" />
    +
    + +

    Code

    + +

    In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (&) and angle brackets (< or +>) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code:

    + +
    I strongly recommend against using any `<blink>` tags.
    +
    +I wish SmartyPants used named entities like `&mdash;`
    +instead of decimal-encoded entites like `&#8212;`.
    +
    + +

    Output:

    + +
    <p>I strongly recommend against using any
    +<code>&lt;blink&gt;</code> tags.</p>
    +
    +<p>I wish SmartyPants used named entities like
    +<code>&amp;mdash;</code> instead of decimal-encoded
    +entites like <code>&amp;#8212;</code>.</p>
    +
    + +

    To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, &, <, +and > characters will be escaped automatically.

    + +

    Markdown:

    + +
    If you want your page to validate under XHTML 1.0 Strict,
    +you've got to put paragraph tags in your blockquotes:
    +
    +    <blockquote>
    +        <p>For example.</p>
    +    </blockquote>
    +
    + +

    Output:

    + +
    <p>If you want your page to validate under XHTML 1.0 Strict,
    +you've got to put paragraph tags in your blockquotes:</p>
    +
    +<pre><code>&lt;blockquote&gt;
    +    &lt;p&gt;For example.&lt;/p&gt;
    +&lt;/blockquote&gt;
    +</code></pre>
    +
    diff --git a/_site/app/bower_components/marked/test/original/markdown_documentation_basics.text b/_site/app/bower_components/marked/test/original/markdown_documentation_basics.text new file mode 100644 index 0000000..486055c --- /dev/null +++ b/_site/app/bower_components/marked/test/original/markdown_documentation_basics.text @@ -0,0 +1,306 @@ +Markdown: Basics +================ + + + + +Getting the Gist of Markdown's Formatting Syntax +------------------------------------------------ + +This page offers a brief overview of what it's like to use Markdown. +The [syntax page] [s] provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown. + +It's also helpful to simply try Markdown out; the [Dingus] [d] is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML. + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL] [src]. + + [s]: /projects/markdown/syntax "Markdown Syntax" + [d]: /projects/markdown/dingus "Markdown Dingus" + [src]: /projects/markdown/basics.text + + +## Paragraphs, Headers, Blockquotes ## + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs. + +Markdown offers two styles of headers: *Setext* and *atx*. +Setext-style headers for `

    ` and `

    ` are created by +"underlining" with equal signs (`=`) and hyphens (`-`), respectively. +To create an atx-style header, you put 1-6 hash marks (`#`) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level. + +Blockquotes are indicated using email-style '`>`' angle brackets. + +Markdown: + + A First Level Header + ==================== + + A Second Level Header + --------------------- + + Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph. + + The quick brown fox jumped over the lazy + dog's back. + + ### Header 3 + + > This is a blockquote. + > + > This is the second paragraph in the blockquote. + > + > ## This is an H2 in a blockquote + + +Output: + +

    A First Level Header

    + +

    A Second Level Header

    + +

    Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph.

    + +

    The quick brown fox jumped over the lazy + dog's back.

    + +

    Header 3

    + +
    +

    This is a blockquote.

    + +

    This is the second paragraph in the blockquote.

    + +

    This is an H2 in a blockquote

    +
    + + + +### Phrase Emphasis ### + +Markdown uses asterisks and underscores to indicate spans of emphasis. + +Markdown: + + Some of these words *are emphasized*. + Some of these words _are emphasized also_. + + Use two asterisks for **strong emphasis**. + Or, if you prefer, __use two underscores instead__. + +Output: + +

    Some of these words are emphasized. + Some of these words are emphasized also.

    + +

    Use two asterisks for strong emphasis. + Or, if you prefer, use two underscores instead.

    + + + +## Lists ## + +Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, +`+`, and `-`) as list markers. These three markers are +interchangable; this: + + * Candy. + * Gum. + * Booze. + +this: + + + Candy. + + Gum. + + Booze. + +and this: + + - Candy. + - Gum. + - Booze. + +all produce the same output: + +
      +
    • Candy.
    • +
    • Gum.
    • +
    • Booze.
    • +
    + +Ordered (numbered) lists use regular numbers, followed by periods, as +list markers: + + 1. Red + 2. Green + 3. Blue + +Output: + +
      +
    1. Red
    2. +
    3. Green
    4. +
    5. Blue
    6. +
    + +If you put blank lines between items, you'll get `

    ` tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab: + + * A list item. + + With multiple paragraphs. + + * Another item in the list. + +Output: + +

      +
    • A list item.

      +

      With multiple paragraphs.

    • +
    • Another item in the list.

    • +
    + + + +### Links ### + +Markdown supports two styles for creating links: *inline* and +*reference*. With both styles, you use square brackets to delimit the +text you want to turn into a link. + +Inline-style links use parentheses immediately after the link text. +For example: + + This is an [example link](http://example.com/). + +Output: + +

    This is an + example link.

    + +Optionally, you may include a title attribute in the parentheses: + + This is an [example link](http://example.com/ "With a Title"). + +Output: + +

    This is an + example link.

    + +Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document: + + I get 10 times more traffic from [Google][1] than from + [Yahoo][2] or [MSN][3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Output: + +

    I get 10 times more traffic from Google than from Yahoo or MSN.

    + +The title attribute is optional. Link names may contain letters, +numbers and spaces, but are *not* case sensitive: + + I start my morning with a cup of coffee and + [The New York Times][NY Times]. + + [ny times]: http://www.nytimes.com/ + +Output: + +

    I start my morning with a cup of coffee and + The New York Times.

    + + +### Images ### + +Image syntax is very much like link syntax. + +Inline (titles are optional): + + ![alt text](/path/to/img.jpg "Title") + +Reference-style: + + ![alt text][id] + + [id]: /path/to/img.jpg "Title" + +Both of the above examples produce the same output: + + alt text + + + +### Code ### + +In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (`&`) and angle brackets (`<` or +`>`) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code: + + I strongly recommend against using any `` tags. + + I wish SmartyPants used named entities like `—` + instead of decimal-encoded entites like `—`. + +Output: + +

    I strongly recommend against using any + <blink> tags.

    + +

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

    + + +To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, +and `>` characters will be escaped automatically. + +Markdown: + + If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes: + +
    +

    For example.

    +
    + +Output: + +

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

    + +
    <blockquote>
    +        <p>For example.</p>
    +    </blockquote>
    +    
    diff --git a/_site/app/bower_components/marked/test/original/markdown_documentation_syntax.html b/_site/app/bower_components/marked/test/original/markdown_documentation_syntax.html new file mode 100644 index 0000000..5c01306 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/markdown_documentation_syntax.html @@ -0,0 +1,942 @@ +

    Markdown: Syntax

    + + + + + +

    Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

    + +
    + +

    Overview

    + +

    Philosophy

    + +

    Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

    + +

    Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including Setext, atx, Textile, reStructuredText, +Grutatext, and EtText -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email.

    + +

    To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like *emphasis*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email.

    + +

    Inline HTML

    + +

    Markdown's syntax is intended for one purpose: to be used as a +format for writing for the web.

    + +

    Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is not to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a publishing format; Markdown is a writing +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text.

    + +

    For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags.

    + +

    The only restrictions are that block-level HTML elements -- e.g. <div>, +<table>, <pre>, <p>, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) <p> tags around HTML block-level tags.

    + +

    For example, to add an HTML table to a Markdown article:

    + +
    This is a regular paragraph.
    +
    +<table>
    +    <tr>
    +        <td>Foo</td>
    +    </tr>
    +</table>
    +
    +This is another regular paragraph.
    +
    + +

    Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style *emphasis* inside an +HTML block.

    + +

    Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML <a> or <img> tags instead of Markdown's +link or image syntax, go right ahead.

    + +

    Unlike block-level HTML tags, Markdown syntax is processed within +span-level tags.

    + +

    Automatic Escaping for Special Characters

    + +

    In HTML, there are two characters that demand special treatment: < +and &. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. &lt;, and +&amp;.

    + +

    Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write 'AT&amp;T'. You even need to +escape ampersands within URLs. Thus, if you want to link to:

    + +
    http://images.google.com/images?num=30&q=larry+bird
    +
    + +

    you need to encode the URL as:

    + +
    http://images.google.com/images?num=30&amp;q=larry+bird
    +
    + +

    in your anchor tag href attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites.

    + +

    Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into &amp;.

    + +

    So, if you want to include a copyright symbol in your article, you can write:

    + +
    &copy;
    +
    + +

    and Markdown will leave it alone. But if you write:

    + +
    AT&T
    +
    + +

    Markdown will translate it to:

    + +
    AT&amp;T
    +
    + +

    Similarly, because Markdown supports inline HTML, if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write:

    + +
    4 < 5
    +
    + +

    Markdown will translate it to:

    + +
    4 &lt; 5
    +
    + +

    However, inside Markdown code spans and blocks, angle brackets and +ampersands are always encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single < +and & in your example code needs to be escaped.)

    + +
    + +

    Block Elements

    + +

    Paragraphs and Line Breaks

    + +

    A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs.

    + +

    The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a <br /> tag.

    + +

    When you do want to insert a <br /> break tag using Markdown, you +end a line with two or more spaces, then type return.

    + +

    Yes, this takes a tad more effort to create a <br />, but a simplistic +"every line break is a <br />" rule wouldn't work for Markdown. +Markdown's email-style blockquoting and multi-paragraph list items +work best -- and look better -- when you format them with hard breaks.

    + + + +

    Markdown supports two styles of headers, Setext and atx.

    + +

    Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example:

    + +
    This is an H1
    +=============
    +
    +This is an H2
    +-------------
    +
    + +

    Any number of underlining ='s or -'s will work.

    + +

    Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example:

    + +
    # This is an H1
    +
    +## This is an H2
    +
    +###### This is an H6
    +
    + +

    Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) :

    + +
    # This is an H1 #
    +
    +## This is an H2 ##
    +
    +### This is an H3 ######
    +
    + +

    Blockquotes

    + +

    Markdown uses email-style > characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a > before every line:

    + +
    > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
    +> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
    +> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    +> 
    +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
    +> id sem consectetuer libero luctus adipiscing.
    +
    + +

    Markdown allows you to be lazy and only put the > before the first +line of a hard-wrapped paragraph:

    + +
    > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
    +consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
    +Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    +
    +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
    +id sem consectetuer libero luctus adipiscing.
    +
    + +

    Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of >:

    + +
    > This is the first level of quoting.
    +>
    +> > This is nested blockquote.
    +>
    +> Back to the first level.
    +
    + +

    Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks:

    + +
    > ## This is a header.
    +> 
    +> 1.   This is the first list item.
    +> 2.   This is the second list item.
    +> 
    +> Here's some example code:
    +> 
    +>     return shell_exec("echo $input | $markdown_script");
    +
    + +

    Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu.

    + +

    Lists

    + +

    Markdown supports ordered (numbered) and unordered (bulleted) lists.

    + +

    Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers:

    + +
    *   Red
    +*   Green
    +*   Blue
    +
    + +

    is equivalent to:

    + +
    +   Red
    ++   Green
    ++   Blue
    +
    + +

    and:

    + +
    -   Red
    +-   Green
    +-   Blue
    +
    + +

    Ordered lists use numbers followed by periods:

    + +
    1.  Bird
    +2.  McHale
    +3.  Parish
    +
    + +

    It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is:

    + +
    <ol>
    +<li>Bird</li>
    +<li>McHale</li>
    +<li>Parish</li>
    +</ol>
    +
    + +

    If you instead wrote the list in Markdown like this:

    + +
    1.  Bird
    +1.  McHale
    +1.  Parish
    +
    + +

    or even:

    + +
    3. Bird
    +1. McHale
    +8. Parish
    +
    + +

    you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to.

    + +

    If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number.

    + +

    List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab.

    + +

    To make lists look nice, you can wrap items with hanging indents:

    + +
    *   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    +    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    +    viverra nec, fringilla in, laoreet vitae, risus.
    +*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    +    Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    But if you want to be lazy, you don't have to:

    + +
    *   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    +Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    +viverra nec, fringilla in, laoreet vitae, risus.
    +*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    +Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    If list items are separated by blank lines, Markdown will wrap the +items in <p> tags in the HTML output. For example, this input:

    + +
    *   Bird
    +*   Magic
    +
    + +

    will turn into:

    + +
    <ul>
    +<li>Bird</li>
    +<li>Magic</li>
    +</ul>
    +
    + +

    But this:

    + +
    *   Bird
    +
    +*   Magic
    +
    + +

    will turn into:

    + +
    <ul>
    +<li><p>Bird</p></li>
    +<li><p>Magic</p></li>
    +</ul>
    +
    + +

    List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be intended by either 4 spaces +or one tab:

    + +
    1.  This is a list item with two paragraphs. Lorem ipsum dolor
    +    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    +    mi posuere lectus.
    +
    +    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    +    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    +    sit amet velit.
    +
    +2.  Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy:

    + +
    *   This is a list item with two paragraphs.
    +
    +    This is the second paragraph in the list item. You're
    +only required to indent the first line. Lorem ipsum dolor
    +sit amet, consectetuer adipiscing elit.
    +
    +*   Another item in the same list.
    +
    + +

    To put a blockquote within a list item, the blockquote's > +delimiters need to be indented:

    + +
    *   A list item with a blockquote:
    +
    +    > This is a blockquote
    +    > inside a list item.
    +
    + +

    To put a code block within a list item, the code block needs +to be indented twice -- 8 spaces or two tabs:

    + +
    *   A list item with a code block:
    +
    +        <code goes here>
    +
    + +

    It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this:

    + +
    1986. What a great season.
    +
    + +

    In other words, a number-period-space sequence at the beginning of a +line. To avoid this, you can backslash-escape the period:

    + +
    1986\. What a great season.
    +
    + +

    Code Blocks

    + +

    Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both <pre> and <code> tags.

    + +

    To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input:

    + +
    This is a normal paragraph:
    +
    +    This is a code block.
    +
    + +

    Markdown will generate:

    + +
    <p>This is a normal paragraph:</p>
    +
    +<pre><code>This is a code block.
    +</code></pre>
    +
    + +

    One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this:

    + +
    Here is an example of AppleScript:
    +
    +    tell application "Foo"
    +        beep
    +    end tell
    +
    + +

    will turn into:

    + +
    <p>Here is an example of AppleScript:</p>
    +
    +<pre><code>tell application "Foo"
    +    beep
    +end tell
    +</code></pre>
    +
    + +

    A code block continues until it reaches a line that is not indented +(or the end of the article).

    + +

    Within a code block, ampersands (&) and angle brackets (< and >) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this:

    + +
        <div class="footer">
    +        &copy; 2004 Foo Corporation
    +    </div>
    +
    + +

    will turn into:

    + +
    <pre><code>&lt;div class="footer"&gt;
    +    &amp;copy; 2004 Foo Corporation
    +&lt;/div&gt;
    +</code></pre>
    +
    + +

    Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax.

    + +

    Horizontal Rules

    + +

    You can produce a horizontal rule tag (<hr />) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule:

    + +
    * * *
    +
    +***
    +
    +*****
    +
    +- - -
    +
    +---------------------------------------
    +
    +_ _ _
    +
    + +
    + +

    Span Elements

    + + + +

    Markdown supports two style of links: inline and reference.

    + +

    In both styles, the link text is delimited by [square brackets].

    + +

    To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an optional +title for the link, surrounded in quotes. For example:

    + +
    This is [an example](http://example.com/ "Title") inline link.
    +
    +[This link](http://example.net/) has no title attribute.
    +
    + +

    Will produce:

    + +
    <p>This is <a href="http://example.com/" title="Title">
    +an example</a> inline link.</p>
    +
    +<p><a href="http://example.net/">This link</a> has no
    +title attribute.</p>
    +
    + +

    If you're referring to a local resource on the same server, you can +use relative paths:

    + +
    See my [About](/about/) page for details.
    +
    + +

    Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link:

    + +
    This is [an example][id] reference-style link.
    +
    + +

    You can optionally use a space to separate the sets of brackets:

    + +
    This is [an example] [id] reference-style link.
    +
    + +

    Then, anywhere in the document, you define your link label like this, +on a line by itself:

    + +
    [id]: http://example.com/  "Optional Title Here"
    +
    + +

    That is:

    + +
      +
    • Square brackets containing the link identifier (optionally +indented from the left margin using up to three spaces);
    • +
    • followed by a colon;
    • +
    • followed by one or more spaces (or tabs);
    • +
    • followed by the URL for the link;
    • +
    • optionally followed by a title attribute for the link, enclosed +in double or single quotes.
    • +
    + +

    The link URL may, optionally, be surrounded by angle brackets:

    + +
    [id]: <http://example.com/>  "Optional Title Here"
    +
    + +

    You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs:

    + +
    [id]: http://example.com/longish/path/to/resource/here
    +    "Optional Title Here"
    +
    + +

    Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output.

    + +

    Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

    + +
    [link text][a]
    +[link text][A]
    +
    + +

    are equivalent.

    + +

    The implicit link name shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write:

    + +
    [Google][]
    +
    + +

    And then define the link:

    + +
    [Google]: http://google.com/
    +
    + +

    Because link names may contain spaces, this shortcut even works for +multiple words in the link text:

    + +
    Visit [Daring Fireball][] for more information.
    +
    + +

    And then define the link:

    + +
    [Daring Fireball]: http://daringfireball.net/
    +
    + +

    Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes.

    + +

    Here's an example of reference links in action:

    + +
    I get 10 times more traffic from [Google] [1] than from
    +[Yahoo] [2] or [MSN] [3].
    +
    +  [1]: http://google.com/        "Google"
    +  [2]: http://search.yahoo.com/  "Yahoo Search"
    +  [3]: http://search.msn.com/    "MSN Search"
    +
    + +

    Using the implicit link name shortcut, you could instead write:

    + +
    I get 10 times more traffic from [Google][] than from
    +[Yahoo][] or [MSN][].
    +
    +  [google]: http://google.com/        "Google"
    +  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
    +  [msn]:    http://search.msn.com/    "MSN Search"
    +
    + +

    Both of the above examples will produce the following HTML output:

    + +
    <p>I get 10 times more traffic from <a href="http://google.com/"
    +title="Google">Google</a> than from
    +<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
    +or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
    +
    + +

    For comparison, here is the same paragraph written using +Markdown's inline link style:

    + +
    I get 10 times more traffic from [Google](http://google.com/ "Google")
    +than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
    +[MSN](http://search.msn.com/ "MSN Search").
    +
    + +

    The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text.

    + +

    With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose.

    + +

    Emphasis

    + +

    Markdown treats asterisks (*) and underscores (_) as indicators of +emphasis. Text wrapped with one * or _ will be wrapped with an +HTML <em> tag; double *'s or _'s will be wrapped with an HTML +<strong> tag. E.g., this input:

    + +
    *single asterisks*
    +
    +_single underscores_
    +
    +**double asterisks**
    +
    +__double underscores__
    +
    + +

    will produce:

    + +
    <em>single asterisks</em>
    +
    +<em>single underscores</em>
    +
    +<strong>double asterisks</strong>
    +
    +<strong>double underscores</strong>
    +
    + +

    You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span.

    + +

    Emphasis can be used in the middle of a word:

    + +
    un*fucking*believable
    +
    + +

    But if you surround an * or _ with spaces, it'll be treated as a +literal asterisk or underscore.

    + +

    To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it:

    + +
    \*this text is surrounded by literal asterisks\*
    +
    + +

    Code

    + +

    To indicate a span of code, wrap it with backtick quotes (`). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example:

    + +
    Use the `printf()` function.
    +
    + +

    will produce:

    + +
    <p>Use the <code>printf()</code> function.</p>
    +
    + +

    To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters:

    + +
    ``There is a literal backtick (`) here.``
    +
    + +

    which will produce this:

    + +
    <p><code>There is a literal backtick (`) here.</code></p>
    +
    + +

    The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span:

    + +
    A single backtick in a code span: `` ` ``
    +
    +A backtick-delimited string in a code span: `` `foo` ``
    +
    + +

    will produce:

    + +
    <p>A single backtick in a code span: <code>`</code></p>
    +
    +<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
    +
    + +

    With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this:

    + +
    Please don't use any `<blink>` tags.
    +
    + +

    into:

    + +
    <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
    +
    + +

    You can write this:

    + +
    `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
    +
    + +

    to produce:

    + +
    <p><code>&amp;#8212;</code> is the decimal-encoded
    +equivalent of <code>&amp;mdash;</code>.</p>
    +
    + +

    Images

    + +

    Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format.

    + +

    Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: inline and reference.

    + +

    Inline image syntax looks like this:

    + +
    ![Alt text](/path/to/img.jpg)
    +
    +![Alt text](/path/to/img.jpg "Optional title")
    +
    + +

    That is:

    + +
      +
    • An exclamation mark: !;
    • +
    • followed by a set of square brackets, containing the alt +attribute text for the image;
    • +
    • followed by a set of parentheses, containing the URL or path to +the image, and an optional title attribute enclosed in double +or single quotes.
    • +
    + +

    Reference-style image syntax looks like this:

    + +
    ![Alt text][id]
    +
    + +

    Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references:

    + +
    [id]: url/to/image  "Optional title attribute"
    +
    + +

    As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML <img> tags.

    + +
    + +

    Miscellaneous

    + + + +

    Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

    + +
    <http://example.com/>
    +
    + +

    Markdown will turn this into:

    + +
    <a href="http://example.com/">http://example.com/</a>
    +
    + +

    Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this:

    + +
    <address@example.com>
    +
    + +

    into something like this:

    + +
    <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
    +&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
    +&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
    +&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
    +
    + +

    which will render in a browser as a clickable link to "address@example.com".

    + +

    (This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.)

    + +

    Backslash Escapes

    + +

    Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML <em> tag), you can backslashes +before the asterisks, like this:

    + +
    \*literal asterisks\*
    +
    + +

    Markdown provides backslash escapes for the following characters:

    + +
    \   backslash
    +`   backtick
    +*   asterisk
    +_   underscore
    +{}  curly braces
    +[]  square brackets
    +()  parentheses
    +#   hash mark
    ++   plus sign
    +-   minus sign (hyphen)
    +.   dot
    +!   exclamation mark
    +
    diff --git a/_site/app/bower_components/marked/test/original/markdown_documentation_syntax.text b/_site/app/bower_components/marked/test/original/markdown_documentation_syntax.text new file mode 100644 index 0000000..57360a1 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/markdown_documentation_syntax.text @@ -0,0 +1,888 @@ +Markdown: Syntax +================ + + + + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) + + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL][src]. + + [src]: /projects/markdown/syntax.text + +* * * + +

    Overview

    + +

    Philosophy

    + +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], +[Grutatext] [5], and [EtText] [6] -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + + [1]: http://docutils.sourceforge.net/mirror/setext.html + [2]: http://www.aaronsw.com/2002/atx/ + [3]: http://textism.com/tools/textile/ + [4]: http://docutils.sourceforge.net/rst.html + [5]: http://www.triptico.com/software/grutatxt.html + [6]: http://ettext.taint.org/doc/ + +To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like \*emphasis\*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email. + + + +

    Inline HTML

    + +Markdown's syntax is intended for one purpose: to be used as a +format for *writing* for the web. + +Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is *not* to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a *publishing* format; Markdown is a *writing* +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text. + +For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags. + +The only restrictions are that block-level HTML elements -- e.g. `
    `, +``, `
    `, `

    `, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) `

    ` tags around HTML block-level tags. + +For example, to add an HTML table to a Markdown article: + + This is a regular paragraph. + +

    + + + +
    Foo
    + + This is another regular paragraph. + +Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an +HTML block. + +Span-level HTML tags -- e.g. ``, ``, or `` -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML `` or `` tags instead of Markdown's +link or image syntax, go right ahead. + +Unlike block-level HTML tags, Markdown syntax *is* processed within +span-level tags. + + +

    Automatic Escaping for Special Characters

    + +In HTML, there are two characters that demand special treatment: `<` +and `&`. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. `<`, and +`&`. + +Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '`AT&T`'. You even need to +escape ampersands within URLs. Thus, if you want to link to: + + http://images.google.com/images?num=30&q=larry+bird + +you need to encode the URL as: + + http://images.google.com/images?num=30&q=larry+bird + +in your anchor tag `href` attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites. + +Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into `&`. + +So, if you want to include a copyright symbol in your article, you can write: + + © + +and Markdown will leave it alone. But if you write: + + AT&T + +Markdown will translate it to: + + AT&T + +Similarly, because Markdown supports [inline HTML](#html), if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write: + + 4 < 5 + +Markdown will translate it to: + + 4 < 5 + +However, inside Markdown code spans and blocks, angle brackets and +ampersands are *always* encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single `<` +and `&` in your example code needs to be escaped.) + + +* * * + + +

    Block Elements

    + + +

    Paragraphs and Line Breaks

    + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `
    ` tag. + +When you *do* want to insert a `
    ` break tag using Markdown, you +end a line with two or more spaces, then type return. + +Yes, this takes a tad more effort to create a `
    `, but a simplistic +"every line break is a `
    `" rule wouldn't work for Markdown. +Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] +work best -- and look better -- when you format them with hard breaks. + + [bq]: #blockquote + [l]: #list + + + + + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example: + + This is an H1 + ============= + + This is an H2 + ------------- + +Any number of underlining `=`'s or `-`'s will work. + +Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example: + + # This is an H1 + + ## This is an H2 + + ###### This is an H6 + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) : + + # This is an H1 # + + ## This is an H2 ## + + ### This is an H3 ###### + + +

    Blockquotes

    + +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + > + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + > id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + + > This is the first level of quoting. + > + > > This is nested blockquote. + > + > Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + + > ## This is a header. + > + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +

    Lists

    + +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers: + + * Red + * Green + * Blue + +is equivalent to: + + + Red + + Green + + Blue + +and: + + - Red + - Green + - Blue + +Ordered lists use numbers followed by periods: + + 1. Bird + 2. McHale + 3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + +
      +
    1. Bird
    2. +
    3. McHale
    4. +
    5. Parish
    6. +
    + +If you instead wrote the list in Markdown like this: + + 1. Bird + 1. McHale + 1. Parish + +or even: + + 3. Bird + 1. McHale + 8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number. + +List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab. + +To make lists look nice, you can wrap items with hanging indents: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +If list items are separated by blank lines, Markdown will wrap the +items in `

    ` tags in the HTML output. For example, this input: + + * Bird + * Magic + +will turn into: + +

      +
    • Bird
    • +
    • Magic
    • +
    + +But this: + + * Bird + + * Magic + +will turn into: + +
      +
    • Bird

    • +
    • Magic

    • +
    + +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be intended by either 4 spaces +or one tab: + + 1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + + 2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + + * This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're + only required to indent the first line. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. + + * Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + + * A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + + * A list item with a code block: + + + + +It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this: + + 1986. What a great season. + +In other words, a *number-period-space* sequence at the beginning of a +line. To avoid this, you can backslash-escape the period: + + 1986\. What a great season. + + + +

    Code Blocks

    + +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `
    ` and `` tags.
    +
    +To produce a code block in Markdown, simply indent every line of the
    +block by at least 4 spaces or 1 tab. For example, given this input:
    +
    +    This is a normal paragraph:
    +
    +        This is a code block.
    +
    +Markdown will generate:
    +
    +    

    This is a normal paragraph:

    + +
    This is a code block.
    +    
    + +One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this: + + Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + +will turn into: + +

    Here is an example of AppleScript:

    + +
    tell application "Foo"
    +        beep
    +    end tell
    +    
    + +A code block continues until it reaches a line that is not indented +(or the end of the article). + +Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this: + + + +will turn into: + +
    <div class="footer">
    +        &copy; 2004 Foo Corporation
    +    </div>
    +    
    + +Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax. + + + +

    Horizontal Rules

    + +You can produce a horizontal rule tag (`
    `) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule: + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + _ _ _ + + +* * * + +

    Span Elements

    + + + +Markdown supports two style of links: *inline* and *reference*. + +In both styles, the link text is delimited by [square brackets]. + +To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an *optional* +title for the link, surrounded in quotes. For example: + + This is [an example](http://example.com/ "Title") inline link. + + [This link](http://example.net/) has no title attribute. + +Will produce: + +

    This is + an example inline link.

    + +

    This link has no + title attribute.

    + +If you're referring to a local resource on the same server, you can +use relative paths: + + See my [About](/about/) page for details. + +Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link: + + This is [an example][id] reference-style link. + +You can optionally use a space to separate the sets of brackets: + + This is [an example] [id] reference-style link. + +Then, anywhere in the document, you define your link label like this, +on a line by itself: + + [id]: http://example.com/ "Optional Title Here" + +That is: + +* Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces); +* followed by a colon; +* followed by one or more spaces (or tabs); +* followed by the URL for the link; +* optionally followed by a title attribute for the link, enclosed + in double or single quotes. + +The link URL may, optionally, be surrounded by angle brackets: + + [id]: "Optional Title Here" + +You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs: + + [id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" + +Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output. + +Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: + + [link text][a] + [link text][A] + +are equivalent. + +The *implicit link name* shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write: + + [Google][] + +And then define the link: + + [Google]: http://google.com/ + +Because link names may contain spaces, this shortcut even works for +multiple words in the link text: + + Visit [Daring Fireball][] for more information. + +And then define the link: + + [Daring Fireball]: http://daringfireball.net/ + +Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes. + +Here's an example of reference links in action: + + I get 10 times more traffic from [Google] [1] than from + [Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Using the implicit link name shortcut, you could instead write: + + I get 10 times more traffic from [Google][] than from + [Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" + +Both of the above examples will produce the following HTML output: + +

    I get 10 times more traffic from Google than from + Yahoo + or MSN.

    + +For comparison, here is the same paragraph written using +Markdown's inline link style: + + I get 10 times more traffic from [Google](http://google.com/ "Google") + than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or + [MSN](http://search.msn.com/ "MSN Search"). + +The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text. + +With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose. + + +

    Emphasis

    + +Markdown treats asterisks (`*`) and underscores (`_`) as indicators of +emphasis. Text wrapped with one `*` or `_` will be wrapped with an +HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML +`` tag. E.g., this input: + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + +will produce: + + single asterisks + + single underscores + + double asterisks + + double underscores + +You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span. + +Emphasis can be used in the middle of a word: + + un*fucking*believable + +But if you surround an `*` or `_` with spaces, it'll be treated as a +literal asterisk or underscore. + +To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it: + + \*this text is surrounded by literal asterisks\* + + + +

    Code

    + +To indicate a span of code, wrap it with backtick quotes (`` ` ``). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example: + + Use the `printf()` function. + +will produce: + +

    Use the printf() function.

    + +To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters: + + ``There is a literal backtick (`) here.`` + +which will produce this: + +

    There is a literal backtick (`) here.

    + +The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span: + + A single backtick in a code span: `` ` `` + + A backtick-delimited string in a code span: `` `foo` `` + +will produce: + +

    A single backtick in a code span: `

    + +

    A backtick-delimited string in a code span: `foo`

    + +With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this: + + Please don't use any `` tags. + +into: + +

    Please don't use any <blink> tags.

    + +You can write this: + + `—` is the decimal-encoded equivalent of `—`. + +to produce: + +

    &#8212; is the decimal-encoded + equivalent of &mdash;.

    + + + +

    Images

    + +Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format. + +Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: *inline* and *reference*. + +Inline image syntax looks like this: + + ![Alt text](/path/to/img.jpg) + + ![Alt text](/path/to/img.jpg "Optional title") + +That is: + +* An exclamation mark: `!`; +* followed by a set of square brackets, containing the `alt` + attribute text for the image; +* followed by a set of parentheses, containing the URL or path to + the image, and an optional `title` attribute enclosed in double + or single quotes. + +Reference-style image syntax looks like this: + + ![Alt text][id] + +Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references: + + [id]: url/to/image "Optional title attribute" + +As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML `` tags. + + +* * * + + +

    Miscellaneous

    + + + +Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: + + + +Markdown will turn this into: + + http://example.com/ + +Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this: + + + +into something like this: + + address@exa + mple.com + +which will render in a browser as a clickable link to "address@example.com". + +(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.) + + + +

    Backslash Escapes

    + +Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML `` tag), you can backslashes +before the asterisks, like this: + + \*literal asterisks\* + +Markdown provides backslash escapes for the following characters: + + \ backslash + ` backtick + * asterisk + _ underscore + {} curly braces + [] square brackets + () parentheses + # hash mark + + plus sign + - minus sign (hyphen) + . dot + ! exclamation mark + diff --git a/_site/app/bower_components/marked/test/original/nested_blockquotes.html b/_site/app/bower_components/marked/test/original/nested_blockquotes.html new file mode 100644 index 0000000..d8ec7f8 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/nested_blockquotes.html @@ -0,0 +1,9 @@ +
    +

    foo

    + +
    +

    bar

    +
    + +

    foo

    +
    diff --git a/_site/app/bower_components/marked/test/original/nested_blockquotes.text b/_site/app/bower_components/marked/test/original/nested_blockquotes.text new file mode 100644 index 0000000..ed3c624 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/nested_blockquotes.text @@ -0,0 +1,5 @@ +> foo +> +> > bar +> +> foo diff --git a/_site/app/bower_components/marked/test/original/ordered_and_unordered_lists.html b/_site/app/bower_components/marked/test/original/ordered_and_unordered_lists.html new file mode 100644 index 0000000..ba71eab --- /dev/null +++ b/_site/app/bower_components/marked/test/original/ordered_and_unordered_lists.html @@ -0,0 +1,148 @@ +

    Unordered

    + +

    Asterisks tight:

    + +
      +
    • asterisk 1
    • +
    • asterisk 2
    • +
    • asterisk 3
    • +
    + +

    Asterisks loose:

    + +
      +
    • asterisk 1

    • +
    • asterisk 2

    • +
    • asterisk 3

    • +
    + +
    + +

    Pluses tight:

    + +
      +
    • Plus 1
    • +
    • Plus 2
    • +
    • Plus 3
    • +
    + +

    Pluses loose:

    + +
      +
    • Plus 1

    • +
    • Plus 2

    • +
    • Plus 3

    • +
    + +
    + +

    Minuses tight:

    + +
      +
    • Minus 1
    • +
    • Minus 2
    • +
    • Minus 3
    • +
    + +

    Minuses loose:

    + +
      +
    • Minus 1

    • +
    • Minus 2

    • +
    • Minus 3

    • +
    + +

    Ordered

    + +

    Tight:

    + +
      +
    1. First
    2. +
    3. Second
    4. +
    5. Third
    6. +
    + +

    and:

    + +
      +
    1. One
    2. +
    3. Two
    4. +
    5. Three
    6. +
    + +

    Loose using tabs:

    + +
      +
    1. First

    2. +
    3. Second

    4. +
    5. Third

    6. +
    + +

    and using spaces:

    + +
      +
    1. One

    2. +
    3. Two

    4. +
    5. Three

    6. +
    + +

    Multiple paragraphs:

    + +
      +
    1. Item 1, graf one.

      + +

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

    2. +
    3. Item 2.

    4. +
    5. Item 3.

    6. +
    + +

    Nested

    + +
      +
    • Tab +
        +
      • Tab +
          +
        • Tab
        • +
      • +
    • +
    + +

    Here's another:

    + +
      +
    1. First
    2. +
    3. Second: +
        +
      • Fee
      • +
      • Fie
      • +
      • Foe
      • +
    4. +
    5. Third
    6. +
    + +

    Same thing but with paragraphs:

    + +
      +
    1. First

    2. +
    3. Second:

      + +
        +
      • Fee
      • +
      • Fie
      • +
      • Foe
      • +
    4. +
    5. Third

    6. +
    + + +

    This was an error in Markdown 1.0.1:

    + +
      +
    • this

      + +
      • sub
      + +

      that

    • +
    diff --git a/_site/app/bower_components/marked/test/original/ordered_and_unordered_lists.text b/_site/app/bower_components/marked/test/original/ordered_and_unordered_lists.text new file mode 100644 index 0000000..7f3b497 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/ordered_and_unordered_lists.text @@ -0,0 +1,131 @@ +## Unordered + +Asterisks tight: + +* asterisk 1 +* asterisk 2 +* asterisk 3 + + +Asterisks loose: + +* asterisk 1 + +* asterisk 2 + +* asterisk 3 + +* * * + +Pluses tight: + ++ Plus 1 ++ Plus 2 ++ Plus 3 + + +Pluses loose: + ++ Plus 1 + ++ Plus 2 + ++ Plus 3 + +* * * + + +Minuses tight: + +- Minus 1 +- Minus 2 +- Minus 3 + + +Minuses loose: + +- Minus 1 + +- Minus 2 + +- Minus 3 + + +## Ordered + +Tight: + +1. First +2. Second +3. Third + +and: + +1. One +2. Two +3. Three + + +Loose using tabs: + +1. First + +2. Second + +3. Third + +and using spaces: + +1. One + +2. Two + +3. Three + +Multiple paragraphs: + +1. Item 1, graf one. + + Item 2. graf two. The quick brown fox jumped over the lazy dog's + back. + +2. Item 2. + +3. Item 3. + + + +## Nested + +* Tab + * Tab + * Tab + +Here's another: + +1. First +2. Second: + * Fee + * Fie + * Foe +3. Third + +Same thing but with paragraphs: + +1. First + +2. Second: + * Fee + * Fie + * Foe + +3. Third + + +This was an error in Markdown 1.0.1: + +* this + + * sub + + that diff --git a/_site/app/bower_components/marked/test/original/strong_and_em_together.html b/_site/app/bower_components/marked/test/original/strong_and_em_together.html new file mode 100644 index 0000000..71ec78c --- /dev/null +++ b/_site/app/bower_components/marked/test/original/strong_and_em_together.html @@ -0,0 +1,7 @@ +

    This is strong and em.

    + +

    So is this word.

    + +

    This is strong and em.

    + +

    So is this word.

    diff --git a/_site/app/bower_components/marked/test/original/strong_and_em_together.text b/_site/app/bower_components/marked/test/original/strong_and_em_together.text new file mode 100644 index 0000000..95ee690 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/strong_and_em_together.text @@ -0,0 +1,7 @@ +***This is strong and em.*** + +So is ***this*** word. + +___This is strong and em.___ + +So is ___this___ word. diff --git a/_site/app/bower_components/marked/test/original/tabs.html b/_site/app/bower_components/marked/test/original/tabs.html new file mode 100644 index 0000000..3301ba8 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/tabs.html @@ -0,0 +1,25 @@ +
      +
    • this is a list item +indented with tabs

    • +
    • this is a list item +indented with spaces

    • +
    + +

    Code:

    + +
    this code block is indented by one tab
    +
    + +

    And:

    + +
        this code block is indented by two tabs
    +
    + +

    And:

    + +
    +   this is an example list item
    +    indented with tabs
    +
    ++   this is an example list item
    +    indented with spaces
    +
    diff --git a/_site/app/bower_components/marked/test/original/tabs.text b/_site/app/bower_components/marked/test/original/tabs.text new file mode 100644 index 0000000..589d113 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/tabs.text @@ -0,0 +1,21 @@ ++ this is a list item + indented with tabs + ++ this is a list item + indented with spaces + +Code: + + this code block is indented by one tab + +And: + + this code block is indented by two tabs + +And: + + + this is an example list item + indented with tabs + + + this is an example list item + indented with spaces diff --git a/_site/app/bower_components/marked/test/original/tidyness.html b/_site/app/bower_components/marked/test/original/tidyness.html new file mode 100644 index 0000000..f2a8ce7 --- /dev/null +++ b/_site/app/bower_components/marked/test/original/tidyness.html @@ -0,0 +1,8 @@ +
    +

    A list within a blockquote:

    +
      +
    • asterisk 1
    • +
    • asterisk 2
    • +
    • asterisk 3
    • +
    +
    diff --git a/_site/app/bower_components/marked/test/original/tidyness.text b/_site/app/bower_components/marked/test/original/tidyness.text new file mode 100644 index 0000000..5f18b8d --- /dev/null +++ b/_site/app/bower_components/marked/test/original/tidyness.text @@ -0,0 +1,5 @@ +> A list within a blockquote: +> +> * asterisk 1 +> * asterisk 2 +> * asterisk 3 diff --git a/_site/app/bower_components/marked/test/tests/amps_and_angles_encoding.html b/_site/app/bower_components/marked/test/tests/amps_and_angles_encoding.html new file mode 100644 index 0000000..93c1db5 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/amps_and_angles_encoding.html @@ -0,0 +1,17 @@ +

    AT&T has an ampersand in their name.

    + +

    AT&T is another way to write it.

    + +

    This & that.

    + +

    4 < 5.

    + +

    6 > 5.

    + +

    Here's a link with an ampersand in the URL.

    + +

    Here's a link with an amersand in the link text: AT&T.

    + +

    Here's an inline link.

    + +

    Here's an inline link.

    diff --git a/_site/app/bower_components/marked/test/tests/amps_and_angles_encoding.text b/_site/app/bower_components/marked/test/tests/amps_and_angles_encoding.text new file mode 100644 index 0000000..89ec3ae --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/amps_and_angles_encoding.text @@ -0,0 +1,21 @@ +AT&T has an ampersand in their name. + +AT&T is another way to write it. + +This & that. + +4 < 5. + +6 > 5. + +Here's a [link] [1] with an ampersand in the URL. + +Here's a link with an amersand in the link text: [AT&T] [2]. + +Here's an inline [link](/script?foo=1&bar=2). + +Here's an inline [link](). + + +[1]: http://example.com/?foo=1&bar=2 +[2]: http://att.com/ "AT&T" diff --git a/_site/app/bower_components/marked/test/tests/auto_links.html b/_site/app/bower_components/marked/test/tests/auto_links.html new file mode 100644 index 0000000..f8df985 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/auto_links.html @@ -0,0 +1,18 @@ +

    Link: http://example.com/.

    + +

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

    + + + +
    +

    Blockquoted: http://example.com/

    +
    + +

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

    + +
    or here: <http://example.com/>
    +
    diff --git a/_site/app/bower_components/marked/test/tests/auto_links.text b/_site/app/bower_components/marked/test/tests/auto_links.text new file mode 100644 index 0000000..f85767b --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/auto_links.text @@ -0,0 +1,13 @@ +Link: . + +With an ampersand: + +* In a list? +* +* It should. + +> Blockquoted: + +Auto-links should not occur here: `` + + or here: diff --git a/_site/app/bower_components/marked/test/tests/autolink_lines.html b/_site/app/bower_components/marked/test/tests/autolink_lines.html new file mode 100644 index 0000000..aa2bed4 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/autolink_lines.html @@ -0,0 +1,3 @@ +

    hello world +http://example.com +

    diff --git a/_site/app/bower_components/marked/test/tests/autolink_lines.text b/_site/app/bower_components/marked/test/tests/autolink_lines.text new file mode 100644 index 0000000..c9b61a2 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/autolink_lines.text @@ -0,0 +1,2 @@ +hello world + diff --git a/_site/app/bower_components/marked/test/tests/backslash_escapes.html b/_site/app/bower_components/marked/test/tests/backslash_escapes.html new file mode 100644 index 0000000..c7f0e5e --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/backslash_escapes.html @@ -0,0 +1,118 @@ +

    These should all get escaped:

    + +

    Backslash: \

    + +

    Backtick: `

    + +

    Asterisk: *

    + +

    Underscore: _

    + +

    Left brace: {

    + +

    Right brace: }

    + +

    Left bracket: [

    + +

    Right bracket: ]

    + +

    Left paren: (

    + +

    Right paren: )

    + +

    Greater-than: >

    + +

    Hash: #

    + +

    Period: .

    + +

    Bang: !

    + +

    Plus: +

    + +

    Minus: -

    + +

    These should not, because they occur within a code block:

    + +
    Backslash: \\
    +
    +Backtick: \`
    +
    +Asterisk: \*
    +
    +Underscore: \_
    +
    +Left brace: \{
    +
    +Right brace: \}
    +
    +Left bracket: \[
    +
    +Right bracket: \]
    +
    +Left paren: \(
    +
    +Right paren: \)
    +
    +Greater-than: \>
    +
    +Hash: \#
    +
    +Period: \.
    +
    +Bang: \!
    +
    +Plus: \+
    +
    +Minus: \-
    +
    + +

    Nor should these, which occur in code spans:

    + +

    Backslash: \\

    + +

    Backtick: \`

    + +

    Asterisk: \*

    + +

    Underscore: \_

    + +

    Left brace: \{

    + +

    Right brace: \}

    + +

    Left bracket: \[

    + +

    Right bracket: \]

    + +

    Left paren: \(

    + +

    Right paren: \)

    + +

    Greater-than: \>

    + +

    Hash: \#

    + +

    Period: \.

    + +

    Bang: \!

    + +

    Plus: \+

    + +

    Minus: \-

    + + +

    These should get escaped, even though they're matching pairs for +other Markdown constructs:

    + +

    *asterisks*

    + +

    _underscores_

    + +

    `backticks`

    + +

    This is a code span with a literal backslash-backtick sequence: \`

    + +

    This is a tag with unescaped backticks bar.

    + +

    This is a tag with backslashes bar.

    diff --git a/_site/app/bower_components/marked/test/tests/backslash_escapes.text b/_site/app/bower_components/marked/test/tests/backslash_escapes.text new file mode 100644 index 0000000..5b014cb --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/backslash_escapes.text @@ -0,0 +1,120 @@ +These should all get escaped: + +Backslash: \\ + +Backtick: \` + +Asterisk: \* + +Underscore: \_ + +Left brace: \{ + +Right brace: \} + +Left bracket: \[ + +Right bracket: \] + +Left paren: \( + +Right paren: \) + +Greater-than: \> + +Hash: \# + +Period: \. + +Bang: \! + +Plus: \+ + +Minus: \- + + + +These should not, because they occur within a code block: + + Backslash: \\ + + Backtick: \` + + Asterisk: \* + + Underscore: \_ + + Left brace: \{ + + Right brace: \} + + Left bracket: \[ + + Right bracket: \] + + Left paren: \( + + Right paren: \) + + Greater-than: \> + + Hash: \# + + Period: \. + + Bang: \! + + Plus: \+ + + Minus: \- + + +Nor should these, which occur in code spans: + +Backslash: `\\` + +Backtick: `` \` `` + +Asterisk: `\*` + +Underscore: `\_` + +Left brace: `\{` + +Right brace: `\}` + +Left bracket: `\[` + +Right bracket: `\]` + +Left paren: `\(` + +Right paren: `\)` + +Greater-than: `\>` + +Hash: `\#` + +Period: `\.` + +Bang: `\!` + +Plus: `\+` + +Minus: `\-` + + +These should get escaped, even though they're matching pairs for +other Markdown constructs: + +\*asterisks\* + +\_underscores\_ + +\`backticks\` + +This is a code span with a literal backslash-backtick sequence: `` \` `` + +This is a tag with unescaped backticks bar. + +This is a tag with backslashes bar. diff --git a/_site/app/bower_components/marked/test/tests/blockquote_list_item.html b/_site/app/bower_components/marked/test/tests/blockquote_list_item.html new file mode 100644 index 0000000..83cf0bd --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/blockquote_list_item.html @@ -0,0 +1,3 @@ +

    This fails in markdown.pl and upskirt:

    + +
    • hello

      world

    diff --git a/_site/app/bower_components/marked/test/tests/blockquote_list_item.text b/_site/app/bower_components/marked/test/tests/blockquote_list_item.text new file mode 100644 index 0000000..19e9382 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/blockquote_list_item.text @@ -0,0 +1,4 @@ +This fails in markdown.pl and upskirt: + +* hello + > world diff --git a/_site/app/bower_components/marked/test/tests/blockquotes_with_code_blocks.html b/_site/app/bower_components/marked/test/tests/blockquotes_with_code_blocks.html new file mode 100644 index 0000000..38ee5f0 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/blockquotes_with_code_blocks.html @@ -0,0 +1,15 @@ +
    +

    Example:

    + +
    sub status {
    +    print "working";
    +}
    +
    + +

    Or:

    + +
    sub status {
    +    return "working";
    +}
    +
    +
    diff --git a/_site/app/bower_components/marked/test/tests/blockquotes_with_code_blocks.text b/_site/app/bower_components/marked/test/tests/blockquotes_with_code_blocks.text new file mode 100644 index 0000000..c31d171 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/blockquotes_with_code_blocks.text @@ -0,0 +1,11 @@ +> Example: +> +> sub status { +> print "working"; +> } +> +> Or: +> +> sub status { +> return "working"; +> } diff --git a/_site/app/bower_components/marked/test/tests/case_insensitive_refs.html b/_site/app/bower_components/marked/test/tests/case_insensitive_refs.html new file mode 100644 index 0000000..c54388e --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/case_insensitive_refs.html @@ -0,0 +1 @@ +

    hi

    diff --git a/_site/app/bower_components/marked/test/tests/case_insensitive_refs.text b/_site/app/bower_components/marked/test/tests/case_insensitive_refs.text new file mode 100644 index 0000000..598915a --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/case_insensitive_refs.text @@ -0,0 +1,3 @@ +[hi] + +[HI]: /url diff --git a/_site/app/bower_components/marked/test/tests/code_blocks.html b/_site/app/bower_components/marked/test/tests/code_blocks.html new file mode 100644 index 0000000..32703f5 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/code_blocks.html @@ -0,0 +1,18 @@ +
    code block on the first line
    +
    + +

    Regular text.

    + +
    code block indented by spaces
    +
    + +

    Regular text.

    + +
    the lines in this block  
    +all contain trailing spaces  
    +
    + +

    Regular Text.

    + +
    code block on the last line
    +
    diff --git a/_site/app/bower_components/marked/test/tests/code_blocks.text b/_site/app/bower_components/marked/test/tests/code_blocks.text new file mode 100644 index 0000000..01f9a73 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/code_blocks.text @@ -0,0 +1,14 @@ + code block on the first line + +Regular text. + + code block indented by spaces + +Regular text. + + the lines in this block + all contain trailing spaces + +Regular Text. + + code block on the last line diff --git a/_site/app/bower_components/marked/test/tests/code_spans.html b/_site/app/bower_components/marked/test/tests/code_spans.html new file mode 100644 index 0000000..860e97c --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/code_spans.html @@ -0,0 +1,6 @@ +

    <test a=" content of attribute ">

    + +

    Fix for backticks within HTML tag: like this

    + +

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

    + diff --git a/_site/app/bower_components/marked/test/tests/code_spans.text b/_site/app/bower_components/marked/test/tests/code_spans.text new file mode 100644 index 0000000..750a197 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/code_spans.text @@ -0,0 +1,6 @@ +`` + +Fix for backticks within HTML tag: like this + +Here's how you put `` `backticks` `` in a code span. + diff --git a/_site/app/bower_components/marked/test/tests/def_blocks.html b/_site/app/bower_components/marked/test/tests/def_blocks.html new file mode 100644 index 0000000..14edc97 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/def_blocks.html @@ -0,0 +1,28 @@ +
    +

    hello +[1]: hello

    +
    + +
    + +
    +

    hello

    +
    + + +
      +
    • hello
    • +
    • [3]: hello
    • +
    + + +
      +
    • hello
    • +
    + + +
    +

    foo +bar +bar

    +
    diff --git a/_site/app/bower_components/marked/test/tests/def_blocks.text b/_site/app/bower_components/marked/test/tests/def_blocks.text new file mode 100644 index 0000000..4d16292 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/def_blocks.text @@ -0,0 +1,21 @@ +> hello +> [1]: hello + +* * * + +> hello +[2]: hello + + +* hello +* [3]: hello + + +* hello +[4]: hello + + +> foo +> bar +[1]: foo +> bar diff --git a/_site/app/bower_components/marked/test/tests/double_link.html b/_site/app/bower_components/marked/test/tests/double_link.html new file mode 100644 index 0000000..ff68395 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/double_link.html @@ -0,0 +1,5 @@ +

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

    + +

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

    + +

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

    diff --git a/_site/app/bower_components/marked/test/tests/double_link.text b/_site/app/bower_components/marked/test/tests/double_link.text new file mode 100644 index 0000000..5021673 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/double_link.text @@ -0,0 +1,5 @@ +

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

    + +Already linked: [http://example.com/](http://example.com/). + +Already linked: **http://example.com/**. diff --git a/_site/app/bower_components/marked/test/tests/escaped_angles.html b/_site/app/bower_components/marked/test/tests/escaped_angles.html new file mode 100644 index 0000000..7cf47c4 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/escaped_angles.html @@ -0,0 +1 @@ +

    >

    diff --git a/_site/app/bower_components/marked/test/tests/escaped_angles.text b/_site/app/bower_components/marked/test/tests/escaped_angles.text new file mode 100644 index 0000000..db7422f --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/escaped_angles.text @@ -0,0 +1 @@ +\> diff --git a/_site/app/bower_components/marked/test/tests/gfm_break.breaks.html b/_site/app/bower_components/marked/test/tests/gfm_break.breaks.html new file mode 100644 index 0000000..398ba01 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_break.breaks.html @@ -0,0 +1 @@ +

    Look at the
    pretty line
    breaks.

    diff --git a/_site/app/bower_components/marked/test/tests/gfm_break.breaks.text b/_site/app/bower_components/marked/test/tests/gfm_break.breaks.text new file mode 100644 index 0000000..71097d2 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_break.breaks.text @@ -0,0 +1,3 @@ +Look at the +pretty line +breaks. diff --git a/_site/app/bower_components/marked/test/tests/gfm_code.html b/_site/app/bower_components/marked/test/tests/gfm_code.html new file mode 100644 index 0000000..fe3522e --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_code.html @@ -0,0 +1,5 @@ +
    var a = 'hello';
    +console.log(a + ' world');
    +
    echo "hello, ${WORLD}"
    +
    Q: What do you call a tall person who sells stolen goods?
    +
    A longfence!
    diff --git a/_site/app/bower_components/marked/test/tests/gfm_code.text b/_site/app/bower_components/marked/test/tests/gfm_code.text new file mode 100644 index 0000000..c594387 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_code.text @@ -0,0 +1,16 @@ +``` js +var a = 'hello'; +console.log(a + ' world'); +``` + +~~~bash +echo "hello, ${WORLD}" +~~~ + +```````longfence +Q: What do you call a tall person who sells stolen goods? +``````` + +~~~~~~~~~~ ManyTildes +A longfence! +~~~~~~~~~~ diff --git a/_site/app/bower_components/marked/test/tests/gfm_code_hr_list.html b/_site/app/bower_components/marked/test/tests/gfm_code_hr_list.html new file mode 100644 index 0000000..9fbd0fb --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_code_hr_list.html @@ -0,0 +1,52 @@ +

    foo

    +
      +
    1. bar:

      +
      +
        +
      • one
          +
        • two
            +
          • three
          • +
          • four
          • +
          • five
          • +
          +
        • +
        +
      • +
      +
      +
    2. +
    3. foo:

      +
       line 1
      + line 2
      +
    4. +
    5. foo:

      +
        +
      1. foo bar bar:

        +
         some code here
        +
        +
      2. +
      3. foo bar bar:

        +
         foo
        + ---
        + bar
        + ---
        + foo
        + bar
        +
      4. +
      5. foo bar bar:

        +
         ---
        + foo
        + foo
        + ---
        + bar
        +
      6. +
      7. foo bar bar:

        +
         foo
        + ---
        + bar
        +
      8. +
      9. foo

        +
      10. +
      +
    6. +
    diff --git a/_site/app/bower_components/marked/test/tests/gfm_code_hr_list.text b/_site/app/bower_components/marked/test/tests/gfm_code_hr_list.text new file mode 100644 index 0000000..0eba405 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_code_hr_list.text @@ -0,0 +1,53 @@ +## foo + +1. bar: + + > - one + - two + - three + - four + - five + +1. foo: + + ``` + line 1 + line 2 + ``` + +1. foo: + + 1. foo `bar` bar: + + ``` erb + some code here + ``` + + 2. foo `bar` bar: + + ``` erb + foo + --- + bar + --- + foo + bar + ``` + + 3. foo `bar` bar: + + ``` html + --- + foo + foo + --- + bar + ``` + + 4. foo `bar` bar: + + foo + --- + bar + + 5. foo diff --git a/_site/app/bower_components/marked/test/tests/gfm_del.html b/_site/app/bower_components/marked/test/tests/gfm_del.html new file mode 100644 index 0000000..95e9ec7 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_del.html @@ -0,0 +1 @@ +

    hello hi world

    diff --git a/_site/app/bower_components/marked/test/tests/gfm_del.text b/_site/app/bower_components/marked/test/tests/gfm_del.text new file mode 100644 index 0000000..d29ca77 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_del.text @@ -0,0 +1 @@ +hello ~~hi~~ world diff --git a/_site/app/bower_components/marked/test/tests/gfm_em.html b/_site/app/bower_components/marked/test/tests/gfm_em.html new file mode 100644 index 0000000..8fac346 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_em.html @@ -0,0 +1 @@ +

    These words should_not_be_emphasized.

    diff --git a/_site/app/bower_components/marked/test/tests/gfm_em.text b/_site/app/bower_components/marked/test/tests/gfm_em.text new file mode 100644 index 0000000..6319874 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_em.text @@ -0,0 +1 @@ +These words should_not_be_emphasized. diff --git a/_site/app/bower_components/marked/test/tests/gfm_links.html b/_site/app/bower_components/marked/test/tests/gfm_links.html new file mode 100644 index 0000000..4f62ae1 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_links.html @@ -0,0 +1,2 @@ +

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

    diff --git a/_site/app/bower_components/marked/test/tests/gfm_links.text b/_site/app/bower_components/marked/test/tests/gfm_links.text new file mode 100644 index 0000000..c133666 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_links.text @@ -0,0 +1 @@ +This should be a link: http://example.com/hello-world. diff --git a/_site/app/bower_components/marked/test/tests/gfm_tables.html b/_site/app/bower_components/marked/test/tests/gfm_tables.html new file mode 100644 index 0000000..70bec82 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_tables.html @@ -0,0 +1,37 @@ + + + + + + + + +
    Heading 1Heading 2
    Cell 1Cell 2
    Cell 3Cell 4
    + + + + + + + + +
    Header 1Header 2Header 3Header 4
    Cell 1Cell 2Cell 3Cell 4
    Cell 5Cell 6Cell 7Cell 8
    +
    Test code
    + + + + + + + + +
    Header 1Header 2
    Cell 1Cell 2
    Cell 3Cell 4
    + + + + + + + + +
    Header 1Header 2Header 3Header 4
    Cell 1Cell 2Cell 3Cell 4
    Cell 5Cell 6Cell 7Cell 8
    diff --git a/_site/app/bower_components/marked/test/tests/gfm_tables.text b/_site/app/bower_components/marked/test/tests/gfm_tables.text new file mode 100644 index 0000000..5fd6321 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/gfm_tables.text @@ -0,0 +1,21 @@ +| Heading 1 | Heading 2 +| --------- | --------- +| Cell 1 | Cell 2 +| Cell 3 | Cell 4 + +| Header 1 | Header 2 | Header 3 | Header 4 | +| :------: | -------: | :------- | -------- | +| Cell 1 | Cell 2 | Cell 3 | Cell 4 | +| Cell 5 | Cell 6 | Cell 7 | Cell 8 | + + Test code + +Header 1 | Header 2 +-------- | -------- +Cell 1 | Cell 2 +Cell 3 | Cell 4 + +Header 1|Header 2|Header 3|Header 4 +:-------|:------:|-------:|-------- +Cell 1 |Cell 2 |Cell 3 |Cell 4 +*Cell 5*|Cell 6 |Cell 7 |Cell 8 diff --git a/_site/app/bower_components/marked/test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.html b/_site/app/bower_components/marked/test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.html new file mode 100644 index 0000000..53662fc --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.html @@ -0,0 +1,8 @@ +

    In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item.

    + +

    Here's one with a bullet. +* criminey.

    diff --git a/_site/app/bower_components/marked/test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.text b/_site/app/bower_components/marked/test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.text new file mode 100644 index 0000000..f8a5b27 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/hard_wrapped_paragraphs_with_list_like_lines.nogfm.text @@ -0,0 +1,8 @@ +In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item. + +Here's one with a bullet. +* criminey. diff --git a/_site/app/bower_components/marked/test/tests/horizontal_rules.html b/_site/app/bower_components/marked/test/tests/horizontal_rules.html new file mode 100644 index 0000000..e60d4ba --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/horizontal_rules.html @@ -0,0 +1,71 @@ +

    Dashes:

    + +
    + +
    + +
    + +
    + +
    ---
    +
    + +
    + +
    + +
    + +
    + +
    - - -
    +
    + +

    Asterisks:

    + +
    + +
    + +
    + +
    + +
    ***
    +
    + +
    + +
    + +
    + +
    + +
    * * *
    +
    + +

    Underscores:

    + +
    + +
    + +
    + +
    + +
    ___
    +
    + +
    + +
    + +
    + +
    + +
    _ _ _
    +
    diff --git a/_site/app/bower_components/marked/test/tests/horizontal_rules.text b/_site/app/bower_components/marked/test/tests/horizontal_rules.text new file mode 100644 index 0000000..1594bda --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/horizontal_rules.text @@ -0,0 +1,67 @@ +Dashes: + +--- + + --- + + --- + + --- + + --- + +- - - + + - - - + + - - - + + - - - + + - - - + + +Asterisks: + +*** + + *** + + *** + + *** + + *** + +* * * + + * * * + + * * * + + * * * + + * * * + + +Underscores: + +___ + + ___ + + ___ + + ___ + + ___ + +_ _ _ + + _ _ _ + + _ _ _ + + _ _ _ + + _ _ _ diff --git a/_site/app/bower_components/marked/test/tests/hr_list_break.html b/_site/app/bower_components/marked/test/tests/hr_list_break.html new file mode 100644 index 0000000..bd3ad1f --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/hr_list_break.html @@ -0,0 +1,10 @@ +
      +
    • hello +world
    • +
    • how +are
    • +
    + +
    + +

    you today?

    diff --git a/_site/app/bower_components/marked/test/tests/hr_list_break.text b/_site/app/bower_components/marked/test/tests/hr_list_break.text new file mode 100644 index 0000000..036fe47 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/hr_list_break.text @@ -0,0 +1,6 @@ +* hello +world +* how +are +* * * +you today? diff --git a/_site/app/bower_components/marked/test/tests/inline_html_advanced.html b/_site/app/bower_components/marked/test/tests/inline_html_advanced.html new file mode 100644 index 0000000..3af9caf --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/inline_html_advanced.html @@ -0,0 +1,15 @@ +

    Simple block on one line:

    + +
    foo
    + +

    And nested without indentation:

    + +
    +
    +
    +foo +
    +
    +
    +
    bar
    +
    diff --git a/_site/app/bower_components/marked/test/tests/inline_html_advanced.text b/_site/app/bower_components/marked/test/tests/inline_html_advanced.text new file mode 100644 index 0000000..86b7206 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/inline_html_advanced.text @@ -0,0 +1,15 @@ +Simple block on one line: + +
    foo
    + +And nested without indentation: + +
    +
    +
    +foo +
    +
    +
    +
    bar
    +
    diff --git a/_site/app/bower_components/marked/test/tests/inline_html_comments.html b/_site/app/bower_components/marked/test/tests/inline_html_comments.html new file mode 100644 index 0000000..3f167a1 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/inline_html_comments.html @@ -0,0 +1,13 @@ +

    Paragraph one.

    + + + + + +

    Paragraph two.

    + + + +

    The end.

    diff --git a/_site/app/bower_components/marked/test/tests/inline_html_comments.text b/_site/app/bower_components/marked/test/tests/inline_html_comments.text new file mode 100644 index 0000000..41d830d --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/inline_html_comments.text @@ -0,0 +1,13 @@ +Paragraph one. + + + + + +Paragraph two. + + + +The end. diff --git a/_site/app/bower_components/marked/test/tests/inline_html_simple.html b/_site/app/bower_components/marked/test/tests/inline_html_simple.html new file mode 100644 index 0000000..35c827d --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/inline_html_simple.html @@ -0,0 +1,72 @@ +

    Here's a simple block:

    + +
    + foo +
    + +

    This should be a code block, though:

    + +
    <div>
    +    foo
    +</div>
    +
    + +

    As should this:

    + +
    <div>foo</div>
    +
    + +

    Now, nested:

    + +
    +
    +
    + foo +
    +
    +
    + +

    This should just be an HTML comment:

    + + + +

    Multiline:

    + + + +

    Code block:

    + +
    <!-- Comment -->
    +
    + +

    Just plain comment, with trailing spaces on the line:

    + + + +

    Code:

    + +
    <hr>
    +
    + +

    Hr's:

    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    diff --git a/_site/app/bower_components/marked/test/tests/inline_html_simple.text b/_site/app/bower_components/marked/test/tests/inline_html_simple.text new file mode 100644 index 0000000..df49d7b --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/inline_html_simple.text @@ -0,0 +1,69 @@ +Here's a simple block: + +
    + foo +
    + +This should be a code block, though: + +
    + foo +
    + +As should this: + +
    foo
    + +Now, nested: + +
    +
    +
    + foo +
    +
    +
    + +This should just be an HTML comment: + + + +Multiline: + + + +Code block: + + + +Just plain comment, with trailing spaces on the line: + + + +Code: + +
    + +Hr's: + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + diff --git a/_site/app/bower_components/marked/test/tests/lazy_blockquotes.html b/_site/app/bower_components/marked/test/tests/lazy_blockquotes.html new file mode 100644 index 0000000..a701d42 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/lazy_blockquotes.html @@ -0,0 +1,4 @@ +
    +

    hi there +bud

    +
    diff --git a/_site/app/bower_components/marked/test/tests/lazy_blockquotes.text b/_site/app/bower_components/marked/test/tests/lazy_blockquotes.text new file mode 100644 index 0000000..c0e0b15 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/lazy_blockquotes.text @@ -0,0 +1,2 @@ +> hi there +bud diff --git a/_site/app/bower_components/marked/test/tests/links_inline_style.html b/_site/app/bower_components/marked/test/tests/links_inline_style.html new file mode 100644 index 0000000..09df236 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/links_inline_style.html @@ -0,0 +1,15 @@ +

    Just a URL.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    URL and title.

    + +

    Empty.

    diff --git a/_site/app/bower_components/marked/test/tests/links_inline_style.text b/_site/app/bower_components/marked/test/tests/links_inline_style.text new file mode 100644 index 0000000..8c8eb49 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/links_inline_style.text @@ -0,0 +1,15 @@ +Just a [URL](/url/). + +[URL and title](/url/ "title"). + +[URL and title](/url/ "title preceded by two spaces"). + +[URL and title](/url/ "title preceded by a tab"). + +[URL and title](/url/ "title has spaces afterward" ). + +[URL and title]( /url/has space ). + +[URL and title]( /url/has space/ "url has space and title"). + +[Empty](). diff --git a/_site/app/bower_components/marked/test/tests/links_reference_style.html b/_site/app/bower_components/marked/test/tests/links_reference_style.html new file mode 100644 index 0000000..51f4187 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/links_reference_style.html @@ -0,0 +1,52 @@ +

    Foo bar.

    + +

    Foo bar.

    + +

    Foo bar.

    + +

    With embedded [brackets].

    + +

    Indented once.

    + +

    Indented twice.

    + +

    Indented thrice.

    + +

    Indented [four][] times.

    + +
    [four]: /url
    +
    + +
    + +

    this should work

    + +

    So should this.

    + +

    And this.

    + +

    And this.

    + +

    And this.

    + +

    But not [that] [].

    + +

    Nor [that][].

    + +

    Nor [that].

    + +

    [Something in brackets like this should work]

    + +

    [Same with this.]

    + +

    In this case, this points to something else.

    + +

    Backslashing should suppress [this] and [this].

    + +
    + +

    Here's one where the link +breaks across lines.

    + +

    Here's another where the link +breaks across lines, but with a line-ending space.

    diff --git a/_site/app/bower_components/marked/test/tests/links_reference_style.text b/_site/app/bower_components/marked/test/tests/links_reference_style.text new file mode 100644 index 0000000..341ec88 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/links_reference_style.text @@ -0,0 +1,71 @@ +Foo [bar] [1]. + +Foo [bar][1]. + +Foo [bar] +[1]. + +[1]: /url/ "Title" + + +With [embedded [brackets]] [b]. + + +Indented [once][]. + +Indented [twice][]. + +Indented [thrice][]. + +Indented [four][] times. + + [once]: /url + + [twice]: /url + + [thrice]: /url + + [four]: /url + + +[b]: /url/ + +* * * + +[this] [this] should work + +So should [this][this]. + +And [this] []. + +And [this][]. + +And [this]. + +But not [that] []. + +Nor [that][]. + +Nor [that]. + +[Something in brackets like [this][] should work] + +[Same with [this].] + +In this case, [this](/somethingelse/) points to something else. + +Backslashing should suppress \[this] and [this\]. + +[this]: foo + + +* * * + +Here's one where the [link +breaks] across lines. + +Here's another where the [link +breaks] across lines, but with a line-ending space. + + +[link breaks]: /url/ diff --git a/_site/app/bower_components/marked/test/tests/links_shortcut_references.html b/_site/app/bower_components/marked/test/tests/links_shortcut_references.html new file mode 100644 index 0000000..bf81e93 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/links_shortcut_references.html @@ -0,0 +1,9 @@ +

    This is the simple case.

    + +

    This one has a line +break.

    + +

    This one has a line +break with a line-ending space.

    + +

    this and the other

    diff --git a/_site/app/bower_components/marked/test/tests/links_shortcut_references.text b/_site/app/bower_components/marked/test/tests/links_shortcut_references.text new file mode 100644 index 0000000..8c44c98 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/links_shortcut_references.text @@ -0,0 +1,20 @@ +This is the [simple case]. + +[simple case]: /simple + + + +This one has a [line +break]. + +This one has a [line +break] with a line-ending space. + +[line break]: /foo + + +[this] [that] and the [other] + +[this]: /this +[that]: /that +[other]: /other diff --git a/_site/app/bower_components/marked/test/tests/list_item_text.html b/_site/app/bower_components/marked/test/tests/list_item_text.html new file mode 100644 index 0000000..142df36 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/list_item_text.html @@ -0,0 +1 @@ +
    • item1

      • item2

      text

    diff --git a/_site/app/bower_components/marked/test/tests/list_item_text.text b/_site/app/bower_components/marked/test/tests/list_item_text.text new file mode 100644 index 0000000..a8f81b1 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/list_item_text.text @@ -0,0 +1,5 @@ + * item1 + + * item2 + + text diff --git a/_site/app/bower_components/marked/test/tests/literal_quotes_in_titles.html b/_site/app/bower_components/marked/test/tests/literal_quotes_in_titles.html new file mode 100644 index 0000000..611c1ac --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/literal_quotes_in_titles.html @@ -0,0 +1,3 @@ +

    Foo bar.

    + +

    Foo bar.

    diff --git a/_site/app/bower_components/marked/test/tests/literal_quotes_in_titles.text b/_site/app/bower_components/marked/test/tests/literal_quotes_in_titles.text new file mode 100644 index 0000000..29d0e42 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/literal_quotes_in_titles.text @@ -0,0 +1,7 @@ +Foo [bar][]. + +Foo [bar](/url/ "Title with "quotes" inside"). + + + [bar]: /url/ "Title with "quotes" inside" + diff --git a/_site/app/bower_components/marked/test/tests/loose_lists.html b/_site/app/bower_components/marked/test/tests/loose_lists.html new file mode 100644 index 0000000..c1bd82a --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/loose_lists.html @@ -0,0 +1,62 @@ +
      +
    • hello +world

      + +

      how +are

    • +
    • you
    • +
    + + + +

    better behavior:

    + +
    • hello

      • world +how

        are +you

      • today

    • hi
    + + + +
      +
    • hello

    • +
    • world

    • +
    • hi
    • +
    + + + +
      +
    • hello
    • +
    • world

    • +
    • hi

    • +
    + + + +
      +
    • hello
    • +
    • world

      + +

      how

    • +
    • hi
    • +
    + + + +
      +
    • hello
    • +
    • world
    • +
    • how

      + +

      are

    • +
    + + + +
      +
    • hello
    • +
    • world

    • +
    • how

      + +

      are

    • +
    diff --git a/_site/app/bower_components/marked/test/tests/loose_lists.text b/_site/app/bower_components/marked/test/tests/loose_lists.text new file mode 100644 index 0000000..cb360a1 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/loose_lists.text @@ -0,0 +1,59 @@ +* hello + world + + how + are +* you + + + +better behavior: + +* hello + * world + how + + are + you + + * today +* hi + + + +* hello + +* world +* hi + + + +* hello +* world + +* hi + + + +* hello +* world + + how +* hi + + + +* hello +* world +* how + + are + + + +* hello +* world + +* how + + are diff --git a/_site/app/bower_components/marked/test/tests/main.html b/_site/app/bower_components/marked/test/tests/main.html new file mode 100644 index 0000000..8f78c4d --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/main.html @@ -0,0 +1,4 @@ +

    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.
        +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.
    +Lots of it...
    diff --git a/_site/app/bower_components/marked/test/tests/main.text b/_site/app/bower_components/marked/test/tests/main.text new file mode 100644 index 0000000..58e17a6 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/main.text @@ -0,0 +1,55 @@ +[test]: http://google.com/ "Google" + +# 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][test] 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. + 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](//hello). +And an image ![alt](src). + + Code goes here. + Lots of it... diff --git a/_site/app/bower_components/marked/test/tests/markdown_documentation_basics.html b/_site/app/bower_components/marked/test/tests/markdown_documentation_basics.html new file mode 100644 index 0000000..aadbce2 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/markdown_documentation_basics.html @@ -0,0 +1,314 @@ +

    Markdown: Basics

    + + + +

    Getting the Gist of Markdown's Formatting Syntax

    + +

    This page offers a brief overview of what it's like to use Markdown. +The syntax page provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown.

    + +

    It's also helpful to simply try Markdown out; the Dingus is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML.

    + +

    Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

    + +

    Paragraphs, Headers, Blockquotes

    + +

    A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs.

    + +

    Markdown offers two styles of headers: Setext and atx. +Setext-style headers for <h1> and <h2> are created by +"underlining" with equal signs (=) and hyphens (-), respectively. +To create an atx-style header, you put 1-6 hash marks (#) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level.

    + +

    Blockquotes are indicated using email-style '>' angle brackets.

    + +

    Markdown:

    + +
    A First Level Header
    +====================
    +
    +A Second Level Header
    +---------------------
    +
    +Now is the time for all good men to come to
    +the aid of their country. This is just a
    +regular paragraph.
    +
    +The quick brown fox jumped over the lazy
    +dog's back.
    +
    +### Header 3
    +
    +> This is a blockquote.
    +> 
    +> This is the second paragraph in the blockquote.
    +>
    +> ## This is an H2 in a blockquote
    +
    + +

    Output:

    + +
    <h1>A First Level Header</h1>
    +
    +<h2>A Second Level Header</h2>
    +
    +<p>Now is the time for all good men to come to
    +the aid of their country. This is just a
    +regular paragraph.</p>
    +
    +<p>The quick brown fox jumped over the lazy
    +dog's back.</p>
    +
    +<h3>Header 3</h3>
    +
    +<blockquote>
    +    <p>This is a blockquote.</p>
    +
    +    <p>This is the second paragraph in the blockquote.</p>
    +
    +    <h2>This is an H2 in a blockquote</h2>
    +</blockquote>
    +
    + +

    Phrase Emphasis

    + +

    Markdown uses asterisks and underscores to indicate spans of emphasis.

    + +

    Markdown:

    + +
    Some of these words *are emphasized*.
    +Some of these words _are emphasized also_.
    +
    +Use two asterisks for **strong emphasis**.
    +Or, if you prefer, __use two underscores instead__.
    +
    + +

    Output:

    + +
    <p>Some of these words <em>are emphasized</em>.
    +Some of these words <em>are emphasized also</em>.</p>
    +
    +<p>Use two asterisks for <strong>strong emphasis</strong>.
    +Or, if you prefer, <strong>use two underscores instead</strong>.</p>
    +
    + +

    Lists

    + +

    Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, ++, and -) as list markers. These three markers are +interchangable; this:

    + +
    *   Candy.
    +*   Gum.
    +*   Booze.
    +
    + +

    this:

    + +
    +   Candy.
    ++   Gum.
    ++   Booze.
    +
    + +

    and this:

    + +
    -   Candy.
    +-   Gum.
    +-   Booze.
    +
    + +

    all produce the same output:

    + +
    <ul>
    +<li>Candy.</li>
    +<li>Gum.</li>
    +<li>Booze.</li>
    +</ul>
    +
    + +

    Ordered (numbered) lists use regular numbers, followed by periods, as +list markers:

    + +
    1.  Red
    +2.  Green
    +3.  Blue
    +
    + +

    Output:

    + +
    <ol>
    +<li>Red</li>
    +<li>Green</li>
    +<li>Blue</li>
    +</ol>
    +
    + +

    If you put blank lines between items, you'll get <p> tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab:

    + +
    *   A list item.
    +
    +    With multiple paragraphs.
    +
    +*   Another item in the list.
    +
    + +

    Output:

    + +
    <ul>
    +<li><p>A list item.</p>
    +<p>With multiple paragraphs.</p></li>
    +<li><p>Another item in the list.</p></li>
    +</ul>
    +
    + + + +

    Markdown supports two styles for creating links: inline and +reference. With both styles, you use square brackets to delimit the +text you want to turn into a link.

    + +

    Inline-style links use parentheses immediately after the link text. +For example:

    + +
    This is an [example link](http://example.com/).
    +
    + +

    Output:

    + +
    <p>This is an <a href="http://example.com/">
    +example link</a>.</p>
    +
    + +

    Optionally, you may include a title attribute in the parentheses:

    + +
    This is an [example link](http://example.com/ "With a Title").
    +
    + +

    Output:

    + +
    <p>This is an <a href="http://example.com/" title="With a Title">
    +example link</a>.</p>
    +
    + +

    Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document:

    + +
    I get 10 times more traffic from [Google][1] than from
    +[Yahoo][2] or [MSN][3].
    +
    +[1]: http://google.com/        "Google"
    +[2]: http://search.yahoo.com/  "Yahoo Search"
    +[3]: http://search.msn.com/    "MSN Search"
    +
    + +

    Output:

    + +
    <p>I get 10 times more traffic from <a href="http://google.com/"
    +title="Google">Google</a> than from <a href="http://search.yahoo.com/"
    +title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
    +title="MSN Search">MSN</a>.</p>
    +
    + +

    The title attribute is optional. Link names may contain letters, +numbers and spaces, but are not case sensitive:

    + +
    I start my morning with a cup of coffee and
    +[The New York Times][NY Times].
    +
    +[ny times]: http://www.nytimes.com/
    +
    + +

    Output:

    + +
    <p>I start my morning with a cup of coffee and
    +<a href="http://www.nytimes.com/">The New York Times</a>.</p>
    +
    + +

    Images

    + +

    Image syntax is very much like link syntax.

    + +

    Inline (titles are optional):

    + +
    ![alt text](/path/to/img.jpg "Title")
    +
    + +

    Reference-style:

    + +
    ![alt text][id]
    +
    +[id]: /path/to/img.jpg "Title"
    +
    + +

    Both of the above examples produce the same output:

    + +
    <img src="/path/to/img.jpg" alt="alt text" title="Title" />
    +
    + +

    Code

    + +

    In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (&) and angle brackets (< or +>) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code:

    + +
    I strongly recommend against using any `<blink>` tags.
    +
    +I wish SmartyPants used named entities like `&mdash;`
    +instead of decimal-encoded entites like `&#8212;`.
    +
    + +

    Output:

    + +
    <p>I strongly recommend against using any
    +<code>&lt;blink&gt;</code> tags.</p>
    +
    +<p>I wish SmartyPants used named entities like
    +<code>&amp;mdash;</code> instead of decimal-encoded
    +entites like <code>&amp;#8212;</code>.</p>
    +
    + +

    To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, &, <, +and > characters will be escaped automatically.

    + +

    Markdown:

    + +
    If you want your page to validate under XHTML 1.0 Strict,
    +you've got to put paragraph tags in your blockquotes:
    +
    +    <blockquote>
    +        <p>For example.</p>
    +    </blockquote>
    +
    + +

    Output:

    + +
    <p>If you want your page to validate under XHTML 1.0 Strict,
    +you've got to put paragraph tags in your blockquotes:</p>
    +
    +<pre><code>&lt;blockquote&gt;
    +    &lt;p&gt;For example.&lt;/p&gt;
    +&lt;/blockquote&gt;
    +</code></pre>
    +
    diff --git a/_site/app/bower_components/marked/test/tests/markdown_documentation_basics.text b/_site/app/bower_components/marked/test/tests/markdown_documentation_basics.text new file mode 100644 index 0000000..486055c --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/markdown_documentation_basics.text @@ -0,0 +1,306 @@ +Markdown: Basics +================ + + + + +Getting the Gist of Markdown's Formatting Syntax +------------------------------------------------ + +This page offers a brief overview of what it's like to use Markdown. +The [syntax page] [s] provides complete, detailed documentation for +every feature, but Markdown should be very easy to pick up simply by +looking at a few examples of it in action. The examples on this page +are written in a before/after style, showing example syntax and the +HTML output produced by Markdown. + +It's also helpful to simply try Markdown out; the [Dingus] [d] is a +web application that allows you type your own Markdown-formatted text +and translate it to XHTML. + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL] [src]. + + [s]: /projects/markdown/syntax "Markdown Syntax" + [d]: /projects/markdown/dingus "Markdown Dingus" + [src]: /projects/markdown/basics.text + + +## Paragraphs, Headers, Blockquotes ## + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs. + +Markdown offers two styles of headers: *Setext* and *atx*. +Setext-style headers for `

    ` and `

    ` are created by +"underlining" with equal signs (`=`) and hyphens (`-`), respectively. +To create an atx-style header, you put 1-6 hash marks (`#`) at the +beginning of the line -- the number of hashes equals the resulting +HTML header level. + +Blockquotes are indicated using email-style '`>`' angle brackets. + +Markdown: + + A First Level Header + ==================== + + A Second Level Header + --------------------- + + Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph. + + The quick brown fox jumped over the lazy + dog's back. + + ### Header 3 + + > This is a blockquote. + > + > This is the second paragraph in the blockquote. + > + > ## This is an H2 in a blockquote + + +Output: + +

    A First Level Header

    + +

    A Second Level Header

    + +

    Now is the time for all good men to come to + the aid of their country. This is just a + regular paragraph.

    + +

    The quick brown fox jumped over the lazy + dog's back.

    + +

    Header 3

    + +
    +

    This is a blockquote.

    + +

    This is the second paragraph in the blockquote.

    + +

    This is an H2 in a blockquote

    +
    + + + +### Phrase Emphasis ### + +Markdown uses asterisks and underscores to indicate spans of emphasis. + +Markdown: + + Some of these words *are emphasized*. + Some of these words _are emphasized also_. + + Use two asterisks for **strong emphasis**. + Or, if you prefer, __use two underscores instead__. + +Output: + +

    Some of these words are emphasized. + Some of these words are emphasized also.

    + +

    Use two asterisks for strong emphasis. + Or, if you prefer, use two underscores instead.

    + + + +## Lists ## + +Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, +`+`, and `-`) as list markers. These three markers are +interchangable; this: + + * Candy. + * Gum. + * Booze. + +this: + + + Candy. + + Gum. + + Booze. + +and this: + + - Candy. + - Gum. + - Booze. + +all produce the same output: + +
      +
    • Candy.
    • +
    • Gum.
    • +
    • Booze.
    • +
    + +Ordered (numbered) lists use regular numbers, followed by periods, as +list markers: + + 1. Red + 2. Green + 3. Blue + +Output: + +
      +
    1. Red
    2. +
    3. Green
    4. +
    5. Blue
    6. +
    + +If you put blank lines between items, you'll get `

    ` tags for the +list item text. You can create multi-paragraph list items by indenting +the paragraphs by 4 spaces or 1 tab: + + * A list item. + + With multiple paragraphs. + + * Another item in the list. + +Output: + +

      +
    • A list item.

      +

      With multiple paragraphs.

    • +
    • Another item in the list.

    • +
    + + + +### Links ### + +Markdown supports two styles for creating links: *inline* and +*reference*. With both styles, you use square brackets to delimit the +text you want to turn into a link. + +Inline-style links use parentheses immediately after the link text. +For example: + + This is an [example link](http://example.com/). + +Output: + +

    This is an + example link.

    + +Optionally, you may include a title attribute in the parentheses: + + This is an [example link](http://example.com/ "With a Title"). + +Output: + +

    This is an + example link.

    + +Reference-style links allow you to refer to your links by names, which +you define elsewhere in your document: + + I get 10 times more traffic from [Google][1] than from + [Yahoo][2] or [MSN][3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Output: + +

    I get 10 times more traffic from Google than from Yahoo or MSN.

    + +The title attribute is optional. Link names may contain letters, +numbers and spaces, but are *not* case sensitive: + + I start my morning with a cup of coffee and + [The New York Times][NY Times]. + + [ny times]: http://www.nytimes.com/ + +Output: + +

    I start my morning with a cup of coffee and + The New York Times.

    + + +### Images ### + +Image syntax is very much like link syntax. + +Inline (titles are optional): + + ![alt text](/path/to/img.jpg "Title") + +Reference-style: + + ![alt text][id] + + [id]: /path/to/img.jpg "Title" + +Both of the above examples produce the same output: + + alt text + + + +### Code ### + +In a regular paragraph, you can create code span by wrapping text in +backtick quotes. Any ampersands (`&`) and angle brackets (`<` or +`>`) will automatically be translated into HTML entities. This makes +it easy to use Markdown to write about HTML example code: + + I strongly recommend against using any `` tags. + + I wish SmartyPants used named entities like `—` + instead of decimal-encoded entites like `—`. + +Output: + +

    I strongly recommend against using any + <blink> tags.

    + +

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

    + + +To specify an entire block of pre-formatted code, indent every line of +the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, +and `>` characters will be escaped automatically. + +Markdown: + + If you want your page to validate under XHTML 1.0 Strict, + you've got to put paragraph tags in your blockquotes: + +
    +

    For example.

    +
    + +Output: + +

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

    + +
    <blockquote>
    +        <p>For example.</p>
    +    </blockquote>
    +    
    diff --git a/_site/app/bower_components/marked/test/tests/markdown_documentation_syntax.html b/_site/app/bower_components/marked/test/tests/markdown_documentation_syntax.html new file mode 100644 index 0000000..40e0837 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/markdown_documentation_syntax.html @@ -0,0 +1,942 @@ +

    Markdown: Syntax

    + + + + + +

    Note: This document is itself written using Markdown; you +can see the source for it by adding '.text' to the URL.

    + +
    + +

    Overview

    + +

    Philosophy

    + +

    Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

    + +

    Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including Setext, atx, Textile, reStructuredText, +Grutatext, and EtText -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email.

    + +

    To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like *emphasis*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email.

    + +

    Inline HTML

    + +

    Markdown's syntax is intended for one purpose: to be used as a +format for writing for the web.

    + +

    Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is not to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a publishing format; Markdown is a writing +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text.

    + +

    For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags.

    + +

    The only restrictions are that block-level HTML elements -- e.g. <div>, +<table>, <pre>, <p>, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) <p> tags around HTML block-level tags.

    + +

    For example, to add an HTML table to a Markdown article:

    + +
    This is a regular paragraph.
    +
    +<table>
    +    <tr>
    +        <td>Foo</td>
    +    </tr>
    +</table>
    +
    +This is another regular paragraph.
    +
    + +

    Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style *emphasis* inside an +HTML block.

    + +

    Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML <a> or <img> tags instead of Markdown's +link or image syntax, go right ahead.

    + +

    Unlike block-level HTML tags, Markdown syntax is processed within +span-level tags.

    + +

    Automatic Escaping for Special Characters

    + +

    In HTML, there are two characters that demand special treatment: < +and &. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. &lt;, and +&amp;.

    + +

    Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write 'AT&amp;T'. You even need to +escape ampersands within URLs. Thus, if you want to link to:

    + +
    http://images.google.com/images?num=30&q=larry+bird
    +
    + +

    you need to encode the URL as:

    + +
    http://images.google.com/images?num=30&amp;q=larry+bird
    +
    + +

    in your anchor tag href attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites.

    + +

    Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into &amp;.

    + +

    So, if you want to include a copyright symbol in your article, you can write:

    + +
    &copy;
    +
    + +

    and Markdown will leave it alone. But if you write:

    + +
    AT&T
    +
    + +

    Markdown will translate it to:

    + +
    AT&amp;T
    +
    + +

    Similarly, because Markdown supports inline HTML, if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write:

    + +
    4 < 5
    +
    + +

    Markdown will translate it to:

    + +
    4 &lt; 5
    +
    + +

    However, inside Markdown code spans and blocks, angle brackets and +ampersands are always encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single < +and & in your example code needs to be escaped.)

    + +
    + +

    Block Elements

    + +

    Paragraphs and Line Breaks

    + +

    A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs.

    + +

    The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a <br /> tag.

    + +

    When you do want to insert a <br /> break tag using Markdown, you +end a line with two or more spaces, then type return.

    + +

    Yes, this takes a tad more effort to create a <br />, but a simplistic +"every line break is a <br />" rule wouldn't work for Markdown. +Markdown's email-style blockquoting and multi-paragraph list items +work best -- and look better -- when you format them with hard breaks.

    + + + +

    Markdown supports two styles of headers, Setext and atx.

    + +

    Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example:

    + +
    This is an H1
    +=============
    +
    +This is an H2
    +-------------
    +
    + +

    Any number of underlining ='s or -'s will work.

    + +

    Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example:

    + +
    # This is an H1
    +
    +## This is an H2
    +
    +###### This is an H6
    +
    + +

    Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) :

    + +
    # This is an H1 #
    +
    +## This is an H2 ##
    +
    +### This is an H3 ######
    +
    + +

    Blockquotes

    + +

    Markdown uses email-style > characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a > before every line:

    + +
    > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
    +> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
    +> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    +> 
    +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
    +> id sem consectetuer libero luctus adipiscing.
    +
    + +

    Markdown allows you to be lazy and only put the > before the first +line of a hard-wrapped paragraph:

    + +
    > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
    +consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
    +Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
    +
    +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
    +id sem consectetuer libero luctus adipiscing.
    +
    + +

    Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of >:

    + +
    > This is the first level of quoting.
    +>
    +> > This is nested blockquote.
    +>
    +> Back to the first level.
    +
    + +

    Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks:

    + +
    > ## This is a header.
    +> 
    +> 1.   This is the first list item.
    +> 2.   This is the second list item.
    +> 
    +> Here's some example code:
    +> 
    +>     return shell_exec("echo $input | $markdown_script");
    +
    + +

    Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu.

    + +

    Lists

    + +

    Markdown supports ordered (numbered) and unordered (bulleted) lists.

    + +

    Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers:

    + +
    *   Red
    +*   Green
    +*   Blue
    +
    + +

    is equivalent to:

    + +
    +   Red
    ++   Green
    ++   Blue
    +
    + +

    and:

    + +
    -   Red
    +-   Green
    +-   Blue
    +
    + +

    Ordered lists use numbers followed by periods:

    + +
    1.  Bird
    +2.  McHale
    +3.  Parish
    +
    + +

    It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is:

    + +
    <ol>
    +<li>Bird</li>
    +<li>McHale</li>
    +<li>Parish</li>
    +</ol>
    +
    + +

    If you instead wrote the list in Markdown like this:

    + +
    1.  Bird
    +1.  McHale
    +1.  Parish
    +
    + +

    or even:

    + +
    3. Bird
    +1. McHale
    +8. Parish
    +
    + +

    you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to.

    + +

    If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number.

    + +

    List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab.

    + +

    To make lists look nice, you can wrap items with hanging indents:

    + +
    *   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    +    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    +    viverra nec, fringilla in, laoreet vitae, risus.
    +*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    +    Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    But if you want to be lazy, you don't have to:

    + +
    *   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    +Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    +viverra nec, fringilla in, laoreet vitae, risus.
    +*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    +Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    If list items are separated by blank lines, Markdown will wrap the +items in <p> tags in the HTML output. For example, this input:

    + +
    *   Bird
    +*   Magic
    +
    + +

    will turn into:

    + +
    <ul>
    +<li>Bird</li>
    +<li>Magic</li>
    +</ul>
    +
    + +

    But this:

    + +
    *   Bird
    +
    +*   Magic
    +
    + +

    will turn into:

    + +
    <ul>
    +<li><p>Bird</p></li>
    +<li><p>Magic</p></li>
    +</ul>
    +
    + +

    List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be intended by either 4 spaces +or one tab:

    + +
    1.  This is a list item with two paragraphs. Lorem ipsum dolor
    +    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    +    mi posuere lectus.
    +
    +    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    +    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    +    sit amet velit.
    +
    +2.  Suspendisse id sem consectetuer libero luctus adipiscing.
    +
    + +

    It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy:

    + +
    *   This is a list item with two paragraphs.
    +
    +    This is the second paragraph in the list item. You're
    +only required to indent the first line. Lorem ipsum dolor
    +sit amet, consectetuer adipiscing elit.
    +
    +*   Another item in the same list.
    +
    + +

    To put a blockquote within a list item, the blockquote's > +delimiters need to be indented:

    + +
    *   A list item with a blockquote:
    +
    +    > This is a blockquote
    +    > inside a list item.
    +
    + +

    To put a code block within a list item, the code block needs +to be indented twice -- 8 spaces or two tabs:

    + +
    *   A list item with a code block:
    +
    +        <code goes here>
    +
    + +

    It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this:

    + +
    1986. What a great season.
    +
    + +

    In other words, a number-period-space sequence at the beginning of a +line. To avoid this, you can backslash-escape the period:

    + +
    1986\. What a great season.
    +
    + +

    Code Blocks

    + +

    Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both <pre> and <code> tags.

    + +

    To produce a code block in Markdown, simply indent every line of the +block by at least 4 spaces or 1 tab. For example, given this input:

    + +
    This is a normal paragraph:
    +
    +    This is a code block.
    +
    + +

    Markdown will generate:

    + +
    <p>This is a normal paragraph:</p>
    +
    +<pre><code>This is a code block.
    +</code></pre>
    +
    + +

    One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this:

    + +
    Here is an example of AppleScript:
    +
    +    tell application "Foo"
    +        beep
    +    end tell
    +
    + +

    will turn into:

    + +
    <p>Here is an example of AppleScript:</p>
    +
    +<pre><code>tell application "Foo"
    +    beep
    +end tell
    +</code></pre>
    +
    + +

    A code block continues until it reaches a line that is not indented +(or the end of the article).

    + +

    Within a code block, ampersands (&) and angle brackets (< and >) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this:

    + +
        <div class="footer">
    +        &copy; 2004 Foo Corporation
    +    </div>
    +
    + +

    will turn into:

    + +
    <pre><code>&lt;div class="footer"&gt;
    +    &amp;copy; 2004 Foo Corporation
    +&lt;/div&gt;
    +</code></pre>
    +
    + +

    Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax.

    + +

    Horizontal Rules

    + +

    You can produce a horizontal rule tag (<hr>) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule:

    + +
    * * *
    +
    +***
    +
    +*****
    +
    +- - -
    +
    +---------------------------------------
    +
    +_ _ _
    +
    + +
    + +

    Span Elements

    + + + +

    Markdown supports two style of links: inline and reference.

    + +

    In both styles, the link text is delimited by [square brackets].

    + +

    To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an optional +title for the link, surrounded in quotes. For example:

    + +
    This is [an example](http://example.com/ "Title") inline link.
    +
    +[This link](http://example.net/) has no title attribute.
    +
    + +

    Will produce:

    + +
    <p>This is <a href="http://example.com/" title="Title">
    +an example</a> inline link.</p>
    +
    +<p><a href="http://example.net/">This link</a> has no
    +title attribute.</p>
    +
    + +

    If you're referring to a local resource on the same server, you can +use relative paths:

    + +
    See my [About](/about/) page for details.
    +
    + +

    Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link:

    + +
    This is [an example][id] reference-style link.
    +
    + +

    You can optionally use a space to separate the sets of brackets:

    + +
    This is [an example] [id] reference-style link.
    +
    + +

    Then, anywhere in the document, you define your link label like this, +on a line by itself:

    + +
    [id]: http://example.com/  "Optional Title Here"
    +
    + +

    That is:

    + +
      +
    • Square brackets containing the link identifier (optionally +indented from the left margin using up to three spaces);
    • +
    • followed by a colon;
    • +
    • followed by one or more spaces (or tabs);
    • +
    • followed by the URL for the link;
    • +
    • optionally followed by a title attribute for the link, enclosed +in double or single quotes.
    • +
    + +

    The link URL may, optionally, be surrounded by angle brackets:

    + +
    [id]: <http://example.com/>  "Optional Title Here"
    +
    + +

    You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs:

    + +
    [id]: http://example.com/longish/path/to/resource/here
    +    "Optional Title Here"
    +
    + +

    Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output.

    + +

    Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

    + +
    [link text][a]
    +[link text][A]
    +
    + +

    are equivalent.

    + +

    The implicit link name shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write:

    + +
    [Google][]
    +
    + +

    And then define the link:

    + +
    [Google]: http://google.com/
    +
    + +

    Because link names may contain spaces, this shortcut even works for +multiple words in the link text:

    + +
    Visit [Daring Fireball][] for more information.
    +
    + +

    And then define the link:

    + +
    [Daring Fireball]: http://daringfireball.net/
    +
    + +

    Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes.

    + +

    Here's an example of reference links in action:

    + +
    I get 10 times more traffic from [Google] [1] than from
    +[Yahoo] [2] or [MSN] [3].
    +
    +  [1]: http://google.com/        "Google"
    +  [2]: http://search.yahoo.com/  "Yahoo Search"
    +  [3]: http://search.msn.com/    "MSN Search"
    +
    + +

    Using the implicit link name shortcut, you could instead write:

    + +
    I get 10 times more traffic from [Google][] than from
    +[Yahoo][] or [MSN][].
    +
    +  [google]: http://google.com/        "Google"
    +  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
    +  [msn]:    http://search.msn.com/    "MSN Search"
    +
    + +

    Both of the above examples will produce the following HTML output:

    + +
    <p>I get 10 times more traffic from <a href="http://google.com/"
    +title="Google">Google</a> than from
    +<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
    +or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
    +
    + +

    For comparison, here is the same paragraph written using +Markdown's inline link style:

    + +
    I get 10 times more traffic from [Google](http://google.com/ "Google")
    +than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
    +[MSN](http://search.msn.com/ "MSN Search").
    +
    + +

    The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text.

    + +

    With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose.

    + +

    Emphasis

    + +

    Markdown treats asterisks (*) and underscores (_) as indicators of +emphasis. Text wrapped with one * or _ will be wrapped with an +HTML <em> tag; double *'s or _'s will be wrapped with an HTML +<strong> tag. E.g., this input:

    + +
    *single asterisks*
    +
    +_single underscores_
    +
    +**double asterisks**
    +
    +__double underscores__
    +
    + +

    will produce:

    + +
    <em>single asterisks</em>
    +
    +<em>single underscores</em>
    +
    +<strong>double asterisks</strong>
    +
    +<strong>double underscores</strong>
    +
    + +

    You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span.

    + +

    Emphasis can be used in the middle of a word:

    + +
    un*fucking*believable
    +
    + +

    But if you surround an * or _ with spaces, it'll be treated as a +literal asterisk or underscore.

    + +

    To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it:

    + +
    \*this text is surrounded by literal asterisks\*
    +
    + +

    Code

    + +

    To indicate a span of code, wrap it with backtick quotes (`). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example:

    + +
    Use the `printf()` function.
    +
    + +

    will produce:

    + +
    <p>Use the <code>printf()</code> function.</p>
    +
    + +

    To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters:

    + +
    ``There is a literal backtick (`) here.``
    +
    + +

    which will produce this:

    + +
    <p><code>There is a literal backtick (`) here.</code></p>
    +
    + +

    The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span:

    + +
    A single backtick in a code span: `` ` ``
    +
    +A backtick-delimited string in a code span: `` `foo` ``
    +
    + +

    will produce:

    + +
    <p>A single backtick in a code span: <code>`</code></p>
    +
    +<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
    +
    + +

    With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this:

    + +
    Please don't use any `<blink>` tags.
    +
    + +

    into:

    + +
    <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
    +
    + +

    You can write this:

    + +
    `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
    +
    + +

    to produce:

    + +
    <p><code>&amp;#8212;</code> is the decimal-encoded
    +equivalent of <code>&amp;mdash;</code>.</p>
    +
    + +

    Images

    + +

    Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format.

    + +

    Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: inline and reference.

    + +

    Inline image syntax looks like this:

    + +
    ![Alt text](/path/to/img.jpg)
    +
    +![Alt text](/path/to/img.jpg "Optional title")
    +
    + +

    That is:

    + +
      +
    • An exclamation mark: !;
    • +
    • followed by a set of square brackets, containing the alt +attribute text for the image;
    • +
    • followed by a set of parentheses, containing the URL or path to +the image, and an optional title attribute enclosed in double +or single quotes.
    • +
    + +

    Reference-style image syntax looks like this:

    + +
    ![Alt text][id]
    +
    + +

    Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references:

    + +
    [id]: url/to/image  "Optional title attribute"
    +
    + +

    As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML <img> tags.

    + +
    + +

    Miscellaneous

    + + + +

    Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

    + +
    <http://example.com/>
    +
    + +

    Markdown will turn this into:

    + +
    <a href="http://example.com/">http://example.com/</a>
    +
    + +

    Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this:

    + +
    <address@example.com>
    +
    + +

    into something like this:

    + +
    <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
    +&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
    +&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
    +&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
    +
    + +

    which will render in a browser as a clickable link to "address@example.com".

    + +

    (This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.)

    + +

    Backslash Escapes

    + +

    Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML <em> tag), you can backslashes +before the asterisks, like this:

    + +
    \*literal asterisks\*
    +
    + +

    Markdown provides backslash escapes for the following characters:

    + +
    \   backslash
    +`   backtick
    +*   asterisk
    +_   underscore
    +{}  curly braces
    +[]  square brackets
    +()  parentheses
    +#   hash mark
    ++   plus sign
    +-   minus sign (hyphen)
    +.   dot
    +!   exclamation mark
    +
    diff --git a/_site/app/bower_components/marked/test/tests/markdown_documentation_syntax.text b/_site/app/bower_components/marked/test/tests/markdown_documentation_syntax.text new file mode 100644 index 0000000..79287ab --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/markdown_documentation_syntax.text @@ -0,0 +1,888 @@ +Markdown: Syntax +================ + + + + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) + + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL][src]. + + [src]: /projects/markdown/syntax.text + +* * * + +

    Overview

    + +

    Philosophy

    + +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4], +[Grutatext] [5], and [EtText] [6] -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + + [1]: http://docutils.sourceforge.net/mirror/setext.html + [2]: http://www.aaronsw.com/2002/atx/ + [3]: http://textism.com/tools/textile/ + [4]: http://docutils.sourceforge.net/rst.html + [5]: http://www.triptico.com/software/grutatxt.html + [6]: http://ettext.taint.org/doc/ + +To this end, Markdown's syntax is comprised entirely of punctuation +characters, which punctuation characters have been carefully chosen so +as to look like what they mean. E.g., asterisks around a word actually +look like \*emphasis\*. Markdown lists look like, well, lists. Even +blockquotes look like quoted passages of text, assuming you've ever +used email. + + + +

    Inline HTML

    + +Markdown's syntax is intended for one purpose: to be used as a +format for *writing* for the web. + +Markdown is not a replacement for HTML, or even close to it. Its +syntax is very small, corresponding only to a very small subset of +HTML tags. The idea is *not* to create a syntax that makes it easier +to insert HTML tags. In my opinion, HTML tags are already easy to +insert. The idea for Markdown is to make it easy to read, write, and +edit prose. HTML is a *publishing* format; Markdown is a *writing* +format. Thus, Markdown's formatting syntax only addresses issues that +can be conveyed in plain text. + +For any markup that is not covered by Markdown's syntax, you simply +use HTML itself. There's no need to preface it or delimit it to +indicate that you're switching from Markdown to HTML; you just use +the tags. + +The only restrictions are that block-level HTML elements -- e.g. `
    `, +``, `
    `, `

    `, etc. -- must be separated from surrounding +content by blank lines, and the start and end tags of the block should +not be indented with tabs or spaces. Markdown is smart enough not +to add extra (unwanted) `

    ` tags around HTML block-level tags. + +For example, to add an HTML table to a Markdown article: + + This is a regular paragraph. + +

    + + + +
    Foo
    + + This is another regular paragraph. + +Note that Markdown formatting syntax is not processed within block-level +HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an +HTML block. + +Span-level HTML tags -- e.g. ``, ``, or `` -- can be +used anywhere in a Markdown paragraph, list item, or header. If you +want, you can even use HTML tags instead of Markdown formatting; e.g. if +you'd prefer to use HTML `` or `` tags instead of Markdown's +link or image syntax, go right ahead. + +Unlike block-level HTML tags, Markdown syntax *is* processed within +span-level tags. + + +

    Automatic Escaping for Special Characters

    + +In HTML, there are two characters that demand special treatment: `<` +and `&`. Left angle brackets are used to start tags; ampersands are +used to denote HTML entities. If you want to use them as literal +characters, you must escape them as entities, e.g. `<`, and +`&`. + +Ampersands in particular are bedeviling for web writers. If you want to +write about 'AT&T', you need to write '`AT&T`'. You even need to +escape ampersands within URLs. Thus, if you want to link to: + + http://images.google.com/images?num=30&q=larry+bird + +you need to encode the URL as: + + http://images.google.com/images?num=30&q=larry+bird + +in your anchor tag `href` attribute. Needless to say, this is easy to +forget, and is probably the single most common source of HTML validation +errors in otherwise well-marked-up web sites. + +Markdown allows you to use these characters naturally, taking care of +all the necessary escaping for you. If you use an ampersand as part of +an HTML entity, it remains unchanged; otherwise it will be translated +into `&`. + +So, if you want to include a copyright symbol in your article, you can write: + + © + +and Markdown will leave it alone. But if you write: + + AT&T + +Markdown will translate it to: + + AT&T + +Similarly, because Markdown supports [inline HTML](#html), if you use +angle brackets as delimiters for HTML tags, Markdown will treat them as +such. But if you write: + + 4 < 5 + +Markdown will translate it to: + + 4 < 5 + +However, inside Markdown code spans and blocks, angle brackets and +ampersands are *always* encoded automatically. This makes it easy to use +Markdown to write about HTML code. (As opposed to raw HTML, which is a +terrible format for writing about HTML syntax, because every single `<` +and `&` in your example code needs to be escaped.) + + +* * * + + +

    Block Elements

    + + +

    Paragraphs and Line Breaks

    + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be intended with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `
    ` tag. + +When you *do* want to insert a `
    ` break tag using Markdown, you +end a line with two or more spaces, then type return. + +Yes, this takes a tad more effort to create a `
    `, but a simplistic +"every line break is a `
    `" rule wouldn't work for Markdown. +Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] +work best -- and look better -- when you format them with hard breaks. + + [bq]: #blockquote + [l]: #list + + + + + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Setext-style headers are "underlined" using equal signs (for first-level +headers) and dashes (for second-level headers). For example: + + This is an H1 + ============= + + This is an H2 + ------------- + +Any number of underlining `=`'s or `-`'s will work. + +Atx-style headers use 1-6 hash characters at the start of the line, +corresponding to header levels 1-6. For example: + + # This is an H1 + + ## This is an H2 + + ###### This is an H6 + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) : + + # This is an H1 # + + ## This is an H2 ## + + ### This is an H3 ###### + + +

    Blockquotes

    + +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + > + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + > id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + + > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, + consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. + Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse + id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + + > This is the first level of quoting. + > + > > This is nested blockquote. + > + > Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + + > ## This is a header. + > + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +

    Lists

    + +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers: + + * Red + * Green + * Blue + +is equivalent to: + + + Red + + Green + + Blue + +and: + + - Red + - Green + - Blue + +Ordered lists use numbers followed by periods: + + 1. Bird + 2. McHale + 3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + +
      +
    1. Bird
    2. +
    3. McHale
    4. +
    5. Parish
    6. +
    + +If you instead wrote the list in Markdown like this: + + 1. Bird + 1. McHale + 1. Parish + +or even: + + 3. Bird + 1. McHale + 8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +If you do use lazy list numbering, however, you should still start the +list with the number 1. At some point in the future, Markdown may support +starting ordered lists at an arbitrary number. + +List markers typically start at the left margin, but may be indented by +up to three spaces. List markers must be followed by one or more spaces +or a tab. + +To make lists look nice, you can wrap items with hanging indents: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + + * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. + * Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +If list items are separated by blank lines, Markdown will wrap the +items in `

    ` tags in the HTML output. For example, this input: + + * Bird + * Magic + +will turn into: + +

      +
    • Bird
    • +
    • Magic
    • +
    + +But this: + + * Bird + + * Magic + +will turn into: + +
      +
    • Bird

    • +
    • Magic

    • +
    + +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be intended by either 4 spaces +or one tab: + + 1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + + 2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + + * This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're + only required to indent the first line. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. + + * Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + + * A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + + * A list item with a code block: + + + + +It's worth noting that it's possible to trigger an ordered list by +accident, by writing something like this: + + 1986. What a great season. + +In other words, a *number-period-space* sequence at the beginning of a +line. To avoid this, you can backslash-escape the period: + + 1986\. What a great season. + + + +

    Code Blocks

    + +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `
    ` and `` tags.
    +
    +To produce a code block in Markdown, simply indent every line of the
    +block by at least 4 spaces or 1 tab. For example, given this input:
    +
    +    This is a normal paragraph:
    +
    +        This is a code block.
    +
    +Markdown will generate:
    +
    +    

    This is a normal paragraph:

    + +
    This is a code block.
    +    
    + +One level of indentation -- 4 spaces or 1 tab -- is removed from each +line of the code block. For example, this: + + Here is an example of AppleScript: + + tell application "Foo" + beep + end tell + +will turn into: + +

    Here is an example of AppleScript:

    + +
    tell application "Foo"
    +        beep
    +    end tell
    +    
    + +A code block continues until it reaches a line that is not indented +(or the end of the article). + +Within a code block, ampersands (`&`) and angle brackets (`<` and `>`) +are automatically converted into HTML entities. This makes it very +easy to include example HTML source code using Markdown -- just paste +it and indent it, and Markdown will handle the hassle of encoding the +ampersands and angle brackets. For example, this: + + + +will turn into: + +
    <div class="footer">
    +        &copy; 2004 Foo Corporation
    +    </div>
    +    
    + +Regular Markdown syntax is not processed within code blocks. E.g., +asterisks are just literal asterisks within a code block. This means +it's also easy to use Markdown to write about Markdown's own syntax. + + + +

    Horizontal Rules

    + +You can produce a horizontal rule tag (`
    `) by placing three or +more hyphens, asterisks, or underscores on a line by themselves. If you +wish, you may use spaces between the hyphens or asterisks. Each of the +following lines will produce a horizontal rule: + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + _ _ _ + + +* * * + +

    Span Elements

    + + + +Markdown supports two style of links: *inline* and *reference*. + +In both styles, the link text is delimited by [square brackets]. + +To create an inline link, use a set of regular parentheses immediately +after the link text's closing square bracket. Inside the parentheses, +put the URL where you want the link to point, along with an *optional* +title for the link, surrounded in quotes. For example: + + This is [an example](http://example.com/ "Title") inline link. + + [This link](http://example.net/) has no title attribute. + +Will produce: + +

    This is + an example inline link.

    + +

    This link has no + title attribute.

    + +If you're referring to a local resource on the same server, you can +use relative paths: + + See my [About](/about/) page for details. + +Reference-style links use a second set of square brackets, inside +which you place a label of your choosing to identify the link: + + This is [an example][id] reference-style link. + +You can optionally use a space to separate the sets of brackets: + + This is [an example] [id] reference-style link. + +Then, anywhere in the document, you define your link label like this, +on a line by itself: + + [id]: http://example.com/ "Optional Title Here" + +That is: + +* Square brackets containing the link identifier (optionally + indented from the left margin using up to three spaces); +* followed by a colon; +* followed by one or more spaces (or tabs); +* followed by the URL for the link; +* optionally followed by a title attribute for the link, enclosed + in double or single quotes. + +The link URL may, optionally, be surrounded by angle brackets: + + [id]: "Optional Title Here" + +You can put the title attribute on the next line and use extra spaces +or tabs for padding, which tends to look better with longer URLs: + + [id]: http://example.com/longish/path/to/resource/here + "Optional Title Here" + +Link definitions are only used for creating links during Markdown +processing, and are stripped from your document in the HTML output. + +Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links: + + [link text][a] + [link text][A] + +are equivalent. + +The *implicit link name* shortcut allows you to omit the name of the +link, in which case the link text itself is used as the name. +Just use an empty set of square brackets -- e.g., to link the word +"Google" to the google.com web site, you could simply write: + + [Google][] + +And then define the link: + + [Google]: http://google.com/ + +Because link names may contain spaces, this shortcut even works for +multiple words in the link text: + + Visit [Daring Fireball][] for more information. + +And then define the link: + + [Daring Fireball]: http://daringfireball.net/ + +Link definitions can be placed anywhere in your Markdown document. I +tend to put them immediately after each paragraph in which they're +used, but if you want, you can put them all at the end of your +document, sort of like footnotes. + +Here's an example of reference links in action: + + I get 10 times more traffic from [Google] [1] than from + [Yahoo] [2] or [MSN] [3]. + + [1]: http://google.com/ "Google" + [2]: http://search.yahoo.com/ "Yahoo Search" + [3]: http://search.msn.com/ "MSN Search" + +Using the implicit link name shortcut, you could instead write: + + I get 10 times more traffic from [Google][] than from + [Yahoo][] or [MSN][]. + + [google]: http://google.com/ "Google" + [yahoo]: http://search.yahoo.com/ "Yahoo Search" + [msn]: http://search.msn.com/ "MSN Search" + +Both of the above examples will produce the following HTML output: + +

    I get 10 times more traffic from Google than from + Yahoo + or MSN.

    + +For comparison, here is the same paragraph written using +Markdown's inline link style: + + I get 10 times more traffic from [Google](http://google.com/ "Google") + than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or + [MSN](http://search.msn.com/ "MSN Search"). + +The point of reference-style links is not that they're easier to +write. The point is that with reference-style links, your document +source is vastly more readable. Compare the above examples: using +reference-style links, the paragraph itself is only 81 characters +long; with inline-style links, it's 176 characters; and as raw HTML, +it's 234 characters. In the raw HTML, there's more markup than there +is text. + +With Markdown's reference-style links, a source document much more +closely resembles the final output, as rendered in a browser. By +allowing you to move the markup-related metadata out of the paragraph, +you can add links without interrupting the narrative flow of your +prose. + + +

    Emphasis

    + +Markdown treats asterisks (`*`) and underscores (`_`) as indicators of +emphasis. Text wrapped with one `*` or `_` will be wrapped with an +HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML +`` tag. E.g., this input: + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + +will produce: + + single asterisks + + single underscores + + double asterisks + + double underscores + +You can use whichever style you prefer; the lone restriction is that +the same character must be used to open and close an emphasis span. + +Emphasis can be used in the middle of a word: + + un*fucking*believable + +But if you surround an `*` or `_` with spaces, it'll be treated as a +literal asterisk or underscore. + +To produce a literal asterisk or underscore at a position where it +would otherwise be used as an emphasis delimiter, you can backslash +escape it: + + \*this text is surrounded by literal asterisks\* + + + +

    Code

    + +To indicate a span of code, wrap it with backtick quotes (`` ` ``). +Unlike a pre-formatted code block, a code span indicates code within a +normal paragraph. For example: + + Use the `printf()` function. + +will produce: + +

    Use the printf() function.

    + +To include a literal backtick character within a code span, you can use +multiple backticks as the opening and closing delimiters: + + ``There is a literal backtick (`) here.`` + +which will produce this: + +

    There is a literal backtick (`) here.

    + +The backtick delimiters surrounding a code span may include spaces -- +one after the opening, one before the closing. This allows you to place +literal backtick characters at the beginning or end of a code span: + + A single backtick in a code span: `` ` `` + + A backtick-delimited string in a code span: `` `foo` `` + +will produce: + +

    A single backtick in a code span: `

    + +

    A backtick-delimited string in a code span: `foo`

    + +With a code span, ampersands and angle brackets are encoded as HTML +entities automatically, which makes it easy to include example HTML +tags. Markdown will turn this: + + Please don't use any `` tags. + +into: + +

    Please don't use any <blink> tags.

    + +You can write this: + + `—` is the decimal-encoded equivalent of `—`. + +to produce: + +

    &#8212; is the decimal-encoded + equivalent of &mdash;.

    + + + +

    Images

    + +Admittedly, it's fairly difficult to devise a "natural" syntax for +placing images into a plain text document format. + +Markdown uses an image syntax that is intended to resemble the syntax +for links, allowing for two styles: *inline* and *reference*. + +Inline image syntax looks like this: + + ![Alt text](/path/to/img.jpg) + + ![Alt text](/path/to/img.jpg "Optional title") + +That is: + +* An exclamation mark: `!`; +* followed by a set of square brackets, containing the `alt` + attribute text for the image; +* followed by a set of parentheses, containing the URL or path to + the image, and an optional `title` attribute enclosed in double + or single quotes. + +Reference-style image syntax looks like this: + + ![Alt text][id] + +Where "id" is the name of a defined image reference. Image references +are defined using syntax identical to link references: + + [id]: url/to/image "Optional title attribute" + +As of this writing, Markdown has no syntax for specifying the +dimensions of an image; if this is important to you, you can simply +use regular HTML `` tags. + + +* * * + + +

    Miscellaneous

    + + + +Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this: + + + +Markdown will turn this into: + + http://example.com/ + +Automatic links for email addresses work similarly, except that +Markdown will also perform a bit of randomized decimal and hex +entity-encoding to help obscure your address from address-harvesting +spambots. For example, Markdown will turn this: + + + +into something like this: + + address@exa + mple.com + +which will render in a browser as a clickable link to "address@example.com". + +(This sort of entity-encoding trick will indeed fool many, if not +most, address-harvesting bots, but it definitely won't fool all of +them. It's better than nothing, but an address published in this way +will probably eventually start receiving spam.) + + + +

    Backslash Escapes

    + +Markdown allows you to use backslash escapes to generate literal +characters which would otherwise have special meaning in Markdown's +formatting syntax. For example, if you wanted to surround a word with +literal asterisks (instead of an HTML `` tag), you can backslashes +before the asterisks, like this: + + \*literal asterisks\* + +Markdown provides backslash escapes for the following characters: + + \ backslash + ` backtick + * asterisk + _ underscore + {} curly braces + [] square brackets + () parentheses + # hash mark + + plus sign + - minus sign (hyphen) + . dot + ! exclamation mark + diff --git a/_site/app/bower_components/marked/test/tests/nested_blockquotes.html b/_site/app/bower_components/marked/test/tests/nested_blockquotes.html new file mode 100644 index 0000000..d8ec7f8 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/nested_blockquotes.html @@ -0,0 +1,9 @@ +
    +

    foo

    + +
    +

    bar

    +
    + +

    foo

    +
    diff --git a/_site/app/bower_components/marked/test/tests/nested_blockquotes.text b/_site/app/bower_components/marked/test/tests/nested_blockquotes.text new file mode 100644 index 0000000..ed3c624 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/nested_blockquotes.text @@ -0,0 +1,5 @@ +> foo +> +> > bar +> +> foo diff --git a/_site/app/bower_components/marked/test/tests/nested_code.html b/_site/app/bower_components/marked/test/tests/nested_code.html new file mode 100644 index 0000000..c370592 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/nested_code.html @@ -0,0 +1 @@ +

    hi ther `` ok ```

    diff --git a/_site/app/bower_components/marked/test/tests/nested_code.text b/_site/app/bower_components/marked/test/tests/nested_code.text new file mode 100644 index 0000000..910e3d4 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/nested_code.text @@ -0,0 +1 @@ +````` hi ther `` ok ``` ````` diff --git a/_site/app/bower_components/marked/test/tests/nested_em.html b/_site/app/bower_components/marked/test/tests/nested_em.html new file mode 100644 index 0000000..3ab4ec8 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/nested_em.html @@ -0,0 +1,3 @@ +

    test test test

    + +

    test test test

    diff --git a/_site/app/bower_components/marked/test/tests/nested_em.text b/_site/app/bower_components/marked/test/tests/nested_em.text new file mode 100644 index 0000000..550d0eb --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/nested_em.text @@ -0,0 +1,3 @@ +*test **test** test* + +_test __test__ test_ diff --git a/_site/app/bower_components/marked/test/tests/nested_square_link.html b/_site/app/bower_components/marked/test/tests/nested_square_link.html new file mode 100644 index 0000000..c8b7940 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/nested_square_link.html @@ -0,0 +1 @@ +

    the ] character

    diff --git a/_site/app/bower_components/marked/test/tests/nested_square_link.text b/_site/app/bower_components/marked/test/tests/nested_square_link.text new file mode 100644 index 0000000..82226ed --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/nested_square_link.text @@ -0,0 +1 @@ +[the `]` character](/url) diff --git a/_site/app/bower_components/marked/test/tests/not_a_link.html b/_site/app/bower_components/marked/test/tests/not_a_link.html new file mode 100644 index 0000000..a01685d --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/not_a_link.html @@ -0,0 +1 @@ +

    [test](not a link)

    diff --git a/_site/app/bower_components/marked/test/tests/not_a_link.text b/_site/app/bower_components/marked/test/tests/not_a_link.text new file mode 100644 index 0000000..26f6043 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/not_a_link.text @@ -0,0 +1 @@ +\[test](not a link) diff --git a/_site/app/bower_components/marked/test/tests/ordered_and_unordered_lists.html b/_site/app/bower_components/marked/test/tests/ordered_and_unordered_lists.html new file mode 100644 index 0000000..3ab6122 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/ordered_and_unordered_lists.html @@ -0,0 +1,148 @@ +

    Unordered

    + +

    Asterisks tight:

    + +
      +
    • asterisk 1
    • +
    • asterisk 2
    • +
    • asterisk 3
    • +
    + +

    Asterisks loose:

    + +
      +
    • asterisk 1

    • +
    • asterisk 2

    • +
    • asterisk 3

    • +
    + +
    + +

    Pluses tight:

    + +
      +
    • Plus 1
    • +
    • Plus 2
    • +
    • Plus 3
    • +
    + +

    Pluses loose:

    + +
      +
    • Plus 1

    • +
    • Plus 2

    • +
    • Plus 3

    • +
    + +
    + +

    Minuses tight:

    + +
      +
    • Minus 1
    • +
    • Minus 2
    • +
    • Minus 3
    • +
    + +

    Minuses loose:

    + +
      +
    • Minus 1

    • +
    • Minus 2

    • +
    • Minus 3

    • +
    + +

    Ordered

    + +

    Tight:

    + +
      +
    1. First
    2. +
    3. Second
    4. +
    5. Third
    6. +
    + +

    and:

    + +
      +
    1. One
    2. +
    3. Two
    4. +
    5. Three
    6. +
    + +

    Loose using tabs:

    + +
      +
    1. First

    2. +
    3. Second

    4. +
    5. Third

    6. +
    + +

    and using spaces:

    + +
      +
    1. One

    2. +
    3. Two

    4. +
    5. Three

    6. +
    + +

    Multiple paragraphs:

    + +
      +
    1. Item 1, graf one.

      + +

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

    2. +
    3. Item 2.

    4. +
    5. Item 3.

    6. +
    + +

    Nested

    + +
      +
    • Tab +
        +
      • Tab +
          +
        • Tab
        • +
      • +
    • +
    + +

    Here's another:

    + +
      +
    1. First
    2. +
    3. Second: +
        +
      • Fee
      • +
      • Fie
      • +
      • Foe
      • +
    4. +
    5. Third
    6. +
    + +

    Same thing but with paragraphs:

    + +
      +
    1. First

    2. +
    3. Second:

      + +
        +
      • Fee
      • +
      • Fie
      • +
      • Foe
      • +
    4. +
    5. Third

    6. +
    + + +

    This was an error in Markdown 1.0.1:

    + +
      +
    • this

      + +
      • sub
      + +

      that

    • +
    diff --git a/_site/app/bower_components/marked/test/tests/ordered_and_unordered_lists.text b/_site/app/bower_components/marked/test/tests/ordered_and_unordered_lists.text new file mode 100644 index 0000000..7f3b497 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/ordered_and_unordered_lists.text @@ -0,0 +1,131 @@ +## Unordered + +Asterisks tight: + +* asterisk 1 +* asterisk 2 +* asterisk 3 + + +Asterisks loose: + +* asterisk 1 + +* asterisk 2 + +* asterisk 3 + +* * * + +Pluses tight: + ++ Plus 1 ++ Plus 2 ++ Plus 3 + + +Pluses loose: + ++ Plus 1 + ++ Plus 2 + ++ Plus 3 + +* * * + + +Minuses tight: + +- Minus 1 +- Minus 2 +- Minus 3 + + +Minuses loose: + +- Minus 1 + +- Minus 2 + +- Minus 3 + + +## Ordered + +Tight: + +1. First +2. Second +3. Third + +and: + +1. One +2. Two +3. Three + + +Loose using tabs: + +1. First + +2. Second + +3. Third + +and using spaces: + +1. One + +2. Two + +3. Three + +Multiple paragraphs: + +1. Item 1, graf one. + + Item 2. graf two. The quick brown fox jumped over the lazy dog's + back. + +2. Item 2. + +3. Item 3. + + + +## Nested + +* Tab + * Tab + * Tab + +Here's another: + +1. First +2. Second: + * Fee + * Fie + * Foe +3. Third + +Same thing but with paragraphs: + +1. First + +2. Second: + * Fee + * Fie + * Foe + +3. Third + + +This was an error in Markdown 1.0.1: + +* this + + * sub + + that diff --git a/_site/app/bower_components/marked/test/tests/ref_paren.html b/_site/app/bower_components/marked/test/tests/ref_paren.html new file mode 100644 index 0000000..cff6977 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/ref_paren.html @@ -0,0 +1 @@ +

    hi

    diff --git a/_site/app/bower_components/marked/test/tests/ref_paren.text b/_site/app/bower_components/marked/test/tests/ref_paren.text new file mode 100644 index 0000000..aa97c91 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/ref_paren.text @@ -0,0 +1,3 @@ +[hi] + +[hi]: /url (there) diff --git a/_site/app/bower_components/marked/test/tests/same_bullet.html b/_site/app/bower_components/marked/test/tests/same_bullet.html new file mode 100644 index 0000000..9220741 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/same_bullet.html @@ -0,0 +1,5 @@ +
      +
    • test
    • +
    • test
    • +
    • test
    • +
    diff --git a/_site/app/bower_components/marked/test/tests/same_bullet.text b/_site/app/bower_components/marked/test/tests/same_bullet.text new file mode 100644 index 0000000..27a8967 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/same_bullet.text @@ -0,0 +1,3 @@ +* test ++ test +- test diff --git a/_site/app/bower_components/marked/test/tests/strong_and_em_together.html b/_site/app/bower_components/marked/test/tests/strong_and_em_together.html new file mode 100644 index 0000000..71ec78c --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/strong_and_em_together.html @@ -0,0 +1,7 @@ +

    This is strong and em.

    + +

    So is this word.

    + +

    This is strong and em.

    + +

    So is this word.

    diff --git a/_site/app/bower_components/marked/test/tests/strong_and_em_together.text b/_site/app/bower_components/marked/test/tests/strong_and_em_together.text new file mode 100644 index 0000000..95ee690 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/strong_and_em_together.text @@ -0,0 +1,7 @@ +***This is strong and em.*** + +So is ***this*** word. + +___This is strong and em.___ + +So is ___this___ word. diff --git a/_site/app/bower_components/marked/test/tests/tabs.html b/_site/app/bower_components/marked/test/tests/tabs.html new file mode 100644 index 0000000..3301ba8 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/tabs.html @@ -0,0 +1,25 @@ +
      +
    • this is a list item +indented with tabs

    • +
    • this is a list item +indented with spaces

    • +
    + +

    Code:

    + +
    this code block is indented by one tab
    +
    + +

    And:

    + +
        this code block is indented by two tabs
    +
    + +

    And:

    + +
    +   this is an example list item
    +    indented with tabs
    +
    ++   this is an example list item
    +    indented with spaces
    +
    diff --git a/_site/app/bower_components/marked/test/tests/tabs.text b/_site/app/bower_components/marked/test/tests/tabs.text new file mode 100644 index 0000000..589d113 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/tabs.text @@ -0,0 +1,21 @@ ++ this is a list item + indented with tabs + ++ this is a list item + indented with spaces + +Code: + + this code block is indented by one tab + +And: + + this code block is indented by two tabs + +And: + + + this is an example list item + indented with tabs + + + this is an example list item + indented with spaces diff --git a/_site/app/bower_components/marked/test/tests/text.smartypants.html b/_site/app/bower_components/marked/test/tests/text.smartypants.html new file mode 100644 index 0000000..22997c4 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/text.smartypants.html @@ -0,0 +1,6 @@ +

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

    + +

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

    + +

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

    diff --git a/_site/app/bower_components/marked/test/tests/text.smartypants.text b/_site/app/bower_components/marked/test/tests/text.smartypants.text new file mode 100644 index 0000000..d91c8dc --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/text.smartypants.text @@ -0,0 +1,6 @@ +Hello world 'how' "are" you -- today... + +"It's a more 'challenging' smartypants test..." + +'And,' as a bonus -- "one +multiline" test! diff --git a/_site/app/bower_components/marked/test/tests/tidyness.html b/_site/app/bower_components/marked/test/tests/tidyness.html new file mode 100644 index 0000000..f2a8ce7 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/tidyness.html @@ -0,0 +1,8 @@ +
    +

    A list within a blockquote:

    +
      +
    • asterisk 1
    • +
    • asterisk 2
    • +
    • asterisk 3
    • +
    +
    diff --git a/_site/app/bower_components/marked/test/tests/tidyness.text b/_site/app/bower_components/marked/test/tests/tidyness.text new file mode 100644 index 0000000..5f18b8d --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/tidyness.text @@ -0,0 +1,5 @@ +> A list within a blockquote: +> +> * asterisk 1 +> * asterisk 2 +> * asterisk 3 diff --git a/_site/app/bower_components/marked/test/tests/toplevel_paragraphs.gfm.html b/_site/app/bower_components/marked/test/tests/toplevel_paragraphs.gfm.html new file mode 100644 index 0000000..970c6f1 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/toplevel_paragraphs.gfm.html @@ -0,0 +1,34 @@ +

    hello world + how are you + how are you

    + +

    hello world

    +
    how are you
    + +

    hello world

    +
    + +

    hello world

    +

    how are you

    + +

    hello world

    +

    how are you

    + +

    hello world

    +

    how are you

    + +

    hello world

    +
    • how are you
    + +

    hello world

    +
    how are you
    + +

    hello world +how are you

    + +

    hello world +

    + +
    hello
    + +

    hello

    diff --git a/_site/app/bower_components/marked/test/tests/toplevel_paragraphs.gfm.text b/_site/app/bower_components/marked/test/tests/toplevel_paragraphs.gfm.text new file mode 100644 index 0000000..66366c0 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/toplevel_paragraphs.gfm.text @@ -0,0 +1,37 @@ +hello world + how are you + how are you + +hello world +``` +how are you +``` + +hello world +* * * + +hello world +# how are you + +hello world +how are you +=========== + +hello world +> how are you + +hello world +* how are you + +hello world +
    how are you
    + +hello world +how are you + +hello [world][how] +[how]: /are/you + +
    hello
    + +hello diff --git a/_site/app/bower_components/marked/test/tests/tricky_list.html b/_site/app/bower_components/marked/test/tests/tricky_list.html new file mode 100644 index 0000000..764a335 --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/tricky_list.html @@ -0,0 +1,23 @@ +

    hello world

    + +
      +
    • hello world
    • +
    + +

    hello world

    + +
      +
    • hello world
    • +
    + +

    hello world

    + +
      +
    • Hello world
    • +
    + +

    hello world

    + +
      +
    • hello world
    • +
    diff --git a/_site/app/bower_components/marked/test/tests/tricky_list.text b/_site/app/bower_components/marked/test/tests/tricky_list.text new file mode 100644 index 0000000..9aa76ce --- /dev/null +++ b/_site/app/bower_components/marked/test/tests/tricky_list.text @@ -0,0 +1,15 @@ +**hello** _world_ + +* hello world + +**hello** _world_ + +* hello world + +**hello** _world_ + +* Hello world + +**hello** _world_ + +* hello world diff --git a/_site/app/bower_components/normalize-css/LICENSE.md b/_site/app/bower_components/normalize-css/LICENSE.md new file mode 100644 index 0000000..c6bcc9b --- /dev/null +++ b/_site/app/bower_components/normalize-css/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (c) Nicolas Gallagher and Jonathan Neal + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/_site/app/bower_components/normalize-css/README.md b/_site/app/bower_components/normalize-css/README.md new file mode 100644 index 0000000..80ec51a --- /dev/null +++ b/_site/app/bower_components/normalize-css/README.md @@ -0,0 +1,57 @@ +# normalize.css v3 + +Normalize.css is a customisable CSS file that makes browsers render all +elements more consistently and in line with modern standards. + +The project relies on researching the differences between default browser +styles in order to precisely target only the styles that need or benefit from +normalizing. + +[View the test file](http://necolas.github.io/normalize.css/latest/test.html) + +## Install + +Download from the [project page](http://necolas.github.io/normalize.css/). + +Install with [Component(1)](https://github.com/component/component/): `component install necolas/normalize.css` + +Install with [npm](http://npmjs.org/): `npm install --save normalize.css` + +Install with [Bower](http://bower.io/): `bower install --save normalize.css` + +## What does it do? + +* Preserves useful defaults, unlike many CSS resets. +* Normalizes styles for a wide range of elements. +* Corrects bugs and common browser inconsistencies. +* Improves usability with subtle improvements. +* Explains what code does using detailed comments. + +## How to use it + +No other styles should come before Normalize.css. + +It is recommended that you include the `normalize.css` file as untouched +library code. + +## Browser support + +* Google Chrome (latest) +* Mozilla Firefox (latest) +* Mozilla Firefox 4 +* Opera (latest) +* Apple Safari 6+ +* Internet Explorer 8+ + +[Normalize.css v1 provides legacy browser +support](https://github.com/necolas/normalize.css/tree/v1) (IE 6+, Safari 4+), +but is no longer actively developed. + +## Contributing + +Please read the CONTRIBUTING.md + +## Acknowledgements + +Normalize.css is a project by [Nicolas Gallagher](https://github.com/necolas), +co-created with [Jonathan Neal](https://github.com/jonathantneal). diff --git a/_site/app/bower_components/normalize-css/bower.json b/_site/app/bower_components/normalize-css/bower.json new file mode 100644 index 0000000..9ddcdd0 --- /dev/null +++ b/_site/app/bower_components/normalize-css/bower.json @@ -0,0 +1,13 @@ +{ + "name": "normalize-css", + "version": "3.0.1", + "main": "normalize.css", + "author": "Nicolas Gallagher", + "ignore": [ + "CHANGELOG.md", + "CONTRIBUTING.md", + "component.json", + "package.json", + "test.html" + ] +} diff --git a/_site/app/bower_components/normalize-css/normalize.css b/_site/app/bower_components/normalize-css/normalize.css new file mode 100644 index 0000000..08f8950 --- /dev/null +++ b/_site/app/bower_components/normalize-css/normalize.css @@ -0,0 +1,425 @@ +/*! normalize.css v3.0.1 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/_site/css/app.css b/_site/css/app.css new file mode 100644 index 0000000..8a4b097 --- /dev/null +++ b/_site/css/app.css @@ -0,0 +1,423 @@ +/* General Setting */ + +/* Small screens (default) */ +html { font-size: 100%; } + +/* Medium screens (640px) */ +@media (min-width: 40rem) { + html { font-size: 112%; } +} + +/* Large screens (1024px) */ +@media (min-width: 64rem) { + html { font-size: 120%; } +} + +/* Grid */ + +/* Ditto */ + +body { + color: #333; + margin: 0; + padding: 0; + + font-family: Verdana, Arial; + font-size: 0.8rem; +} + +#sidebar { + margin-top: 0; + padding-left: 25px; + padding-bottom:25px; + padding-top: 25px; + + box-shadow: 0 0 40px #CCC; + -webkit-box-shadow: 0 0 40px #CCC; + -moz-box-shadow: 0 0 40px #CCC; + border-right: 1px solid #BBB; +} + +@media (min-width: 40rem) { + #sidebar { + width: 280px; + position: fixed; + height: 100%; + margin-right: 20px; + padding-bottom:0px; + padding-top: 0px; + overflow-y: scroll; + overflow: -moz-scrollbars-vertical; + } +} + +#sidebar h1 { + font-size: 25px; + margin-bottom: 0px; + padding-bottom: 0px; +} + +#sidebar h1 a:link, #sidebar h1 a:visited { + color: #333; +} + +#sidebar h2 { + font-size: 0.7rem; +} + +#sidebar h5 { + margin-top: 20px; + margin-bottom: 0; +} + +#sidebar a:visited, #sidebar a:link { + color: #4682BE; + text-decoration: none; +} + +#sidebar ul { + list-style-type: none; + margin: 0; + padding-left: 10px; + padding-top: 0; +} + +#sidebar ol { + margin: 0; + padding-left: 30px; + padding-top: 0; +} + +#sidebar ul li:before { /* a hack to have dashes as a list style */ + content: "-"; + position: relative; + left: -5px; +} + +#sidebar ul li, +#sidebar ol li { + margin-top: 0; + margin-bottom: 0.2rem; + margin-left: 10px; + padding: 0; + + text-indent: -5px; /* to compensate for the padding for the dash */ + font-size: 0.7rem; +} + +#content { + padding-top: 10px; + padding-bottom: 150px; + margin-left: 20px; + margin-right: 20px; + font-size: 0.8rem; + line-height:1.3rem; + + /* border: 1px solid black; */ +} + +@media (min-width: 40rem) { + #content { + width: 580px; + padding-left:330px; + margin-left: 0px; + margin-right: 0px; + } +} + +#content pre{ + margin-left: auto; + margin-right: auto; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 0.7rem; + line-height: 1.2; + + color: #FFF; + + background: #111; + border-radius: 5px; +} + +#content code { + padding-right: 5px; + + color: #a6e22e; + font-size: 0.7rem; + font-weight: normal; + font-family: Consolas,"Courier New",Courier,FreeMono,monospace; + + background: #111; + border-radius: 2px; +} + +#content h2 { + margin-top: 50px; + margin-bottom: 0px; + + padding-top: 20px; + padding-bottom: 0px; + + font-size: 18px; + text-align: left; + + border-top: 2px solid #666; +} + +#content h3 { + margin-top: 50px; + margin-bottom: 0px; + + padding-top: 20px; + padding-bottom: 0px; + + text-align: left; + border-top: 1px dotted #777; +} + +#content img { + max-width: 90%; + display: block; + + margin-left: auto; + margin-right: auto; + margin-top: 40px; + margin-bottom: 40px; + + border-radius: 5px; +} + +#content ul { + display: block; + list-style-type: none; + padding-top: 0.5rem; + padding-bottom:0.5rem; +} + +#content ol { + display: block; + padding-top: 0.5rem; + padding-bottom:0.5rem; +} + + +#content ul li:before { /* a hack to have dashes as a list style */ + content: "-"; + position: relative; + left: -5px; +} + +#content ul li, +#content ol li{ + text-indent: -5px; /* to compensate for the padding for the dash */ + font-size: 0.8rem; +} + +#content ul li.link, +#content ol li.link { + color: #2980b9; + text-decoration: none; + font-size: 0.7rem; + font-weight: bold; + cursor: pointer; +} + +#content a:link, #content a:visited { + color: #4682BE; + text-decoration: none; +} + +#content .content-toc{ + background: #bdc3c7; + border-radius: 5px; +} + +#back_to_top { + display: none; + position: fixed; + + height: 20px; + width: 70px; + top: 20px; + + margin-left: 930px; + margin-top: 0px; + + color: #FFF; + line-height: 20px; + text-align: center; + font-size: 10px; + + + border-radius: 5px; + background-color: #AAA; +} + +#back_to_top:hover { + background-color: #444; + cursor: pointer; +} + +#edit { + display: none; + position: fixed; + + height: 17px; + width: 70px; + top: 45px; + + margin-left: 930px; + margin-top: 0px; + + color: #FFF; + line-height: 17px; + text-align: center; + font-size: 10px; + + + border-radius: 5px; + background-color: #AAA; +} + +#edit:hover { + background-color: #444; + cursor: pointer; +} + +#loading, #error { + display: none; + position: fixed; + + top: 0; + height: 17px; + + font-size: 14px; +} + +@media (min-width: 40rem) { + #loading, #error { + display: none; + position: fixed; + + height: 17px; + top: 45%; + + margin-left: 560px; + + font-size: 14px; + } +} + +/** + * okaidia theme for JavaScript, CSS and HTML + * Loosely based on Monokai textmate theme by http://www.monokai.nl/ + * @author ocodia + */ + +code[class*="language-"], +pre[class*="language-"] { + color: #a6e22e; + text-shadow: 0 1px rgba(0,0,0,0.3); + font-family: Consolas, Monaco, 'Andale Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + border-radius: 0.3em; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #272822; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: #75715e; +} + +.token.punctuation { + color: #f8f8f2; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.constant, +.token.symbol { + color: #f92672; +} + +.token.boolean, +.token.number{ + color: #ae81ff; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.builtin { + color: #a6e22e; +} + + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string, +.token.variable { + color: #f92672; +} + +.token.atrule, +.token.attr-value +{ + color: #e6db74; +} + + +.token.keyword{ +color: #66d9ef; +} + +.token.regex, +.token.important { + color: #fd971f; +} + +.token.important { + font-weight: bold; +} + +.token.entity { + cursor: help; +} diff --git a/_site/css/normalize.css b/_site/css/normalize.css new file mode 100644 index 0000000..08f8950 --- /dev/null +++ b/_site/css/normalize.css @@ -0,0 +1,425 @@ +/*! normalize.css v3.0.1 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/_site/docs/class.md b/_site/docs/class.md new file mode 100644 index 0000000..2e268bb --- /dev/null +++ b/_site/docs/class.md @@ -0,0 +1,131 @@ +# Class和Module + +## Class + +ES6引入了Class(类)这个概念,可以定义class,作为对象的模板。 + +```javascript + +class Point { + + constructor(x, y) { + this.x = x; + this.y = y; + } + + toString() { + return '('+this.x+', '+this.y+')'; + } + +} + +``` + +上面代码定义了一个class类,可以看到里面有一个constructor函数,这就是构造函数。而this关键字则代表实例对象。 + +class之间可以通过extends关键字,实现继承。 + +```javascript + +class ColorPoint extends Point { + + constructor(x, y, color) { + super(x, y); // same as super.constructor(x, y) + this.color = color; + } + + toString() { + return this.color+' '+super(); + } + +} + +``` + +上面代码定义了一个ColorPoint类,该类通过extends关键字,继承了Point类的所有属性和方法。在constructor方法内,super就指代父类Point。 + +## Module的基本用法 + +ES6允许将独立的js文件作为模块,也就是说,允许一个JavaScript脚本文件调用另一个脚本文件,从而使得模块化编程成为可能。 + +假设有一个circle.js,它是一个单独模块。 + +```javascript + +// circle.js + +export function area(radius) { + return Math.PI * radius * radius; +} + +export function circumference(radius) { + return 2 * Math.PI * radius; +} + +``` + +上面代码中的export关键字,表示这个方法是对外开放的接口。 + +然后,main.js引用这个模块。 + +```javascript + +// main.js + +import { area, circumference } from 'circle'; + +console.log("圆面积:" + area(4)); +console.log("圆周长:" + circumference(14)); + +``` + +import语句用来导入模块,它接受一个对象,里面指定所要导入的方法,后面的from指定模块名。 + +另一种写法是使用module命令,整体加载circle.js。 + +```javascript + +// main.js + +module circle from 'circle'; + +console.log("圆面积:" + circle.area(4)); +console.log("圆周长:" + circle.circumference(14)); + +``` + +module命令跟一个变量,表示加载的模块定义在该变量上。 + +## 模块的继承 + +模块之间也可以继承。 + +假设有一个circleplus模块,继承了circle模块。 + +```javascript + +// circleplus.js + +export * from 'circle'; +export var e = 2.71828182846; +export default function(x) { + return Math.exp(x); +} + +``` + +上面代码中的“export *”,表示导入circle模块的所有属性和方法。export default命令表示,定义模块的默认方法。 + +加载上面模块的写法如下。 + +```javascript + +// main.js + +module math from "circleplus"; +import exp from "circleplus"; +console.log(exp(math.pi)); + +``` + +上面代码中的"import exp"表示,将circleplus模块的默认方法加载为exp方法。 diff --git a/_site/docs/comprehension.md b/_site/docs/comprehension.md new file mode 100644 index 0000000..57dffde --- /dev/null +++ b/_site/docs/comprehension.md @@ -0,0 +1,68 @@ +# 数组推导 + +ES6提供简洁写法,允许直接通过现有数组生成新数组,这被称为数组推导(array comprehension)。 + +```javascript + +var a1 = [1, 2, 3, 4]; +var a2 = [i * 2 for (i of a1)]; + +a2 // [2, 4, 6, 8] + +``` + +上面代码表示,通过for...of结构,数组a2直接在a1的基础上生成。 + +数组推导可以替代map和filter方法。 + +```javascript + +[for (i of [1, 2, 3]) i * i]; +// 等价于 +[1, 2, 3].map(function (i) { return i * i }); + +[i for (i of [1,4,2,3,-8]) if (i < 3)]; +// 等价于 +[1,4,2,3,-8].filter(function(i) { return i < 3 }); + +``` + +上面代码说明,模拟map功能只要单纯的for...of循环就行了,模拟filter功能除了for...of循环,还必须加上if语句。 + +新引入的for...of结构,可以直接跟在表达式的前面或后面,甚至可以在一个数组推导中,使用多个for...of结构。 + +```javascript + +var a1 = ["x1", "y1"]; +var a2 = ["x2", "y2"]; +var a3 = ["x3", "y3"]; + +[(console.log(s + w + r)) for (s of a1) for (w of a2) for (r of a3)]; +// x1x2x3 +// x1x2y3 +// x1y2x3 +// x1y2y3 +// y1x2x3 +// y1x2y3 +// y1y2x3 +// y1y2y3 + +``` + +上面代码在一个数组推导之中,使用了三个for...of结构。 + +需要注意的是,数组推导的方括号构成了一个单独的作用域,在这个方括号中声明的变量类似于使用let语句声明的变量。 + +由于字符串可以视为数组,因此字符串也可以直接用于数组推导。 + +```javascript + +[c for (c of 'abcde') if (/[aeiou]/.test(c))].join('') // 'ae' + +[c+'0' for (c of 'abcde')].join('') // 'a0b0c0d0e0' + +``` + +上面代码使用了数组推导,对字符串进行处理。 + +数组推导需要注意的地方是,新数组会立即在内存中生成。这时,如果原数组是一个很大的数组,将会非常耗费内存。 diff --git a/_site/docs/destructuring.md b/_site/docs/destructuring.md new file mode 100644 index 0000000..8bb52fa --- /dev/null +++ b/_site/docs/destructuring.md @@ -0,0 +1,121 @@ +# 多变量的模式赋值 + +ES6允许按照一定模式,一次性对多个变量进行赋值,这又称为解构(Destructuring)。 + +正常情况下,将数组元素赋值给多个变量,只能一次次分开赋值。 + +```javascript + +var a = 1; +var b = 2; +var c = 3; + +``` + +ES6允许写成下面这样。 + +```javascript + +var [a, b, c] = [1, 2, 3]; + +``` + +本质上,这种写法属于模式匹配,只要等号两边的模式相同,左边的变量就会被赋予对应的值。下面是一些嵌套数组进行模式赋值的例子。 + +```javascript + +var [foo, [[bar], baz]] = [1, [[2], 3]] + +var [,,third] = ["foo", "bar", "baz"] + +var [head, ...tail] = [1, 2, 3, 4] + +``` + +模式赋值还允许指定默认值。 + +```javascript + +var [missing = true] = []; + +console.log(missing) +// true + +var { x = 3 } = {}; +console.log(x) +// 3 + +``` + +模式赋值不仅可以用于数组,还可以用于对象。 + +```javascript + +var { foo, bar } = { foo: "lorem", bar: "ipsum" }; + +foo // "lorem" +bar // "ipsum" + +var o = { + p1: [ + "Hello", + { p2: "World" } + ] +}; + +var { a: [x, { y }] } = o; + +x // "Hello" +y // "World" + +``` + +这种写法的用途很多。 + +(1)交换变量的值 + +```javascript + +[x, y] = [y, x]; + +``` + +(2)从函数返回多个值 + +```javascript + +function example() { + return [1, 2, 3]; +} + +var [a, b, c] = example(); + +``` + +(3)函数参数的定义 + +```javascript + +function f({p1, p2, p3}) { + // ... +} + +``` + +(4)函数参数的默认值 + +```javascript + +jQuery.ajax = function (url, { + async = true, + beforeSend = function () {}, + cache = true, + complete = function () {}, + crossDomain = false, + global = true, + // ... more config +}) { + // ... do stuff +}; + +``` diff --git a/_site/docs/function.md b/_site/docs/function.md new file mode 100644 index 0000000..5c15225 --- /dev/null +++ b/_site/docs/function.md @@ -0,0 +1,228 @@ +# 函数的扩展 + +## 函数参数的默认值 + +ES6允许为函数的参数设置默认值。 + +```javascript + +function Point(x = 0, y = 0) { + this.x = x; + this.y = y; +} + +var p = new Point(); +// p = { x:0, y:0 } + +``` + +任何带有默认值的参数,被视为可选参数。不带默认值的参数,则被视为必需参数。 + +利用参数默认值,可以指定一个参数不得省略,如果省略就抛出一个错误。 + +```javascript + +function throwIfMissing() { + throw new Error('Missing parameter'); + } + +function foo(mustBeProvided = throwIfMissing()) { + return mustBeProvided; +} + +foo() +// Error: Missing parameter + +``` + +上面代码的foo函数,如果调用的时候没有参数,就会调用默认值throwIfMissing函数,从而抛出一个错误。 + +## rest(...)运算符 + +ES6引入rest运算符(...),用于获取函数的多余参数,这样就不需要使用arguments.length了。rest运算符后面是一个数组变量,该变量将多余的参数放入数组中。 + +```javascript + +function add(...values) { + let sum = 0; + + for (var val of values) { + sum += val; + } + + return sum; +} + +add(2, 5, 3) // 10 + +``` + +上面代码的add函数是一个求和函数,利用rest运算符,可以向该函数传入任意数目的参数。 + +下面是一个利用rest运算符改写数组push方法的例子。 + +```javascript + +function push(array, ...items) { + items.forEach(function(item) { + array.push(item); + console.log(item); + }); +} + +var a = []; +push(a, "a1", "a2", "a3", "a4"); + +``` + +注意,rest参数不能再有其他参数,否则会报错。 + +```javascript + +// 报错 +function f(a, ...b, c) { + // ... +} + +``` + +rest运算符不仅可以用于函数定义,还可以用于函数调用。 + +```javascript + +function f(s1, s2, s3, s4, s5) { + console.log(s1 + s2 + s3 + s4 +s5); +} + +var a = ["a2", "a3", "a4", "a5"]; + +f("a1", ...a) +// a1a2a3a4a5 + +``` + +从上面的例子可以看出,rest运算符的另一个重要作用是,可以将数组转变成正常的参数序列。利用这一点,可以简化求出一个数组最大元素的写法。 + +```javascript + +// ES5 +Math.max.apply(null, [14, 3, 77]) + +// ES6 +Math.max(...[14, 3, 77]) + +// 等同于 +Math.max(14, 3, 77); + +``` + +上面代码表示,由于JavaScript不提供求数组最大元素的函数,所以只能套用Math.max函数,将数组转为一个参数序列,然后求最大值。有了rest运算符以后,就可以直接用Math.max了。 + +## 箭头函数 + +ES6允许使用“箭头”(=>)定义函数。 + +```javascript + +var f = v => v; + +``` + +上面的箭头函数等同于: + +```javascript + +var f = function(v) { + return v; +}; + +``` + +如果箭头函数不需要参数或需要多个参数,就使用一个圆括号代表参数部分。 + +```javascript + +var f = () => 5; +// 等同于 +var f = function (){ return 5 }; + +var sum = (num1, num2) => num1 + num2; +// 等同于 +var sum = function(num1, num2) { + return num1 + num2; +}; + +``` + +如果箭头函数的代码块部分多于一条语句,就要使用大括号将它们括起来,并且使用return语句返回。 + +```javascript + +var sum = (num1, num2) => { return num1 + num2; } + +``` + +由于大括号被解释为代码块,所以如果箭头函数直接返回一个对象,必须在对象外面加上括号。 + +```javascript + +var getTempItem = id => ({ id: id, name: "Temp" }); + +``` +箭头函数的一个用处是简化回调函数。 + +```javascript + +// 正常函数写法 +[1,2,3].map(function (x) { + return x * x; +}); + +// 箭头函数写法 +[1,2,3].map(x => x * x); + +``` + +另一个例子是 + +```javascript + +// 正常函数写法 +var result = values.sort(function(a, b) { + return a - b; +}); + +// 箭头函数写法 +var result = values.sort((a, b) => a - b); + +``` + +箭头函数有几个使用注意点。 + +- 函数体内的this对象,绑定定义时所在的对象,而不是使用时所在的对象。 +- 不可以当作构造函数,也就是说,不可以使用new命令,否则会抛出一个错误。 +- 不可以使用arguments对象,该对象在函数体内不存在。 + +关于this对象,下面的代码将它绑定定义时的对象。 + +```javascript + +var handler = { + + id: "123456", + + init: function() { + document.addEventListener("click", + event => this.doSomething(event.type), false); + }, + + doSomething: function(type) { + console.log("Handling " + type + " for " + this.id); + } +}; + +``` + +上面代码的init方法中,使用了箭头函数,这导致this绑定handler对象。否则,doSomething方法内部的this对象就指向全局对象,运行时会报错。 + +由于this在箭头函数中被绑定,所以不能用call()、apply()、bind()这些方法去改变this的指向。 diff --git a/_site/docs/generator.md b/_site/docs/generator.md new file mode 100644 index 0000000..c44ab71 --- /dev/null +++ b/_site/docs/generator.md @@ -0,0 +1,180 @@ +# Generator 函数 + +## 含义 + +所谓Generator,简单说,就是一个内部状态的遍历器,即每调用一次遍历器,内部状态发生一次改变(可以理解成发生某些事件)。ES6引入了generator函数,作用就是可以完全控制内部状态的变化,依次遍历这些状态。 + +generator函数就是普通函数,但是有两个特征。一是,function关键字后面有一个星号;二是,函数体内部使用yield语句,定义遍历器的每个成员(即不同的内部状态)。 + +```javascript + +function* helloWorldGenerator() { + yield 'hello'; + yield 'world'; +} + +var hw = helloWorldGenerator(); + +``` + +上面代码定义了一个generator函数helloWorldGenerator,它的遍历器有两个成员“hello”和“world”。调用这个函数,就会得到遍历器。 + +当调用generator函数的时候,该函数并不执行,而是返回一个遍历器(可以理解成暂停执行)。以后,每次调用这个遍历器的next方法,就从函数体的头部或者上一次停下来的地方开始执行(可以理解成恢复执行),直到遇到下一个yield语句为止。也就是说,next方法就是在遍历yield语句定义的内部状态。 + +```javascript + +hw.next() +// { value: 'hello', done: false } + +hw.next() +// { value: 'world', done: false } + +hw.next() +// { value: undefined, done: true } + +hw.next() +// Error: Generator has already finished +// ... + +``` + +上面代码一共调用了四次next方法。 + +- 第一次调用 + +函数开始执行,直到遇到第一句yield语句为止。next方法返回一个对象,它的value属性就是当前yield语句的值hello,done属性的值false,表示遍历还没有结束。 + +- 第二次调用 + +函数从上次yield语句停下的地方,一直执行到下一个yield语句。next方法返回的对象的value属性就是当前yield语句的值world,done属性的值false,表示遍历还没有结束。 + +- 第三次调用 + +函数从上次yield语句停下的地方,一直执行到函数结束。next方法返回的对象的value属性就是函数最后的返回值,由于上例的函数没有return语句(即没有返回值),所以value属性的值为undefined,done属性的值true,表示遍历已经结束。 + +- 第四次调用 + +由于此时函数已经运行完毕,next方法直接抛出一个错误。 + +Generator函数使用iterator接口,每次调用next方法的返回值,就是一个标准的iterator返回值:有着value和done两个属性的对象。其中,value是yield语句后面那个表达式的值,done是一个布尔值,表示是否遍历结束。 + +Generator函数的本质,其实是提供一种可以暂停执行的函数。yield语句就是暂停标志,next方法遇到yield,就会暂停执行后面的操作,并将紧跟在yield后面的那个表达式的值,作为返回对象的value属性的值。当下一次调用next方法时,再继续往下执行,直到遇到下一个yield语句。如果没有再遇到新的yield语句,就一直运行到函数结束,将return语句后面的表达式的值,作为value属性的值,如果该函数没有return语句,则value属性的值为undefined。 + +yield语句与return语句有点像,都能返回紧跟在语句后面的那个表达式的值。区别在于每次遇到yield,函数暂停执行,下一次再从该位置继续向后执行,而return语句不具备位置记忆的功能。 + +## next方法的参数 + +yield语句本身没有返回值,或者说总是返回undefined。next方法可以带一个参数,该参数就会被当作上一个yield语句的返回值。 + +```javascript + +function* f() { + for(var i=0; true; i++) { + var reset = yield i; + if(reset) { i = -1; } + } +} + +var g = f(); + +g.next() // { value: 0, done: false } +g.next() // { value: 1, done: false } +g.next(true) // { value: 0, done: false } + +``` + +上面代码先定义了一个可以无限运行的generator函数f,如果next方法没有参数,每次运行到yield语句,变量reset的值总是undefined。当next方法带一个参数true时,当前的变量reset就被重置为这个参数(即true),因此i会等于-1,下一轮循环就会从-1开始递增。 + +## 异步操作的应用 + +generator函数的这种暂停执行的效果,意味着可以把异步操作写在yield语句里面,等到调用next方法时再往后执行。这实际上等同于不需要写回调函数了,因为异步操作的后续操作可以放在yield语句下面,反正要等到调用next方法时再执行。所以,generator函数的一个重要实际意义就是用来处理异步操作,改写回调函数。 + +```javascript + +function* loadUI() { + showLoadingScreen(); + yield loadUIDataAsynchronously(); + hideLoadingScreen(); +} + +// 加载UI +loadUI.next() + +// 卸载UI +loadUI.next() + +``` + +上面代码表示,第一次调用loadUI函数时,该函数不会执行,仅返回一个遍历器。下一次对该遍历器调用next方法,则会显示登录窗口,并且异步加载数据。再一次使用next方法,则会隐藏登录窗口。可以看到,这种写法的好处是所有登录窗口的逻辑,都被封装在一个函数,按部就班非常清晰。 + +注意,yield语句是同步运行,不是异步运行(否则就失去了取代回调函数的设计目的了)。实际操作中,一般让yield语句返回Promises对象。 + +```javascript + +var Q = require('q'); + +function delay(milliseconds) { + var deferred = Q.defer(); + setTimeout(deferred.resolve, milliseconds); + return deferred.promise; +} + +function *f(){ + yield delay(100); +}; + +``` + +上面代码使用Promise的函数库Q,yield语句返回的就是一个Promise对象。 + +## for...of循环 + +for...of循环可以自动遍历Generator函数,且此时不再需要调用next方法。 + +下面是一个利用generator函数和for...of循环,实现斐波那契数列的例子。 + +```javascript + +function* fibonacci() { + let [prev, curr] = [0, 1]; + for (;;) { + [prev, curr] = [curr, prev + curr]; + yield curr; + } +} + +for (n of fibonacci()) { + if (n > 1000) break; + console.log(n); +} + +``` + +从上面代码可见,使用for...of语句时不需要使用next方法。 + +## yield*语句 + +如果yield命令后面跟的是一个遍历器,需要在yield命令后面加上星号,表明它返回的是一个遍历器。这被称为yield*语句。 + +```javascript + +let delegatedIterator = (function* () { + yield 'Hello!'; + yield 'Bye!'; +}()); + +let delegatingIterator = (function* () { + yield 'Greetings!'; + yield* delegatedIterator; + yield 'Ok, bye.'; +}()); + +for(let value of delegatingIterator) { + console.log(value); +} +// "Greetings! +// "Hello!" +// "Bye!" +// "Ok, bye." + +``` diff --git a/_site/docs/intro.md b/_site/docs/intro.md new file mode 100644 index 0000000..eb67227 --- /dev/null +++ b/_site/docs/intro.md @@ -0,0 +1,86 @@ +# ECMAScript 6简介 + +ECMAScript 6(以下简称ES6)是JavaScript语言的下一代标准,正处在快速开发之中,大部分已经完成了,预计将在2014年底正式发布。Mozilla将在这个标准的基础上,推出JavaScript 2.0。 + +ES6的目标,是使得JavaScript语言可以用来编写大型的复杂的应用程序,成为企业级开发语言。 + +## ECMAScript和JavaScript的关系 + +ECMAScript是JavaScript语言的国际标准,JavaScript是ECMAScript的实现。 + +1996年11月,JavaScript的创造者Netscape公司,决定将JavaScript提交给国际标准化组织ECMA,希望这种语言能够成为国际标准。次年,ECMA发布262号标准文件(ECMA-262)的第一版,规定了浏览器脚本语言的标准,并将这种语言称为ECMAScript。这个版本就是ECMAScript 1.0版。 + +之所以不叫JavaScript,有两个原因。一是商标,Java是Sun公司的商标,根据授权协议,只有Netscape公司可以合法地使用JavaScript这个名字,且JavaScript本身也已经被Netscape公司注册为商标。二是想体现这门语言的制定者是ECMA,不是Netscape,这样有利于保证这门语言的开放性和中立性。因此,ECMAScript和JavaScript的关系是,前者是后者的规格,后者是前者的一种实现。在日常场合,这两个词是可以互换的。 + +## ECMAScript的历史 + +1998年6月,ECMAScript 2.0版发布。 + +1999年12月,ECMAScript 3.0版发布,成为JavaScript的通行标准,得到了广泛支持。 + +2008年7月,由于对于下一个版本应该包括哪些功能,各方差异太大,争论过于激进,ECMA开会决定,中止ECMAScript 4.0的开发,将其中涉及现有功能改善的一小部分,发布为ECMAScript 3.1,而将其他激进的设想扩大范围,放入以后的版本,由于会议的气氛,该版本的项目代号起名为Harmony(和谐)。会后不久,ECMAScript 3.1就改名为ECMAScript 5。 + +2009年9月,ECMAScript 5.0版正式发布。Harmony项目则一分为二,一些较为可行的设想定名为Javascript.next继续开发,后来演变成ECMAScript 6;一些不是很成熟的设想,则被视为JavaScript.next.next,在更远的将来再考虑推出。 + +2011年6月,ECMAscript 5.1版发布,并且成为ISO国际标准(ISO/IEC 16262:2011)。 + +2013年3月,ECMAScript 6草案冻结,不再添加新功能。新的功能设想将被放到ECMAScript 7。 + +2013年12月,ECMAScript 6草案发布。然后是12个月的讨论期,听取各方反馈。 + +2014年12月,ECMAScript 6预计将发布正式版本。 + +ECMA的第39号技术专家委员会(Technical Committee 39,简称TC39)负责制订ECMAScript标准,成员包括Microsoft、Mozilla、Google等。TC39的总体考虑是,ECMAScript 5与ECMAScript 3基本保持兼容,较大的语法修正和新功能加入,将由JavaScript.next完成。当前,JavaScript.next指的是ECMAScript 6,当第六版发布以后,将指ECMAScript 7。TC39预计,ECMAScript 5会在2013年的年中成为JavaScript开发的主流标准,并在今后五年中一直保持这个位置。 + +## 部署进度 + +由于ES6还没有定案,有些语法规则还会变动,目前支持ES6的软件和开发环境还不多。各大浏览器的最新版本,对ES6的支持可以查看[kangax.github.io/es5-compat-table/es6/](http://kangax.github.io/es5-compat-table/es6/)。 + +## 使用方法 + +Google公司的V8引擎已经部署了ES6的部分特性。使用node.js 0.11版,就可以体验这些特性。 + +node.js的0.11版还不是稳定版本,要使用版本管理工具[nvm](https://github.com/creationix/nvm)切换。下载nvm以后,进入项目目录,运行下面的命令。 + +```bash + +source nvm.sh +nvm use 0.11 +node --harmony + +``` + +启动命令中的--harmony选项可以打开大部分的ES6功能,但是还是--use_strict选项打开块级作用域功能、--harmony_generators选项打开generator功能。使用下面的命令,可以查看所有与ES6有关的选项。 + +```bash + +node --v8-options | grep harmony + +``` + +另外,可以使用Google的[Traceur](https://github.com/google/traceur-compiler),将ES6代码编译为ES5。 + +```bash +# 安装 +npm install -g traceur + +# 运行ES6文件 +traceur /path/to/es6 + +# 将ES6文件转为ES5文件 +traceur --script /path/to/es6 --out /path/to/es5 +``` + +## ECMAScript 7 + +2013年3月,ES6的草案封闭,不再接受新功能了。新的功能将被加入ES7。 + +ES7可能包括的功能有: + +(1)**Object.observe**:对象与网页元素的双向绑定,只要其中之一发生变化,就会自动反映在另一者上。 + +(2)**Multi-Threading**:多线程支持。目前,Intel和Mozilla有一个共同的研究项目RiverTrail,致力于让JavaScript多线程运行。预计这个项目的研究成果会被纳入ECMAScript标准。 + +(3)**Traits**:它将是“类”功能(class)的一个替代。通过它,不同的对象可以分享同样的特性。 + +其他可能包括的功能还有:更精确的数值计算、改善的内存回收、增强的跨站点安全、类型化的更贴近硬件的低级别操作、国际化支持(Internationalization Support)、更多的数据结构等等。 diff --git a/_site/docs/iterator.md b/_site/docs/iterator.md new file mode 100644 index 0000000..7eefae6 --- /dev/null +++ b/_site/docs/iterator.md @@ -0,0 +1,187 @@ +# Iterator和for...of循环 + +## Iterator(遍历器) + +遍历器(Iterator)是一种协议,任何对象只要部署这个协议,就可以完成遍历操作。在ES6中,遍历操作特指for...of循环。 + +ES6的遍历器协议规定,部署了next方法的对象,就具备了遍历器功能。next方法必须返回一个包含value和done两个属性的对象。其中,value属性是当前遍历位置的值,done属性是一个布尔值,表示遍历是否结束。 + +```javascript + +function makeIterator(array){ + var nextIndex = 0; + + return { + next: function(){ + return nextIndex < array.length ? + {value: array[nextIndex++], done: false} : + {value: undefined, done: true}; + } + } +} + +var it = makeIterator(['a', 'b']); + +it.next().value // 'a' +it.next().value // 'b' +it.next().done // true + +``` +上面代码定义了一个makeIterator函数,它的作用是返回一个遍历器对象,用来遍历参数数组。请特别注意,next返回值的构造。 + +下面是一个无限运行的遍历器例子。 + +```javascript + +function idMaker(){ + var index = 0; + + return { + next: function(){ + return {value: index++, done: false}; + } + } +} + +var it = idMaker(); + +it.next().value // '0' +it.next().value // '1' +it.next().value // '2' +// ... + +``` + +一个对象只要具备了next方法,就可以用for...of循环遍历它的值。 + +```javascript + +for (var n of it) { + if (n > 5) + break; + console.log(n); +} + +``` + +## for...of循环 + +ES6中,任何具备了iterator接口的对象,都可以用for...of循环遍历。数组原生具备iterator接口。 + +```javascript + +const arr = ['red', 'green', 'blue']; + +for(let v of arr) { + console.log(v); +} +\\ red +\\ green +\\ blue + +``` + +JavaScript原有的for...in循环,只能获得对象的键名,不能直接获取键值。ES6提供for...of循环,允许遍历获得键值。 + +```javascript + +var arr = ["a", "b", "c", "d"]; +for (a in arr) { + console.log(a); +} +// 0 +// 1 +// 2 +// 3 + +for (a of arr) { + console.log(a); +} +// a +// b +// c +// d + +``` + +上面代码表明,for...in循环读取键名,for...of循环读取键值。 + +对于Set和Map结构的数据,可以直接使用for...of循环。 + +```javascript + +var engines = Set(["Gecko", "Trident", "Webkit", "Webkit"]); +for (var e of engines) { + console.log(e); +} +// Gecko +// Trident +// Webkit + +var es6 = new Map(); +es6.set("edition", 6); +es6.set("committee", "TC39"); +es6.set("standard", "ECMA-262"); +for (var [name, value] of es6) { + console.log(name + ": " + value); +} +// edition: 6 +// committee: TC39 +// standard: ECMA-262 + +``` + +上面代码演示了如何遍历Set结构和Map结构,后者是同时遍历键名和键值。 + +对于普通的对象,for...of结构不能直接使用,会报错,必须部署了iterator接口后才能使用。但是,这样情况下,for...in循环依然可以用来遍历键名。 + +```javascript + +var es6 = { + edition: 6, + committee: "TC39", + standard: "ECMA-262" +}; + +for (e in es6) { + console.log(e); +} +// edition +// committee +// standard + +for (e of es6) { + console.log(e); +} +// TypeError: es6 is not iterable + +``` + +上面代码表示,for...in循环可以遍历键名,for...of循环会报错。 + +总结一下,for...of循环可以使用的范围包括数组、类似数组的对象(比如arguments对象、DOM NodeList对象)、Set和Map结构、后文的Generator对象,以及字符串。下面是for...of循环用于字符串和DOM NodeList对象的例子。 + +```javascript + +// 字符串的例子 + +let str = "hello"; + +for (let s of str) { + console.log(s); +} +// h +// e +// l +// l +// o + +// DOM NodeList对象的例子 + +let paras = document.querySelectorAll("p"); + +for (let p of paras) { + p.classList.add("test"); +} + +``` diff --git a/_site/docs/let.md b/_site/docs/let.md new file mode 100644 index 0000000..bbb2236 --- /dev/null +++ b/_site/docs/let.md @@ -0,0 +1,165 @@ +# let和const命令 + +## let命令 + +ES6新增了let命令,用来声明变量。它的用法类似于var,但是所声明的变量,只在let命令所在的代码块内有效。 + +```javascript + +{ + let a = 10; + var b = 1; +} + +a // ReferenceError: a is not defined. +b //1 + +``` + +上面代码在代码块之中,分别用let和var声明了两个变量。然后在代码块之外调用这两个变量,结果let声明的变量报错,var声明的变量返回了正确的值。这表明,let声明的变量只在它所在的代码块有效。 + +下面的代码如果使用var,最后输出的是9。 + +```javascript + +var a = []; +for (var i = 0; i < 10; i++) { + var c = i; + a[i] = function () { + console.log(c); + }; +} +a[6](); // 9 + +``` + +如果使用let,声明的变量仅在块级作用域内有效,最后输出的是6。 + +```javascript + +var a = []; +for (var i = 0; i < 10; i++) { + let c = i; + a[i] = function () { + console.log(c); + }; +} +a[6](); // 6 + +``` + +注意,let不允许在相同作用域内,重复声明同一个变量。 + +```javascript + +// 报错 +{ + let a = 10; + var a = 1; +} + +// 报错 +{ + let a = 10; + let a = 1; +} + +``` + +## 块级作用域 + +let实际上为JavaScript新增了块级作用域。 + +```javascript + +function f1() { + let n = 5; + if (true) { + let n = 10; + } + console.log(n); // 5 +} + +``` + +上面的函数有两个代码块,都声明了变量n,运行后输出5。这表示外层代码块不受内层代码块的影响。如果使用var定义变量n,最后输出的值就是10。 + +块级作用域的出现,实际上使得获得广泛应用的立即执行函数(IIFE)不再必要了。 + +```javascript + +// IIFE写法 +(function () { + var tmp = ...; + ... +}()); + +// 块级作用域写法 +{ + let tmp = ...; + ... +} + +``` + +另外,ES6的函数也默认在块级作用域内声明。 + +```javascript + +function f() { console.log('I am outside!'); } +(function () { + if(false) { + // What should happen with this redeclaration? + function f() { console.log('I am inside!'); } + } + + f(); +}()); + +``` + +上面代码在ES5中运行,会得到“I am inside!”,但是在ES6中运行,会得到“I am outside!”。 + +## const命令 + +const也用来声明变量,但是声明的是常量。一旦声明,常量的值就不能改变。 + +```javascript + +const PI = 3.1415; +PI // 3.1415 + +PI = 3; +PI // 3.1415 + +const PI = 3.1; +PI // 3.1415 + +``` + +上面代码表明改变常量的值是不起作用的。需要注意的是,对常量重新赋值不会报错,只会默默地失败。 + +const的作用域与let命令相同:只在声明所在的块级作用域内有效。 + +```javascript + +if (condition) { + const MAX = 5; +} + +// 常量MAX在此处不可得 + +``` + +const声明的常量,也与let一样不可重复声明。 + +```javascript + +var message = "Hello!"; +let age = 25; + +// 以下两行都会报错 +const message = "Goodbye!"; +const age = 30; + +``` diff --git a/_site/docs/number.md b/_site/docs/number.md new file mode 100644 index 0000000..2eac533 --- /dev/null +++ b/_site/docs/number.md @@ -0,0 +1,88 @@ +# 数值的扩展 + +## 二进制和八进制表示法 + +ES6提供了二进制和八进制数值的新的写法,分别用前缀0b和0o表示。 + +```javascript + +0b111110111 === 503 // true +0o767 === 503 // true + +``` + +八进制用0o前缀表示的方法,将要取代已经在ES5中被逐步淘汰的加前缀0的写法。 + +## Number.isFinite(), Number.isNaN() + +ES6在Number对象上,新提供了Number.isFinite()和Number.isNaN()两个方法,用来检查Infinite和NaN这两个特殊值。 + +它们与传统的isFinite()和isNaN()的区别在于,传统方法先调用Number()将非数值的值转为数值,再进行判断,而这两个新方法只对数值有效,非数值一律返回false。 + +```javascript + +isFinite(25) // true +isFinite("25") // true +Number.isFinite(25) // true +Number.isFinite("25") // false + +isNaN(NaN) // true +isNaN("NaN") // true +Number.isNaN(NaN) // true +Number.isNaN("NaN") // false + +``` + +## Number.parseInt(), Number.parseFloat() + +ES6将全局方法parseInt()和parseFloat(),移植到Number对象上面,行为完全保持不变。 + +这样做的目的,是逐步减少全局性方法,使得语言逐步模块化。 + +## Number.isInteger()和安全整数 + +Number.isInteger()用来判断一个值是否为整数。需要注意的是,在JavaScript内部,整数和浮点数是同样的储存方法,所以3和3.0被视为同一个值。 + +```javascript + +Number.isInteger(25) // true +Number.isInteger(25.0) // true +Number.isInteger(25.1) // false + +``` + +JavaScript能够准确表示的整数范围在-2ˆ53 and 2ˆ53之间。ES6引入了Number.MAX_SAFE_INTEGER和Number.MIN_SAFE_INTEGER这两个常量,用来表示这个范围的上下限。Number.isSafeInteger()则是用来判断一个整数是否落在这个范围之内。 + +```javascript + +var inside = Number.MAX_SAFE_INTEGER; +var outside = inside + 1; + +Number.isInteger(inside) // true +Number.isSafeInteger(inside) // true + +Number.isInteger(outside) // true +Number.isSafeInteger(outside) // false + +``` + +## Math对象的扩展 + +ES6在Math对象上提供了更多的数学方法。 + +- Math.acosh(x) 返回x的反双曲余弦(inverse hyperbolic cosine) +- Math.asinh(x) 返回x的反双曲正弦(inverse hyperbolic sine) +- Math.atanh(x) 返回x的反双曲正切(inverse hyperbolic tangent) +- Math.cbrt(x) 返回x的立方根 +- Math.clz32(x) 返回x的32位二进制整数表示形式的前导0的个数 +- Math.cosh(x) 返回x的双曲余弦(hyperbolic cosine) +- Math.expm1(x) 返回eˆx - 1 +- Math.fround(x) 返回x的单精度浮点数形式 +- Math.hypot(...values) 返回所有参数的平方的和的平方根 +- Math.imul(x, y) 返回两个参数以32位整数形式相乘的结果 +- Math.log1p(x) 返回1 + x的自然对数 +- Math.log10(x) 返回以10为底的x的对数 +- Math.log2(x) 返回以2为底的x的对数 +- Math.sign(x) 如果x为负返回-1,x为0返回0,x为正返回1 +- Math.tanh(x) 返回x的双曲正切(hyperbolic tangent) +- Math.trunc(x) 移除一个浮点数的小数位,返回一个整数 diff --git a/_site/docs/object.md b/_site/docs/object.md new file mode 100644 index 0000000..12ba8c0 --- /dev/null +++ b/_site/docs/object.md @@ -0,0 +1,219 @@ +# 对象和函数的扩展 + +## Object.is() + +Object.is()用来比较两个值是否严格相等。它与严格比较运算符(===)的行为基本一致,不同之处只有两个:一是+0不等于-0,二是NaN等于自身。 + +```javascript + ++0 === -0 //true +NaN === NaN // false + +Object.is(+0, -0) // false +Object.is(NaN, NaN) // true + +``` + +## __proto__属性 + +ES6正式将__proto__属性写入了标准,用来指定对象的prototype对象。 + +```javascript + +var obj = { + __proto__: someOtherObj, + method: function() { ... } +} + +``` + +有了这个属性,实际上已经不需要通过Object.create()来生成新对象了。 + +## 增强的对象写法 + +ES6允许直接写入变量和函数,作为对象的属性和方法。这样的书写更加简洁。 + +```javascript + +var Person = { + + name: '张三', + + //等同于birth: birth + birth, + + // 等同于hello: function ()... + hello() { console.log('我的名字是', this.name); } + +}; + +``` + +## 属性名表达式 + +ES6允许表达式作为对象的属性名,在写法上要把表达式放在大括号内。 + +```javascript + +var lastWord = "last word"; + +var a = { + "first word": "hello", + [lastWord]: "world" +}; + +a["first word"] // "hello" +a[lastWord] // "world" +a["last word"] // "world" + +``` + +上面代码中,对象a的属性名lastWord是一个变量。 + +下面是一个将字符串的加法表达式作为属性名的例子。 + +```javascript + +var suffix = " word"; + +var a = { + ["first" + suffix]: "hello", + ["last" + suffix]: "world" +}; + +a["first word"] // "hello" +a["last word"] // "world" + +``` + +## symbols + +ES6引入了一种新的原始数据类型symbol。它通过Symbol函数生成。 + +```javascript + +var mySymbol = Symbol('Test'); + +mySymbol.name +// Test + +typeof mySymbol +// "symbol" + +``` + +上面代码表示,Symbol函数接受一个字符串作为参数,用来指定生成的symbol的名称,可以通过name属性读取。typeof运算符的结果,表明Symbol是一种单独的数据类型。 + +注意,Symbol函数前不能使用new命令,否则会报错。这是因为生成的symbol是一个原始类型的值,不是对象。 + +symbol的最大特点,就是每一个symbol都是不相等的,保证产生一个独一无二的值。 + +```javascript + +let red = Symbol(); +let green = Symbol(); +let blue = Symbol(); + +function handleColor(color) { + switch (color) { + case red: + ... + case green: + ... + case blue: + ... + } +} + +``` + +上面代码中,red、green、blue三个变量都是Symbol类型,它们的值是不相等的。 + +由于这种特点,Symbol类型适合作为标识符,用于对象的属性名,保证了属性名之间不会发生冲突。如果一个对象由多个模块构成,不会出现同名的属性。 + +```javascript + +var a = {}; +var mySymbol = Symbol(); + +a[mySymbol] = 'Hello!'; + +//另一种写法 +Object.defineProperty(a, mySymbol, { value: 'Hello!' }); + +``` + +上面代码通过点结构和Object.defineProperty两种方法,为对象增加一个属性。 + +下面的写法为Map结构添加了一个成员,但是该成员永远无法被引用。 + +```javascript + +let a = Map(); +a.set(Symbol(), 'Noise'); +a.size // 1 + +``` + +如果要在对象内部使用symbol属性名,必须采用属性名表达式。 + +```javascript + +let specialMethod = Symbol(); + +let obj = { + [specialMethod]: function (arg) { + ... + } +}; + +obj[specialMethod](123); + +``` + +## Proxy + +所谓Proxy,可以理解成在目标对象之前,架设一层“拦截”,外界对该对象的访问,都必须先通过这层拦截,可以被过滤和改写。 + +ES6原生提供Proxy构造函数,用来生成proxy实例对象。 + +```javascript + +var proxy = new Proxy({}, { + get: function(target, property) { + return 35; + } +}); + +proxy.time // 35 +proxy.name // 35 +proxy.title // 35 + +``` + +上面代码就是Proxy构造函数使用实例,它接受两个参数,第一个所要代理的目标对象(上例是一个空对象),第二个是拦截函数,它有一个get方法,用来拦截对目标对象的访问请求。get方法的两个参数分别是目标对象和所要访问的属性。可以看到,由于拦截函数总是返回35,所以访问任何属性都得到35。 + +下面是另一个拦截函数的例子。 + +```javascript + +var person = { + name: "张三" +}; + +var proxy = new Proxy(target, { + get: function(target, property) { + if (property in target) { + return target[property]; + } else { + throw new ReferenceError("Property \"" + property + "\" does not exist."); + } + } +}); + +proxy.name // "张三" +proxy.age // 抛出一个错误 + +``` + +上面代码表示,如果访问目标对象不存在的属性,会抛出一个错误。如果没有这个拦截函数,访问不存在的属性,只会返回undefined。 diff --git a/_site/docs/promise.md b/_site/docs/promise.md new file mode 100644 index 0000000..259a3a3 --- /dev/null +++ b/_site/docs/promise.md @@ -0,0 +1,165 @@ +# Promise对象 + +## 基本用法 + +ES6原生提供了Promise对象。所谓Promise对象,就是代表了未来某个将要发生的事件(通常是一个异步操作)。它的好处在于,有了Promise对象,就可以将异步操作以同步操作的流程表达出来,避免了层层嵌套的回调函数。此外,Promise对象还提供了一整套完整的接口,使得可以更加容易地控制异步操作。Promise对象的概念的详细解释,请参考[《JavaScript标准参考教程》](http://javascript.ruanyifeng.com/)。 + +ES6的Promise对象是一个构造函数,用来生成Promise实例。下面是Promise对象的基本用法。 + +```javascript + +var promise = new Promise(function(resolve, reject) { + if (/* 异步操作成功 */){ + resolve(value); + } else { + reject(error); + } +}); + +promise.then(function(value) { + // success +}, function(value) { + // failure +}); + +``` + +上面代码表示,Promise构造函数接受一个函数作为参数,该函数的两个参数分别是resolve方法和reject方法。如果异步操作成功,则用resolve方法将Promise对象的状态变为“成功”(即从pending变为resolved);如果异步操作失败,则用reject方法将状态变为“失败”(即从pending变为rejected)。 + +promise实例生成以后,可以用then方法分别指定resolve方法和reject方法的回调函数。 + +下面是一个用Promise对象实现的Ajax操作的例子。 + +```javascript + +var getJSON = function(url) { + var promise = new Promise(function(resolve, reject){ + var client = new XMLHttpRequest(); + client.open("GET", url); + client.onreadystatechange = handler; + client.responseType = "json"; + client.setRequestHeader("Accept", "application/json"); + client.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { resolve(this.response); } + else { reject(this); } + } + }; + }); + + return promise; +}; + +getJSON("/posts.json").then(function(json) { + // continue +}, function(error) { + // handle errors +}); + +``` + +## 链式操作 + +then方法返回的是一个新的Promise对象,因此可以采用链式写法。 + +```javascript + +getJSON("/posts.json").then(function(json) { + return json.post; +}).then(function(post) { + // proceed +}); + +``` + +上面的代码使用then方法,依次指定了两个回调函数。第一个回调函数完成以后,会将返回结果作为参数,传入第二个回调函数。 + +如果前一个回调函数返回的是Promise对象,这时后一个回调函数就会等待该Promise对象有了运行结果,才会进一步调用。 + +```javascript + +getJSON("/post/1.json").then(function(post) { + return getJSON(post.commentURL); +}).then(function(comments) { + // 对comments进行处理 +}); + +``` + +这种设计使得嵌套的异步操作,可以被很容易得改写,从回调函数的“横向发展”改为“向下发展”。 + +## catch方法:捕捉错误 + +catch方法是then(null, rejection)的别名,用于指定发生错误时的回调函数。 + +```javascript + +getJSON("/posts.json").then(function(posts) { + // some code +}).catch(function(error) { + // 处理前一个回调函数运行时发生的错误 +}); + +``` + +Promise对象的错误具有“冒泡”性质,会一直向后传递,直到被捕获为止。 + +```javascript + +getJSON("/post/1.json").then(function(post) { + return getJSON(post.commentURL); +}).then(function(comments) { + // some code +}).catch(function(error) { + // 处理前两个回调函数的错误 +}); + +``` + +## Promise.all方法 + +Promise.all方法用于将多个异步操作(或Promise对象),包装成一个新的Promise对象。当这些异步操作都完成后,新的Promise对象的状态才会变为fulfilled;只要其中一个异步操作失败,新的Promise对象的状态就会变为rejected。 + +```javascript + +// 生成一个promise对象的数组 +var promises = [2, 3, 5, 7, 11, 13].map(function(id){ + return getJSON("/post/" + id + ".json"); +}); + +Promise.all(promises).then(function(posts) { + // ... +}).catch(function(reason){ + // ... +}); + +``` + +## Promise.resolve方法 + +有时需要将现有对象转为Promise对象,Promise.resolve方法就起到这个作用。 + +```javascript + +var jsPromise = Promise.resolve($.ajax('/whatever.json')); + +``` + +上面代码将jQuery生成deferred对象,转为一个新的ES6的Promise对象。 + +如果Promise.resolve方法的参数,不是具有then方法的对象(又称thenable对象),则返回一个新的Promise对象,且它的状态为resolved。 + +```javascript + +var p = Promise.resolve('Hello'); + +p.then(function (s){ + console.log(s) +}); +// Hello + +``` + +上面代码生成一个新的Promise对象,它的状态为fulfilled,所以回调函数会立即执行,Promise.resolve方法的参数就是回调函数的参数。 diff --git a/_site/docs/reference.md b/_site/docs/reference.md new file mode 100644 index 0000000..0c204b8 --- /dev/null +++ b/_site/docs/reference.md @@ -0,0 +1,37 @@ +# 参考链接 + +## 综合介绍 + +- Sayanee Basu, [Use ECMAScript 6 Today](http://net.tutsplus.com/articles/news/ecmascript-6-today/) +- Ariya Hidayat, [Toward Modern Web Apps with ECMAScript 6](http://www.sencha.com/blog/toward-modern-web-apps-with-ecmascript-6/) +- Dale Schouten, [10 Ecmascript-6 tricks you can perform right now](http://html5hub.com/10-ecmascript-6-tricks-you-can-perform-right-now/) +- Domenic Denicola, [ES6: The Awesome Parts](http://www.slideshare.net/domenicdenicola/es6-the-awesome-parts) +- Nicholas C. Zakas, [Understanding ECMAScript 6](https://github.com/nzakas/understandinges6) +- Justin Drake, [ECMAScript 6 in Node.JS](https://github.com/JustinDrake/node-es6-examples) +- Ryan Dao, [Summary of ECMAScript 6 major features](http://ryandao.net/portal/content/summary-ecmascript-6-major-features) +- Luke Hoban, [ES6 features](https://github.com/lukehoban/es6features) + +## 语法点 + +- Nick Fitzgerald, [Destructuring Assignment in ECMAScript 6](http://fitzgeraldnick.com/weblog/50/) +- Nicholas C. Zakas, [Understanding ECMAScript 6 arrow functions](http://www.nczonline.net/blog/2013/09/10/understanding-ecmascript-6-arrow-functions/) +- Jack Franklin, [Real Life ES6 - Arrow Functions](http://javascriptplayground.com/blog/2014/04/real-life-es6-arrow-fn/) +- Axel Rauschmayer, [Handling required parameters in ECMAScript 6](http://www.2ality.com/2014/04/required-parameters-es6.html) +- Nicholas C. Zakas, [Creating defensive objects with ES6 proxies](http://www.nczonline.net/blog/2014/04/22/creating-defensive-objects-with-es6-proxies/) + +## Generator + +- Mozilla Developer Network, [Iterators and generators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators) +- Matt Baker, [Replacing callbacks with ES6 Generators](http://flippinawesome.org/2014/02/10/replacing-callbacks-with-es6-generators/) +- Steven Sanderson, [Experiments with Koa and JavaScript Generators](http://blog.stevensanderson.com/2013/12/21/experiments-with-koa-and-javascript-generators/) +- jmar777, [What's the Big Deal with Generators?](http://devsmash.com/blog/whats-the-big-deal-with-generators) + +## Promise对象 + +- Jake Archibald, [JavaScript Promises: There and back again](http://www.html5rocks.com/en/tutorials/es6/promises/) +- Tilde, [rsvp.js](https://github.com/tildeio/rsvp.js) + +## 工具 + +- Casper Beyer, [ECMAScript 6 Features and Tools](http://caspervonb.github.io/2014/03/05/ecmascript6-features-and-tools.html) +- Stoyan Stefanov, [Writing ES6 today with jstransform](http://www.phpied.com/writing-es6-today-with-jstransform/) diff --git a/_site/docs/set-map.md b/_site/docs/set-map.md new file mode 100644 index 0000000..26f1ad4 --- /dev/null +++ b/_site/docs/set-map.md @@ -0,0 +1,270 @@ +# Set和Map数据结构 + +## Set + +ES6提供了新的数据结构Set。它类似于数组,但是成员的值都是唯一的,没有重复的值。 + +Set本身是一个构造函数,用来生成Set数据结构。 + +```javascript + +var s = new Set(); + +[2,3,5,4,5,2,2].map(x => s.add(x)) + +for (i of s) {console.log(i)} +// 2 3 4 5 + +``` + +上面代码通过add方法向Set结构加入成员,结果表明set结构不会添加重复的值。 + +Set函数接受一个数组作为参数,用来初始化。 + +```javascript + +var items = new Set([1,2,3,4,5,5,5,5]); + +items.size() +// 5 + +``` + +向Set加入值的时候,不会发生类型转换。这意味在Set中,5和“5”是两个不同的值。 + +set数据结构有以下方法。 + +- size():返回成员总数。 +- add(value):添加某个值。 +- delete(value):删除某个值。 +- has(value):返回一个布尔值,表示该值是否为set的成员。 +- clear():清除所有成员。 + +下面是这些属性和方法的使用演示。 + +```javascript + +s.add(1).add(2).add(2); +// 注意2被加入了两次 + +s.size() // 2 + +s.has(1) // true +s.has(2) // true +s.has(3) // false + +s.delete(2); +s.has(2) // false + +``` + +下面是一个对比,看看在判断是否包括一个键上面,对象和Set的写法不同。 + +```javascript + +// 对象的写法 + +var properties = { + "width": 1, + "height": 1 +}; + +if (properties[someName]) { + // do something +} + +// Set的写法 + +var properties = new Set(); + +properties.add("width"); +properties.add("height"); + +if (properties.has(someName)) { + // do something +} + +``` + +Array.from方法可以将Set结构转为数组。 + +```javascript + +var items = new Set([1, 2, 3, 4, 5]); +var array = Array.from(items); + +``` + +这就提供了一种去除数组中重复元素的方法。 + +```javascript + +function dedupe(array) { + return Array.from(new Set(array)); +} + +``` + +## Map + +JavaScript的对象,本质上是键值对的集合,但是只能用字符串当作键。这给它的使用带来了很大的限制。 + +```javascript + +var data = {}; +var element = document.getElementById("myDiv"); + +data[element] = metadata; + +``` + +上面代码原意是将一个DOM节点作为对象data的键,但是由于对象只接受字符串作为键名,所以element被自动转为字符串“[Object HTMLDivElement]”。 + +为了解决这个问题,ES6提供了map数据结构。它类似于对象,也是键值对的集合,但是“键”的范围不限于字符串,对象也可以当作键。 + +```javascript + +var m = new Map(); + +o = {p: "Hello World"}; + +m.set(o, "content") + +console.log(m.get(o)) +// "content" + +``` + +上面代码将对象o当作m的一个键。 + +Map函数也可以接受一个数组进行初始化。 + +```javascript + +var map = new Map([ ["name", "张三"], ["title", "Author"]]); + +map.size // 2 +map.has("name") // true +map.get("name") // "张三" +map.has("title") // true +map.get("title") // "Author" + +``` + +Map数据结构有以下属性和方法。 + +- size:返回成员总数。 +- set(key, value):设置一个键值对。 +- get(key):读取一个键。 +- has(key):返回一个布尔值,表示某个键是否在Map数据结构中。 +- delete(key):删除某个键。 +- clear():清除所有成员。 +- keys():返回键名的遍历器。 +- values():返回键值的遍历器。 +- entries():返回所有成员的遍历器。 + +下面是一些用法实例。 + +```javascript + +var m = new Map(); + +m.set("edition", 6) // 键是字符串 +m.set(262, "standard") // 键是数值 +m.set(undefined, "nah") // 键是undefined + +var hello = function() {console.log("hello");} +m.set(hello, "Hello ES6!") // 键是函数 + +m.has("edition") // true +m.has("years") // false +m.has(262) // true +m.has(undefined) // true +m.has(hello) // true + +m.delete(undefined) +m.has(undefined) // false + +m.get(hello) // Hello ES6! +m.get("edition") // 6 + +``` + +运用Map结构原生提供的三个遍历器,可以遍历所有成员。 + +```javascript + +for (let key of map.keys()) { + console.log("Key: %s", key); +} + +for (let value of map.values()) { + console.log("Value: %s", value); +} + +for (let item of map.entries()) { + console.log("Key: %s, Value: %s", item[0], item[1]); +} + +// same as using map.entries() +for (let item of map) { + console.log("Key: %s, Value: %s", item[0], item[1]); +} + +``` + +Map结构还有一个forEach方法,与数组的forEach方法类似,也可以实现遍历。 + +```javascript + +map.forEach(function(value, key, map)) { + console.log("Key: %s, Value: %s", key, value); +}); + +``` + +forEach方法还可以接受第二个参数,用来绑定this。 + +```javascript + +var reporter = { + report: function(key, value) { + console.log("Key: %s, Value: %s", key, value); + } +}; + +map.forEach(function(value, key, map) { + this.report(key, value); +}, reporter); + +``` + +上面代码中,forEach方法的回调函数的this,就指向reporter。 + +## WeakMap + +WeakMap结构与Map结构基本类似,唯一的区别是它只接受对象作为键名(null除外),不接受原始类型的值作为键名。 + +WeakMap的设计目的在于,键名是对象的弱引用(垃圾回收机制不将该引用考虑在内),所以其所对应的对象可能会被自动回收。当对象被回收后,WeakMap自动移除对应的键值对。典型应用是,一个对应DOM元素的WeakMap结构,当某个DOM元素被清除,其所对应的WeakMap记录就会自动被移除。基本上,WeakMap的专用场合就是,它的键所对应的对象,可能会在将来消失。 + +下面是WeakMap结构的一个例子,可以看到用法上与Map几乎一样。 + +```javascript + +var map = new WeakMap(); +var element = document.querySelector(".element"); + +map.set(element, "Original"); + +var value = map.get(element); +console.log(value); // "Original" + +element.parentNode.removeChild(element); +element = null; + +value = map.get(element); +console.log(value); // undefined + +``` + +WeakMap还有has和delete方法,但没有size方法,也无法遍历它的值,这与WeakMap的键被垃圾回收机制忽略有关。 diff --git a/_site/docs/string.md b/_site/docs/string.md new file mode 100644 index 0000000..b65eed2 --- /dev/null +++ b/_site/docs/string.md @@ -0,0 +1,249 @@ +# 字符串的扩展 + +ES6加强了对Unicode的支持,并且扩展了字符串对象。 + +## codePointAt方法 + +JavaScript内部,字符以UTF-16的格式储存,每个字符固定为16字节。对于那些需要4个字节储存的字符(Unicode编号大于0xFFFF的字符),JavaScript会认为它们是两个字符。 + +```javascript + +var s = "𠮷"; + +s.length // 2 +s.charAt(0) // '' +s.charAt(1) // '' +s.charCodeAt(0) // 55362 +s.charCodeAt(1) // 57271 + +``` + +上面代码说明,对于4个字节储存的字符,JavaScript不能正确处理。 + +ES6提供了codePointAt方法,能够正确处理4个字节储存的字符,返回一个字符的Unicode编号。, + +```javascript + +var s = "𠮷a"; + +s.codePointAt(0) // 134071 +s.codePointAt(1) // 97 + +s.charCodeAt(2) // 97 + +``` + +上面代码说明,codePointAt方法的参数是,字符在字符串中的位置。对于两个字节储存的字符,它的返回结果与charCodeAt方法相同。 + +该方法是测试一个字符由两个字节还是由四个字节组成的最简单方法。 + +```javascript + +function is32Bit(c) { + return c.codePointAt(0) > 0xFFFF; +} + +is32Bit("𠮷") // true +is32Bit("a") // false + +``` + +## String.fromCodePoint方法 + +该方法用于从Unicode编号返回对应的字符串,作用与codePointAt正好相反。 + +```javascript + +String.fromCodePoint(134071) // "𠮷" + +``` + +注意,fromCodePoint方法定义在String对象上,而codePointAt方法定义在字符串的实例对象上。 + +## 字符的Unicode表示法 + +JavaScript允许采用“\uxxxx”形式表示一个字符,其中“xxxx”表示字符的Unicode编号。 + +```javascript + +"\u0061" +// "a" + +``` + +但是,这种表示法只限于\u0000——\uFFFF之间的字符。超出这个范围的字符,必须写成两个字节的形式。 + +```javascript + +"\uD842\uDFB7" +// "𠮷" + +"\u20BB7" +// " 7" + +``` + +上面代码表示,如果直接在“\u”后面跟上超过0xFFFF的数值,JavaScript会理解成“\u20BB+7”。 + +ES6对这一点做出了改进,只要将超过0xFFFF的编号放入大括号,就能正确解读该字符。 + +```javascript + +"\u{20BB7}" +// " 7" + +``` + +## 正则表达式的u修饰符 + +ES6对正则表达式添加了u修饰符,用来正确处理大于\uFFFF的Unicode字符。 + +```javascript + +var s = "𠮷"; + +/^.$/.test(s) // false +/^.$/u.test(s) // true + +``` + +上面代码表示,如果不添加u修饰符,正则表达式就会认为字符串为两个字符,从而匹配失败。 + +利用这一点,可以写出一个正确返回字符串长度的函数。 + +```javascript + +function codePointLength(text) { + var result = text.match(/[\s\S]/gu); + return result ? result.length : 0; +} + +var s = "𠮷𠮷"; + +s.length // 4 +codePointLength(s) // 2 + +``` + +## contains(), startsWith(), endsWith() + +传统上,JavaScript只有indexOf方法,可以用来确定一个字符串是否包含在另一个字符串中。ES6又提供了三种新方法。 + +- **contains()**:返回布尔值,表示是否找到了参数字符串。 +- **startsWith()**:返回布尔值,表示参数字符串是否在源字符串的头部。 +- **endsWith()**:返回布尔值,表示参数字符串是否在源字符串的尾部。 + +```javascript + +var s = "Hello world!"; + +s.startsWith("Hello") // true +s.endsWith("!") // true +s.contains("o") // true + +``` + +这三个方法都支持第二个参数,表示开始搜索的位置。 + +```javascript + +var s = "Hello world!"; + +s.startsWith("o", 4) // true +s.endsWith("o", 8) // true +s.contains("o", 8) // false + +``` + +上面代码表示,使用第二个参数n时,endsWith的行为与其他两个方法有所不同。它针对前n个字符,而其他两个方法针对从第n个位置直到字符串结束。 + +## repeat() + +repeat()返回一个新字符串,表示将原字符串重复n次。 + +```javascript + +"x".repeat(3) // "xxx" +"hello".repeat(2) // "hellohello" + +``` + +## 正则表达式的y修饰符 + +除了u修饰符,ES6还为正则表达式添加了y修饰符,叫做“粘连”(sticky)修饰符。它的作用与g修饰符类似,也是全局匹配,后一次匹配都从上一次匹配成功的下一个位置开始,不同之处在于,g修饰符只确保剩余位置中存在匹配,而y修饰符确保匹配必须从剩余的第一个位置开始,这也就是“粘连”的涵义。 + +```javascript + +var s = "aaa_aa_a"; +var r1 = /a+/g; +var r2 = /a+/y; + +r1.exec(s) // ["aaa"] +r2.exec(s) // ["aaa"] + +r1.exec(s) // ["aa"] +r2.exec(s) // null + +``` + +上面代码有两个正则表达式,一个使用g修饰符,另一个使用y修饰符。这两个正则表达式各执行了两次,第一次执行的时候,两者行为相同,剩余字符串都是“_aa_a”。由于g修饰没有位置要求,所以第二次执行会返回结果,而y修饰符要求匹配必须从头部开始,所以返回null。 + +如果改一下正则表达式,保证每次都能头部匹配,y修饰符就会返回结果了。 + +```javascript + +var s = "aaa_aa_a"; +var r = /a+_/y; + +r.exec(s) // ["aaa_"] +r.exec(s) // ["aa_"] + +``` + +上面代码每次匹配,都是从剩余字符串的头部开始。 + +进一步说,y修饰符号隐含了头部匹配的标志ˆ。 + +```javascript + +/b/y.exec("aba") +// null + +``` + +上面代码由于不能保证头部匹配,所以返回null。y修饰符的设计本意,就是让头部匹配的标志ˆ在全局匹配中都有效。 + +与y修饰符相匹配,ES6的正则对象多了sticky属性,表示是否设置了y修饰符。 + +```javascript + +var r = /hello\d/y; +r.sticky // true + +``` + +## 模板字符串 + +模板字符串(template string)是增强版的字符串,用反引号(`)标识。它可以当作普通字符串使用,也可以用来定义多行字符串,或者在字符串中嵌入变量。 + +```javascript + +// 普通字符串 +`In JavaScript '\n' is a line-feed.` + +// 多行字符串 +`In JavaScript this is + not legal.` + +// 字符串中嵌入变量 +var name = "Bob", time = "today"; +`Hello ${name}, how are you ${time}?` + +var x = 1; +var y = 2; +console.log(`${ x } + ${ y } = ${ x + y}`) +// "1 + 2 = 3" + +``` + +上面代码表示,在模板字符串中嵌入变量,需要将变量名写在${}之中。 diff --git a/_site/favicon.ico b/_site/favicon.ico new file mode 100644 index 0000000..bb5d13b Binary files /dev/null and b/_site/favicon.ico differ diff --git a/_site/images/cover.jpg b/_site/images/cover.jpg new file mode 100755 index 0000000..3617628 Binary files /dev/null and b/_site/images/cover.jpg differ diff --git a/_site/images/cover_thumbnail.jpg b/_site/images/cover_thumbnail.jpg new file mode 100755 index 0000000..f4a93c5 Binary files /dev/null and b/_site/images/cover_thumbnail.jpg differ diff --git a/_site/index.html b/_site/index.html new file mode 100644 index 0000000..b9aacb1 --- /dev/null +++ b/_site/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + ECMAScript 6入门 + + + + + + +
    + +
    back to top
    +
    edit
    +
    Loading ...
    +
    Opps! ... File not found!
    + + + + + diff --git a/_site/js/ditto.js b/_site/js/ditto.js new file mode 100644 index 0000000..4f190c1 --- /dev/null +++ b/_site/js/ditto.js @@ -0,0 +1,234 @@ +var ditto = { + // page element ids + content_id: "#content", + sidebar_id: "#sidebar", + edit_id: "#edit", + back_to_top_id: "#back_to_top", + loading_id: "#loading", + error_id: "#error", + + // display elements + sidebar: true, + edit_button: true, + back_to_top_button: true, + + // initialize function + run: initialize +}; + +var disqusCode = '

    留言

    '; + +function initialize() { + // initialize sidebar and buttons + if (ditto.sidebar) { + init_sidebar_section(); + } + + if (ditto.back_to_top_button) { + init_back_to_top_button(); + } + + if (ditto.edit_button) { + init_edit_button(); + } + + // page router + router(); + $(window).on('hashchange', router); +} + +function init_sidebar_section() { + $.get(ditto.sidebar_file, function(data) { + $(ditto.sidebar_id).html(marked(data)); + }, "text").fail(function() { + alert("Opps! can't find the sidebar file to display!"); + }); + +} + +function init_back_to_top_button() { + $(ditto.back_to_top_id).show(); + $(ditto.back_to_top_id).on("click", function() { + $("html body").animate({ + scrollTop: 0 + }, 200); + }); +} + +function init_edit_button() { + if (ditto.base_url === null) { + alert("Error! You didn't set 'base_url' when calling ditto.run()!"); + + } else { + $(ditto.edit_id).show(); + $(ditto.edit_id).on("click", function() { + var hash = location.hash.replace("#", "/"); + + if (hash === "") { + hash = "/" + ditto.index.replace(".md", ""); + } + + window.open(ditto.base_url + hash + ".md"); + // open is better than redirecting, as the previous page history + // with redirect is a bit messed up + }); + } +} + +function replace_symbols(text) { + // replace symbols with underscore + return text.replace(/[&\/\\#,+=()$~%.'":*?<>{}\ \]\[]/g, "_"); +} + +function li_create_linkage(li_tag, header_level) { + // add custom id and class attributes + html_safe_tag = replace_symbols(li_tag.text()); + li_tag.attr("id", html_safe_tag); + li_tag.attr("class", "link"); + + // add click listener - on click scroll to relevant header section + $(ditto.content_id + " li#" + li_tag.attr("id")).click(function() { + // scroll to relevant section + var header = $( + ditto.content_id + " h" + header_level + "." + li_tag.attr("id") + ); + $('html, body').animate({ + scrollTop: header.offset().top + }, 200); + + // highlight the relevant section + original_color = header.css("color"); + header.animate({ color: "#ED1C24", }, 500, function() { + // revert back to orig color + $(this).animate({color: original_color}, 2500); + }); + }); +} + +function create_page_anchors() { + // create page anchors by matching li's to headers + // if there is a match, create click listeners + // and scroll to relevant sections + + // go through header level 1 to 3 + for (var i = 1; i <= 4; i++) { + // parse all headers + var headers = []; + $('#content h' + i).map(function() { + headers.push($(this).text()); + $(this).addClass(replace_symbols($(this).text())); + this.id = 'h'+i+'-'+replace_symbols($(this).text()); + }); + + if ((i === 2) && headers.length !== 0){ + var ul_tag = $('
      ') + .insertAfter('#content h1') + .addClass("content-toc") + .attr('id','content-toc'); + for (var j = 0; j < headers.length; j++) { + var li_tag = $('
    1. ').text(headers[j]); + ul_tag.append(li_tag); + li_create_linkage(li_tag, i); + } + } + } +} + +function normalize_paths() { + // images + $(ditto.content_id + " img").map(function() { + var src = $(this).attr("src").replace("./", ""); + if ($(this).attr("src").slice(0, 5) !== "http") { + var url = location.hash.replace("#", ""); + + // split and extract base dir + url = url.split("/"); + var base_dir = url.slice(0, url.length - 1).toString(); + + // normalize the path (i.e. make it absolute) + $(this).attr("src", base_dir + "/" + src); + } + }); + +} + +function show_error() { + console.log("SHOW ERORR!"); + $(ditto.error_id).show(); +} + +function show_loading() { + $(ditto.loading_id).show(); + $(ditto.content_id).html(""); // clear content + + // infinite loop until clearInterval() is called on loading + var loading = setInterval(function() { + $(ditto.loading_id).fadeIn(1000).fadeOut(1000); + }, 2000); + + return loading; +} + +function router() { + + var path = location.hash.replace("#", "./"); + + // default page if hash is empty + if (location.pathname === "/index.html") { + path = location.pathname.replace("index.html", ditto.index); + normalize_paths(); + } else if (path === "") { + path = window.location + ditto.index; + normalize_paths(); + } else { + path = path + ".md"; + } + + // otherwise get the markdown and render it + var loading = show_loading(); + $.get(path , function(data) { + $(ditto.error_id).hide(); + $(ditto.content_id).html(marked(data)+disqusCode); + if ($(ditto.content_id+" h1").text() === ditto.document_title){ + document.title = ditto.document_title; + } else { + document.title = $(ditto.content_id+" h1").text() + " - " + ditto.document_title; + } + normalize_paths(); + create_page_anchors(); + + // 完成代码高亮 + $('#content code').map(function() { + Prism.highlightElement(this); + }); + + // 加载disqus + (function () { + // http://docs.disqus.com/help/2/ + window.disqus_shortname = 'es6'; + window.disqus_identifier = (location.hash?location.hash.replace("#", ""):'READEME'); + window.disqus_title =$(ditto.content_id+" h1").text(); + window.disqus_url = 'http://es6.ruanyifeng.com/' + (location.hash?location.hash.replace("#", ""):'README'); + + // http://docs.disqus.com/developers/universal/ + (function() { + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + dsq.src = 'http://'+window.disqus_shortname+'.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); + })(); + })(); + + if(location.hash === ''){ + $('html, body').animate({ + scrollTop: $('#content').offset().top + }, 200); + } + + }).fail(function() { + show_error(); + + }).always(function() { + clearInterval(loading); + $(ditto.loading_id).hide(); + }); +} diff --git a/_site/js/marked.js b/_site/js/marked.js new file mode 100644 index 0000000..005b6f8 --- /dev/null +++ b/_site/js/marked.js @@ -0,0 +1 @@ +(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^/i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
      "+(escaped?code:escape(code,true))+"\n
      "}return'
      '+(escaped?code:escape(code,true))+"\n
      \n"};Renderer.prototype.blockquote=function(quote){return"
      \n"+quote+"
      \n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
      \n":"
      \n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
    2. "+text+"
    3. \n"};Renderer.prototype.paragraph=function(text){return"

      "+text+"

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

      "+escape(e.message+"",true)+"
      "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file diff --git a/_site/js/prism.js b/_site/js/prism.js new file mode 100644 index 0000000..b543fa4 --- /dev/null +++ b/_site/js/prism.js @@ -0,0 +1,7 @@ +var self=typeof window!="undefined"?window:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(/e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+""};if(!self.document){if(!self.addEventListener)return self.Prism;self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return self.Prism}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}return self.Prism}();typeof module!="undefined"&&module.exports&&(module.exports=Prism);; +Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});; +Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});; +Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};; +Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|get|set|new|with|typeof|try|throw|catch|finally|null|break|continue|this)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});; +Prism.languages.bash=Prism.languages.extend("clike",{comment:{pattern:/(^|[^"{\\])(#.*?(\r?\n|$))/g,lookbehind:!0},string:{pattern:/("|')(\\?[\s\S])*?\1/g,inside:{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^\}]+\})/g}},keyword:/\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/g});Prism.languages.insertBefore("bash","keyword",{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^}]+\})/g});Prism.languages.insertBefore("bash","comment",{important:/(^#!\s*\/bin\/bash)|(^#!\s*\/bin\/sh)/g});; +Prism.languages.http={"request-line":{pattern:/^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/g,inside:{property:/^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/g,"attr-name":/:\w+/g}},"response-status":{pattern:/^HTTP\/1.[01] [0-9]+.*/g,inside:{property:/[0-9]+[A-Z\s-]+$/g}},keyword:/^[\w-]+:(?=.+)/gm};var httpLanguages={"application/json":Prism.languages.javascript,"application/xml":Prism.languages.markup,"text/xml":Prism.languages.markup,"text/html":Prism.languages.markup};for(var contentType in httpLanguages)if(httpLanguages[contentType]){var options={};options[contentType]={pattern:new RegExp("(content-type:\\s*"+contentType+"[\\w\\W]*?)\\n\\n[\\w\\W]*","gi"),lookbehind:!0,inside:{rest:httpLanguages[contentType]}};Prism.languages.insertBefore("http","keyword",options)};; diff --git a/_site/sidebar.md b/_site/sidebar.md new file mode 100644 index 0000000..60bb19c --- /dev/null +++ b/_site/sidebar.md @@ -0,0 +1,27 @@ +# [ECMAScript 6 入门]() + +作者:[阮一峰](http://www.ruanyifeng.com) + +授权:
      署名-非商用许可证 + +## 目录 +1. [前言](#README) +1. [ECMAScript 6简介](#docs/intro) +1. [let和const命令](#docs/let) +1. [多变量的模式赋值](#docs/destructuring) +1. [数组推导](#docs/comprehension) +1. [字符串的扩展](#docs/string) +1. [数值的扩展](#docs/number) +1. [对象的扩展](#docs/object) +1. [函数的扩展](#docs/function) +1. [Set和Map数据结构](#docs/set-map) +1. [Iterator和for...of循环](#docs/iterator) +1. [Generator函数](#docs/generator) +1. [Promise对象](#docs/promise) +1. [Class和Module](#docs/class) +1. [参考链接](#docs/reference) + +## 其他 +- [源码](http://github.com/ruanyf/es6tutorial/) +- [修订历史](https://github.com/ruanyf/es6tutorial/commits/gh-pages) +- [反馈意见](https://github.com/ruanyf/es6tutorial/issues)