corejava第9版
This commit is contained in:
1 parent
a900ff96aa
commit
75e83a331f
1025 files changed
+121606
No files matched your search
@@ -0,0 +1,43 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules
|
||||
jspm_packages
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
#gitbook
|
||||
_book
|
||||
*.epub
|
||||
*.pdf
|
||||
*.mobi
|
||||
@@ -0,0 +1 @@
|
||||
grammar.codeyu.com
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 zhu yu
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,19 @@
|
||||
# 旋元佑进阶文法
|
||||
|
||||
﹝台﹞旋元佑 著
|
||||
|
||||
英文文法是英文写作必备的基础。写作牵涉到的问题可说千头万绪,小自用字、中间经过句子、大到文章组织,每一个环节都必须处理得当。在「听、说、读、写」的英文学习过程中,写作一向是最后、也最困难的一步。
|
||||
|
||||
英文文法探讨的对象是「句子」;学习文法的目的在于认识英文句子的构造与所有的变化、看懂最复杂的句子,进一步能够写出从单句到复合句到减化子句、清楚正确而又富有变化的各种英文句子。
|
||||
|
||||
这本文法书设定的目标就是「征服英文句子写作」。本书将带领读者,逐步打通英文句子写作的所有环节。英文单句中可能出现的一些元素,包括名词片语、动词片语、修饰语(形容词与副词,含介系词片语)等等,这些元素本书都将一一处理。尤其是写作时比较容易出错的地方,我们会不厌其烦地详加解说。处理名词片语这个元素时将一并处理到限定词的用法。处理动词片语时将一并处理到一些依赖动词来表现的变化,包括时态、语气(含助动词与假设法)、以及语态(主动与被动)等等。
|
||||
|
||||
写文章如果只用单句,这种写作风格因为缺乏句型变化而会显得不够成熟,表达能力也嫌不足。运用连接词结合两个以上的单句,可以构成合句(compound sentences)或者复句(complex sentences)。如果采用对等连接词如and, or, but之类来连接两个对等子句,构成的句子称为合句。合句在写作时最需要注意的是对称性的要求,还有就是合句中有重复的元素如果进行省略,要注意避免出错。这些要求在相关的章节本书都会一一处理。
|
||||
|
||||
复句则是由主要子句加从属子句而构成,采用从属连接词如that, because, which之类来连接。从属子句依其词类,可分为名词子句、副词子句,以及形容词子句(又称关系子句)。如果学习单句时基本句型架构建立得够扎实,那么结合单句来建构复句就不会有太大的困难。复句方面容易出的错误在于句型方面,尤其是关系子句,它和名词子句与副词子句之间有诸多的混淆点,本书都将一一厘清。
|
||||
|
||||
最后是最有挑战性的减化子句(reduced clauses)。所谓减化子句,涵盖了传统文法中所谓的非限定子句、分词构句、独立片语、同位格,以及非限定动词、动状词、动名词片语、不定词片语、现在分词片语、过去分词片语等各式各样的用语。减化子句是以复句为原料来进行减化(reduction),保留一个限定子句,但是压缩掉复句中所有重复与空洞的成分、制造出既简洁又清楚的浓缩句子。
|
||||
|
||||
减化子句既简洁又清楚,是修辞效果极佳的高级句型,但是减化子句非常容易出错。例如不当地省略从属子句的主词会产生出「悬荡修饰语」(dangling modifiers)的错误。这种错误就连专业的英美作家一不小心也会犯,各出版公司还得聘用专人来校稿、改正这方面的错误。常犯的减化子句错误我们也将在相关章节一一探讨。
|
||||
|
||||
读者如果依照本书的规划循序渐进,先搞清楚句子中的一些基本元素、再经过单句而建立起扎实的复合句架构,那么接下来采用本书独创的一些观念来建构减化子句将会是水到渠成的工作。在这个过程中,我们将特别加强说明每一个环节容易出现写作错误的地方,提醒读者注意。
|
||||
@@ -0,0 +1,39 @@
|
||||
# 旋元佑进阶文法
|
||||
|
||||
﹝台﹞旋元佑 著
|
||||
|
||||
* 目录
|
||||
* [前言](README.md)
|
||||
* [序: 我学英文的经验](docs/preface.md)
|
||||
* [引:广读学英语](docs/guide.md)
|
||||
* [第一章 基本句型](docs/SimpleSentences.md)
|
||||
* [第二章 名词片语](docs/NounPhrases.md)
|
||||
* [第三章 代名词](docs/Pronouns.md)
|
||||
* [第四章 形容词](docs/Adjective.md)
|
||||
* [第五章 副词](docs/Adverb.md)
|
||||
* [第六章 比较句法](docs/ComparativePattern.md)
|
||||
* [第七章 介系词](docs/Prepositions.md)
|
||||
* [第八章 分词](docs/Participles.md)
|
||||
* [第九章 动词时态](docs/VerbTenses.md)
|
||||
* [第十章 语态](docs/Voice.md)
|
||||
* [第十一章 语气助动词](docs/Auxiliaries.md)
|
||||
* [第十二章 语气](docs/Moods.md)
|
||||
* [第十三章 动名词](docs/Gerund.md)
|
||||
* [第十四章 不定词片语](docs/Infinitive.md)
|
||||
* [第十五章 对等连接词](docs/Conjunction.md)
|
||||
* [第十六章 合句](docs/CompoundSentences.md)
|
||||
* [第十七章 名词子句](docs/NounClauses.md)
|
||||
* [第十八章 副词子句](docs/AdverbClauses.md)
|
||||
* [第十九章 关系子句](docs/RelativeClauses.md)
|
||||
* [第二十章 主词动词一致性](docs/SubjectVerbAgreement.md)
|
||||
* [第二十一章 倒装句](docs/Inversion.md)
|
||||
* [第二十二章 减化子句](docs/ReducedClauses.md)
|
||||
* [第二十三章 关系从句减化](docs/RelativeClausesReduced.md)
|
||||
* [第二十四章 名词子句减化](docs/NounClausesReduced.md)
|
||||
* [第二十五章 副词子句减化](docs/AdverbClausesReduced.md)
|
||||
* [附录 台湾大陆术语比较](docs/terminology.md)
|
||||
|
||||
* 其他
|
||||
* [源码](https://github.com/codeyu/EnglishGrammarBook)
|
||||
* [修订历史](https://github.com/codeyu/EnglishGrammarBook/commits/master)
|
||||
* [反馈意见](https://github.com/codeyu/EnglishGrammarBook/issues)
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "marked",
|
||||
"homepage": "https://github.com/chjj/marked",
|
||||
"version": "0.3.2",
|
||||
"_release": "0.3.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.3.2",
|
||||
"commit": "43db549e31af5ff6e4a3b12e41a23513b9f88c99"
|
||||
},
|
||||
"_source": "git://github.com/chjj/marked.git",
|
||||
"_target": "~0.3.2",
|
||||
"_originalSource": "marked",
|
||||
"_direct": true
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
@@ -0,0 +1,2 @@
|
||||
.git*
|
||||
test/
|
||||
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
@@ -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.
|
||||
@@ -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
|
||||
@@ -0,0 +1,386 @@
|
||||
# marked
|
||||
|
||||
> A full-featured markdown parser and compiler, written in JavaScript. Built
|
||||
> for speed.
|
||||
|
||||
[][badge]
|
||||
|
||||
## Install
|
||||
|
||||
``` bash
|
||||
npm install marked --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Minimal usage:
|
||||
|
||||
```js
|
||||
var marked = require('marked');
|
||||
console.log(marked('I am using __markdown__.'));
|
||||
// Outputs: <p>I am using <strong>markdown</strong>.</p>
|
||||
```
|
||||
|
||||
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 '<h' + level + '><a name="' +
|
||||
escapedText +
|
||||
'" class="anchor" href="#' +
|
||||
escapedText +
|
||||
'"><span class="header-link"></span></a>' +
|
||||
text + '</h' + level + '>';
|
||||
},
|
||||
|
||||
console.log(marked('# heading+', { renderer: renderer }));
|
||||
```
|
||||
This code will output the following HTML:
|
||||
```html
|
||||
<h1>
|
||||
<a name="heading-" class="anchor" href="#heading-">
|
||||
<span class="header-link"></span>
|
||||
</a>
|
||||
heading+
|
||||
</h1>
|
||||
```
|
||||
|
||||
#### 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
|
||||
<p>hello world</p>
|
||||
```
|
||||
|
||||
## 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. `</legalese>`
|
||||
|
||||
## 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
|
||||
+187
@@ -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;
|
||||
}
|
||||
+10
@@ -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"
|
||||
}
|
||||
+426
@@ -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
|
||||
<ul>
|
||||
<li><p>item1</p>
|
||||
|
||||
<ul>
|
||||
<li>item2</li>
|
||||
</ul>
|
||||
|
||||
<p><p>text</p></li>
|
||||
</ul></p>
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
$ marked
|
||||
* item1
|
||||
|
||||
* item2
|
||||
|
||||
text
|
||||
^D
|
||||
<ul>
|
||||
<li><p>item1</p>
|
||||
<ul>
|
||||
<li>item2</li>
|
||||
</ul>
|
||||
<p>text</p>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<p><ul>
|
||||
<li>hello</p>
|
||||
|
||||
<blockquote>
|
||||
<p>world</li>
|
||||
</ul></p>
|
||||
</blockquote>
|
||||
```
|
||||
|
||||
```
|
||||
$ marked
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<ul>
|
||||
<li>hello<blockquote>
|
||||
<p>world</p>
|
||||
</blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Again, which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
* hello
|
||||
* world
|
||||
* hi
|
||||
code
|
||||
^D
|
||||
<ul>
|
||||
<li>hello
|
||||
<ul>
|
||||
<li>world</li>
|
||||
<li>hi
|
||||
code</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
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
|
||||
<ul>
|
||||
<li>hello
|
||||
<ul>
|
||||
<li>world</li>
|
||||
<li>hi
|
||||
code</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
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
|
||||
<ul>
|
||||
<li><p>item1</p>
|
||||
|
||||
<ul>
|
||||
<li>item2</li>
|
||||
</ul>
|
||||
|
||||
<p><p>text</p></li>
|
||||
</ul></p>
|
||||
```
|
||||
|
||||
Misnested tags.
|
||||
|
||||
|
||||
```
|
||||
$ marked
|
||||
* item1
|
||||
|
||||
* item2
|
||||
|
||||
text
|
||||
^D
|
||||
<ul>
|
||||
<li><p>item1</p>
|
||||
<ul>
|
||||
<li>item2</li>
|
||||
</ul>
|
||||
<p>text</p>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<p><ul>
|
||||
<li>hello</p>
|
||||
|
||||
<blockquote>
|
||||
<p>world</li>
|
||||
</ul></p>
|
||||
</blockquote>
|
||||
```
|
||||
|
||||
More misnested tags.
|
||||
|
||||
|
||||
```
|
||||
$ marked
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<ul>
|
||||
<li>hello<blockquote>
|
||||
<p>world</p>
|
||||
</blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Again, which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
# Why quality matters - Part 2
|
||||
|
||||
``` bash
|
||||
$ markdown.pl
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<p><ul>
|
||||
<li>hello</p>
|
||||
|
||||
<blockquote>
|
||||
<p>world</li>
|
||||
</ul></p>
|
||||
</blockquote>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ sundown # upskirt
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<ul>
|
||||
<li>hello
|
||||
> world</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<ul><li>hello <blockquote><p>world</p></blockquote></li></ul>
|
||||
```
|
||||
|
||||
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
|
||||
<ul>
|
||||
<li>hello
|
||||
var a = 1;</li>
|
||||
<li>world</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
* hello
|
||||
var a = 1;
|
||||
* world
|
||||
^D
|
||||
<ul><li>hello
|
||||
<pre>code>var a = 1;</code></pre></li>
|
||||
<li>world</li></ul>
|
||||
```
|
||||
|
||||
Which looks more reasonable? Why shouldn't code blocks be able to appear in
|
||||
list items in a sane way?
|
||||
|
||||
- - -
|
||||
|
||||
``` bash
|
||||
$ markdown.js
|
||||
<div>hello</div>
|
||||
|
||||
<span>hello</span>
|
||||
^D
|
||||
<p><div>hello</div></p>
|
||||
|
||||
<p><span>hello</span></p>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
<div>hello</div>
|
||||
|
||||
<span>hello</span>
|
||||
^D
|
||||
<div>hello</div>
|
||||
|
||||
|
||||
<p><span>hello</span>
|
||||
</p>
|
||||
```
|
||||
|
||||
- - -
|
||||
|
||||
See: https://github.com/evilstreak/markdown-js/issues/27
|
||||
|
||||
``` bash
|
||||
$ markdown.js
|
||||
[](/link)
|
||||
^D
|
||||
<p><a href="/image)](/link">](/link)
|
||||
^D
|
||||
<p><a href="/link"><img src="/image" alt="an image"></a>
|
||||
</p>
|
||||
```
|
||||
|
||||
- - -
|
||||
|
||||
See: https://github.com/evilstreak/markdown-js/issues/24
|
||||
|
||||
``` bash
|
||||
$ markdown.js
|
||||
> a
|
||||
|
||||
> b
|
||||
|
||||
> c
|
||||
^D
|
||||
<blockquote><p>a</p><p>bundefined> c</p></blockquote>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
> a
|
||||
|
||||
> b
|
||||
|
||||
> c
|
||||
^D
|
||||
<blockquote><p>a
|
||||
|
||||
</p></blockquote>
|
||||
<blockquote><p>b
|
||||
|
||||
</p></blockquote>
|
||||
<blockquote><p>c
|
||||
</p></blockquote>
|
||||
```
|
||||
|
||||
- - -
|
||||
|
||||
``` bash
|
||||
$ markdown.pl
|
||||
* hello
|
||||
* world
|
||||
how
|
||||
|
||||
are
|
||||
you
|
||||
|
||||
* today
|
||||
* hi
|
||||
^D
|
||||
<ul>
|
||||
<li><p>hello</p>
|
||||
|
||||
<ul>
|
||||
<li>world
|
||||
how</li>
|
||||
</ul>
|
||||
|
||||
<p>are
|
||||
you</p>
|
||||
|
||||
<ul>
|
||||
<li>today</li>
|
||||
</ul></li>
|
||||
<li>hi</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
* hello
|
||||
* world
|
||||
how
|
||||
|
||||
are
|
||||
you
|
||||
|
||||
* today
|
||||
* hi
|
||||
^D
|
||||
<ul>
|
||||
<li><p>hello</p>
|
||||
<ul>
|
||||
<li><p>world
|
||||
how</p>
|
||||
<p>are
|
||||
you</p>
|
||||
</li>
|
||||
<li><p>today</p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>hi</li>
|
||||
</ul>
|
||||
```
|
||||
@@ -0,0 +1,2 @@
|
||||
# Todo
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./lib/marked');
|
||||
+1266
File diff suppressed because it is too large.
Load diff
+88
@@ -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<output>\fP] [\-i \fI<input>\fP] [\-\-help]
|
||||
[\-\-tokens] [\-\-pedantic] [\-\-gfm]
|
||||
[\-\-breaks] [\-\-tables] [\-\-sanitize]
|
||||
[\-\-smart\-lists] [\-\-lang\-prefix \fI<prefix>\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)
|
||||
+22
@@ -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" }
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
In this directory:
|
||||
|
||||
#
|
||||
# MarkdownTester -- Run tests for Markdown implementations
|
||||
#
|
||||
# Copyright (c) 2004-2005 John Gruber
|
||||
# <http://daringfireball.net/projects/markdown/>
|
||||
#
|
||||
|
||||
Partially modified for testing purposes.
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<!doctype html>
|
||||
<title>marked tests</title>
|
||||
<p>testing...</p>
|
||||
<script src="marked.js"></script>
|
||||
<script src="test.js"></script>
|
||||
+41
@@ -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);
|
||||
+62
@@ -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 += '<pre>' + escape(text) + '</pre>';
|
||||
};
|
||||
|
||||
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, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
(__MAIN__)();
|
||||
|
||||
}).call(this);
|
||||
+543
@@ -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 + '</' + h + '>';
|
||||
});
|
||||
|
||||
fs.writeFileSync(file, html);
|
||||
});
|
||||
|
||||
// turn <hr /> into <hr>
|
||||
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;
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
<p>hello world
|
||||
<a href="http://example.com">http://example.com</a>
|
||||
</p>
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
hello world
|
||||
<http://example.com>
|
||||
corejava第9版/EnglishGrammarBook-master/app/bower_components/marked/test/new/blockquote_list_item.html
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
<p>This fails in markdown.pl and upskirt:</p>
|
||||
|
||||
<ul><li>hello<blockquote><p>world</p></blockquote></li></ul>
|
||||
corejava第9版/EnglishGrammarBook-master/app/bower_components/marked/test/new/blockquote_list_item.text
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
This fails in markdown.pl and upskirt:
|
||||
|
||||
* hello
|
||||
> world
|
||||
+1
@@ -0,0 +1 @@
|
||||
<p><a href="/url">hi</a></p>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[hi]
|
||||
|
||||
[HI]: /url
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<blockquote>
|
||||
<p>hello
|
||||
[1]: hello</p>
|
||||
</blockquote>
|
||||
|
||||
<hr>
|
||||
|
||||
<blockquote>
|
||||
<p>hello</p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<ul>
|
||||
<li>hello</li>
|
||||
<li>[3]: hello</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<ul>
|
||||
<li>hello</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<blockquote>
|
||||
<p>foo
|
||||
bar
|
||||
bar</p>
|
||||
</blockquote>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
> hello
|
||||
> [1]: hello
|
||||
|
||||
* * *
|
||||
|
||||
> hello
|
||||
[2]: hello
|
||||
|
||||
|
||||
* hello
|
||||
* [3]: hello
|
||||
|
||||
|
||||
* hello
|
||||
[4]: hello
|
||||
|
||||
|
||||
> foo
|
||||
> bar
|
||||
[1]: foo
|
||||
> bar
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
<p>Already linked: <a href="http://example.com/">http://example.com/</a>.</p>
|
||||
|
||||
<p>Already linked: <a href="http://example.com/">http://example.com/</a>.</p>
|
||||
|
||||
<p>Already linked: <a href="http://example.com/"><strong>http://example.com/</strong></a>.</p>
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
<p>Already linked: <a href="http://example.com/">http://example.com/</a>.</p>
|
||||
|
||||
Already linked: [http://example.com/](http://example.com/).
|
||||
|
||||
Already linked: <a href="http://example.com/">**http://example.com/**</a>.
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<p>></p>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
\>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<p>Look at the<br>pretty line<br>breaks.</p>
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
Look at the
|
||||
pretty line
|
||||
breaks.
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<pre><code class="lang-js">var a = 'hello';
|
||||
console.log(a + ' world');</code></pre>
|
||||
<pre><code class="lang-bash">echo "hello, ${WORLD}"</code></pre>
|
||||
<pre><code class="lang-longfence">Q: What do you call a tall person who sells stolen goods?</code></pre>
|
||||
<pre><code class="lang-ManyTildes">A longfence!</code></pre>
|
||||
+16
@@ -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!
|
||||
~~~~~~~~~~
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
<h2 id="foo">foo</h2>
|
||||
<ol>
|
||||
<li><p>bar:</p>
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>one<ul>
|
||||
<li>two<ul>
|
||||
<li>three</li>
|
||||
<li>four</li>
|
||||
<li>five</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</li>
|
||||
<li><p>foo:</p>
|
||||
<pre><code> line 1
|
||||
line 2</code></pre>
|
||||
</li>
|
||||
<li><p>foo:</p>
|
||||
<ol>
|
||||
<li><p>foo <code>bar</code> bar:</p>
|
||||
<pre><code class="lang-erb"> some code here
|
||||
</code></pre>
|
||||
</li>
|
||||
<li><p>foo <code>bar</code> bar:</p>
|
||||
<pre><code class="lang-erb"> foo
|
||||
---
|
||||
bar
|
||||
---
|
||||
foo
|
||||
bar</code></pre>
|
||||
</li>
|
||||
<li><p>foo <code>bar</code> bar:</p>
|
||||
<pre><code class="lang-html"> ---
|
||||
foo
|
||||
foo
|
||||
---
|
||||
bar</code></pre>
|
||||
</li>
|
||||
<li><p>foo <code>bar</code> bar:</p>
|
||||
<pre><code> foo
|
||||
---
|
||||
bar</code></pre>
|
||||
</li>
|
||||
<li><p>foo</p>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
Vendored
+53
@@ -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
|
||||
+1
@@ -0,0 +1 @@
|
||||
<p>hello <del>hi</del> world</p>
|
||||
+1
@@ -0,0 +1 @@
|
||||
hello ~~hi~~ world
|
||||
+1
@@ -0,0 +1 @@
|
||||
<p>These words should_not_be_emphasized.</p>
|
||||
+1
@@ -0,0 +1 @@
|
||||
These words should_not_be_emphasized.
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<p>This should be a link:
|
||||
<a href="http://example.com/hello-world">http://example.com/hello-world</a>.</p>
|
||||
+1
@@ -0,0 +1 @@
|
||||
This should be a link: http://example.com/hello-world.
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Heading 1</th><th>Heading 2</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Cell 1</td><td>Cell 2</td></tr>
|
||||
<tr><td>Cell 3</td><td>Cell 4</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th style="text-align:center">Header 1</th><th style="text-align:right">Header 2</th><th style="text-align:left">Header 3</th><th>Header 4</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td style="text-align:center">Cell 1</td><td style="text-align:right">Cell 2</td><td style="text-align:left">Cell 3</td><td>Cell 4</td></tr>
|
||||
<tr><td style="text-align:center">Cell 5</td><td style="text-align:right">Cell 6</td><td style="text-align:left">Cell 7</td><td>Cell 8</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<pre><code>Test code</code></pre>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Header 1</th><th>Header 2</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Cell 1</td><td>Cell 2</td></tr>
|
||||
<tr><td>Cell 3</td><td>Cell 4</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th style="text-align:left">Header 1</th><th style="text-align:center">Header 2</th><th style="text-align:right">Header 3</th><th>Header 4</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td style="text-align:left">Cell 1</td><td style="text-align:center">Cell 2</td><td style="text-align:right">Cell 3</td><td>Cell 4</td></tr>
|
||||
<tr><td style="text-align:left"><em>Cell 5</em></td><td style="text-align:center">Cell 6</td><td style="text-align:right">Cell 7</td><td>Cell 8</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
+21
@@ -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
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
<ul>
|
||||
<li>hello
|
||||
world</li>
|
||||
<li>how
|
||||
are</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>you today?</p>
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
* hello
|
||||
world
|
||||
* how
|
||||
are
|
||||
* * *
|
||||
you today?
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
<blockquote>
|
||||
<p>hi there
|
||||
bud</p>
|
||||
</blockquote>
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
> hi there
|
||||
bud
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<ul><li><p>item1</p> <ul><li>item2 </li></ul> <p>text</p> </li></ul>
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
* item1
|
||||
|
||||
* item2
|
||||
|
||||
text
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
<ul>
|
||||
<li><p>hello
|
||||
world </p>
|
||||
|
||||
<p>how
|
||||
are</p></li>
|
||||
<li>you </li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<p>better behavior:</p>
|
||||
|
||||
<ul><li><p>hello</p> <ul><li><p>world
|
||||
how</p> <p>are
|
||||
you</p></li><li><p>today</p></li></ul></li><li>hi</li></ul>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li><p>hello</p></li>
|
||||
<li><p>world</p></li>
|
||||
<li>hi</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li>hello</li>
|
||||
<li><p>world</p></li>
|
||||
<li><p>hi</p></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li>hello</li>
|
||||
<li><p>world</p>
|
||||
|
||||
<p>how</p></li>
|
||||
<li>hi</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li>hello</li>
|
||||
<li>world</li>
|
||||
<li><p>how</p>
|
||||
|
||||
<p>are</p></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li>hello</li>
|
||||
<li><p>world</p></li>
|
||||
<li><p>how</p>
|
||||
|
||||
<p>are</p></li>
|
||||
</ul>
|
||||
Vendored
+59
@@ -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
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<h1 id="a-heading">A heading</h1> <p>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 <a href="http://google.com/" title="Google">inconsistent</a> with regards to paragraphs in list items.</p> <p>A link. Not anymore.</p> <aside>This will make me fail the test because
|
||||
markdown.js doesnt acknowledge arbitrary html blocks =/</aside> <ul><li><p>List Item 1</p></li><li><p>List Item 2 </p><ul><li>New List Item 1 Hi, this is a list item.</li><li>New List Item 2 Another item <pre><code>Code goes here.
|
||||
Lots of it...</code></pre></li><li>New List Item 3 The last item</li></ul></li><li><p>List Item 3 The final item.</p></li><li><p>List Item 4 The real final item.</p></li></ul> <p>Paragraph.</p> <blockquote><ul><li>bq Item 1</li><li>bq Item 2 <ul><li>New bq Item 1</li><li>New bq Item 2 Text here</li></ul></li></ul></blockquote> <hr> <blockquote><p> Another blockquote! I really need to get more creative with mockup text.. markdown.js breaks here again</p></blockquote> <h2 id="another-heading">Another Heading</h2> <p>Hello <em>world</em>. Here is a <a href="//hello">link</a>. And an image <img src="src" alt="alt">.</p> <pre><code>Code goes here.
|
||||
Lots of it...</code></pre>
|
||||
+55
@@ -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.
|
||||
|
||||
<aside>This will make me fail the test because
|
||||
markdown.js doesnt acknowledge arbitrary html blocks =/</aside>
|
||||
|
||||
* 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 .
|
||||
|
||||
Code goes here.
|
||||
Lots of it...
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<p><code>hi ther `` ok ```</code></p>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
````` hi ther `` ok ``` `````
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<p><em>test <strong>test</strong> test</em></p>
|
||||
|
||||
<p><em>test <strong>test</strong> test</em></p>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
*test **test** test*
|
||||
|
||||
_test __test__ test_
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<p><a href="/url">the <code>]</code> character</a></p>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
[the `]` character](/url)
|
||||
+1
@@ -0,0 +1 @@
|
||||
<p>[test](not a link)</p>
|
||||
+1
@@ -0,0 +1 @@
|
||||
\[test](not a link)
|
||||
+1
@@ -0,0 +1 @@
|
||||
<p><a href="/url" title="there">hi</a></p>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
[hi]
|
||||
|
||||
[hi]: /url (there)
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<li>test</li>
|
||||
<li>test</li>
|
||||
<li>test</li>
|
||||
</ul>
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
* test
|
||||
+ test
|
||||
- test
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
<p>Hello world ‘how’ “are” you — today…</p>
|
||||
|
||||
<p>“It’s a more ‘challenging’ smartypants test…”</p>
|
||||
|
||||
<p>‘And,’ as a bonus — “one
|
||||
multiline” test!</p>
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
Hello world 'how' "are" you -- today...
|
||||
|
||||
"It's a more 'challenging' smartypants test..."
|
||||
|
||||
'And,' as a bonus -- "one
|
||||
multiline" test!
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<p>hello world
|
||||
how are you
|
||||
how are you</p>
|
||||
|
||||
<p>hello world</p>
|
||||
<pre><code>how are you</code></pre>
|
||||
|
||||
<p>hello world</p>
|
||||
<hr>
|
||||
|
||||
<p>hello world</p>
|
||||
<h1 id="how-are-you">how are you</h1>
|
||||
|
||||
<p>hello world</p>
|
||||
<h1 id="how-are-you">how are you</h1>
|
||||
|
||||
<p>hello world</p>
|
||||
<blockquote><p>how are you</p></blockquote>
|
||||
|
||||
<p>hello world</p>
|
||||
<ul><li>how are you</li></ul>
|
||||
|
||||
<p>hello world</p>
|
||||
<div>how are you</div>
|
||||
|
||||
<p>hello world
|
||||
<span>how are you</span></p>
|
||||
|
||||
<p>hello <a href="/are/you">world</a>
|
||||
</p>
|
||||
|
||||
<div>hello</div>
|
||||
|
||||
<p><span>hello</span></p>
|
||||
+37
@@ -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
|
||||
<div>how are you</div>
|
||||
|
||||
hello world
|
||||
<span>how are you</span>
|
||||
|
||||
hello [world][how]
|
||||
[how]: /are/you
|
||||
|
||||
<div>hello</div>
|
||||
|
||||
<span>hello</span>
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
<p><strong>hello</strong> <em>world</em></p>
|
||||
|
||||
<ul>
|
||||
<li>hello world</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>hello</strong> <em>world</em></p>
|
||||
|
||||
<ul>
|
||||
<li>hello world</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>hello</strong> <em>world</em></p>
|
||||
|
||||
<ul>
|
||||
<li>Hello world</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>hello</strong> <em>world</em></p>
|
||||
|
||||
<ul>
|
||||
<li>hello world</li>
|
||||
</ul>
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
**hello** _world_
|
||||
|
||||
* hello world
|
||||
|
||||
**hello** _world_
|
||||
|
||||
* hello world
|
||||
|
||||
**hello** _world_
|
||||
|
||||
* Hello world
|
||||
|
||||
**hello** _world_
|
||||
|
||||
* hello world
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<p>AT&T has an ampersand in their name.</p>
|
||||
|
||||
<p>AT&T is another way to write it.</p>
|
||||
|
||||
<p>This & that.</p>
|
||||
|
||||
<p>4 < 5.</p>
|
||||
|
||||
<p>6 > 5.</p>
|
||||
|
||||
<p>Here's a <a href="http://example.com/?foo=1&bar=2">link</a> with an ampersand in the URL.</p>
|
||||
|
||||
<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&T</a>.</p>
|
||||
|
||||
<p>Here's an inline <a href="/script?foo=1&bar=2">link</a>.</p>
|
||||
|
||||
<p>Here's an inline <a href="/script?foo=1&bar=2">link</a>.</p>
|
||||
+21
@@ -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](</script?foo=1&bar=2>).
|
||||
|
||||
|
||||
[1]: http://example.com/?foo=1&bar=2
|
||||
[2]: http://att.com/ "AT&T"
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
<p>Link: <a href="http://example.com/">http://example.com/</a>.</p>
|
||||
|
||||
<p>With an ampersand: <a href="http://example.com/?foo=1&bar=2">http://example.com/?foo=1&bar=2</a></p>
|
||||
|
||||
<ul>
|
||||
<li>In a list?</li>
|
||||
<li><a href="http://example.com/">http://example.com/</a></li>
|
||||
<li>It should.</li>
|
||||
</ul>
|
||||
|
||||
<blockquote>
|
||||
<p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
|
||||
</blockquote>
|
||||
|
||||
<p>Auto-links should not occur here: <code><http://example.com/></code></p>
|
||||
|
||||
<pre><code>or here: <http://example.com/>
|
||||
</code></pre>
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
Link: <http://example.com/>.
|
||||
|
||||
With an ampersand: <http://example.com/?foo=1&bar=2>
|
||||
|
||||
* In a list?
|
||||
* <http://example.com/>
|
||||
* It should.
|
||||
|
||||
> Blockquoted: <http://example.com/>
|
||||
|
||||
Auto-links should not occur here: `<http://example.com/>`
|
||||
|
||||
or here: <http://example.com/>
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
<p>These should all get escaped:</p>
|
||||
|
||||
<p>Backslash: \</p>
|
||||
|
||||
<p>Backtick: `</p>
|
||||
|
||||
<p>Asterisk: *</p>
|
||||
|
||||
<p>Underscore: _</p>
|
||||
|
||||
<p>Left brace: {</p>
|
||||
|
||||
<p>Right brace: }</p>
|
||||
|
||||
<p>Left bracket: [</p>
|
||||
|
||||
<p>Right bracket: ]</p>
|
||||
|
||||
<p>Left paren: (</p>
|
||||
|
||||
<p>Right paren: )</p>
|
||||
|
||||
<p>Greater-than: ></p>
|
||||
|
||||
<p>Hash: #</p>
|
||||
|
||||
<p>Period: .</p>
|
||||
|
||||
<p>Bang: !</p>
|
||||
|
||||
<p>Plus: +</p>
|
||||
|
||||
<p>Minus: -</p>
|
||||
|
||||
<p>These should not, because they occur within a code block:</p>
|
||||
|
||||
<pre><code>Backslash: \\
|
||||
|
||||
Backtick: \`
|
||||
|
||||
Asterisk: \*
|
||||
|
||||
Underscore: \_
|
||||
|
||||
Left brace: \{
|
||||
|
||||
Right brace: \}
|
||||
|
||||
Left bracket: \[
|
||||
|
||||
Right bracket: \]
|
||||
|
||||
Left paren: \(
|
||||
|
||||
Right paren: \)
|
||||
|
||||
Greater-than: \>
|
||||
|
||||
Hash: \#
|
||||
|
||||
Period: \.
|
||||
|
||||
Bang: \!
|
||||
|
||||
Plus: \+
|
||||
|
||||
Minus: \-
|
||||
</code></pre>
|
||||
|
||||
<p>Nor should these, which occur in code spans:</p>
|
||||
|
||||
<p>Backslash: <code>\\</code></p>
|
||||
|
||||
<p>Backtick: <code>\`</code></p>
|
||||
|
||||
<p>Asterisk: <code>\*</code></p>
|
||||
|
||||
<p>Underscore: <code>\_</code></p>
|
||||
|
||||
<p>Left brace: <code>\{</code></p>
|
||||
|
||||
<p>Right brace: <code>\}</code></p>
|
||||
|
||||
<p>Left bracket: <code>\[</code></p>
|
||||
|
||||
<p>Right bracket: <code>\]</code></p>
|
||||
|
||||
<p>Left paren: <code>\(</code></p>
|
||||
|
||||
<p>Right paren: <code>\)</code></p>
|
||||
|
||||
<p>Greater-than: <code>\></code></p>
|
||||
|
||||
<p>Hash: <code>\#</code></p>
|
||||
|
||||
<p>Period: <code>\.</code></p>
|
||||
|
||||
<p>Bang: <code>\!</code></p>
|
||||
|
||||
<p>Plus: <code>\+</code></p>
|
||||
|
||||
<p>Minus: <code>\-</code></p>
|
||||
|
||||
|
||||
<p>These should get escaped, even though they're matching pairs for
|
||||
other Markdown constructs:</p>
|
||||
|
||||
<p>*asterisks*</p>
|
||||
|
||||
<p>_underscores_</p>
|
||||
|
||||
<p>`backticks`</p>
|
||||
|
||||
<p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
|
||||
|
||||
<p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
|
||||
|
||||
<p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>
|
||||
+120
@@ -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 <span attr='`ticks`'>bar</span>.
|
||||
|
||||
This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<blockquote>
|
||||
<p>Example:</p>
|
||||
|
||||
<pre><code>sub status {
|
||||
print "working";
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<p>Or:</p>
|
||||
|
||||
<pre><code>sub status {
|
||||
return "working";
|
||||
}
|
||||
</code></pre>
|
||||
</blockquote>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
> Example:
|
||||
>
|
||||
> sub status {
|
||||
> print "working";
|
||||
> }
|
||||
>
|
||||
> Or:
|
||||
>
|
||||
> sub status {
|
||||
> return "working";
|
||||
> }
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
<pre><code>code block on the first line
|
||||
</code></pre>
|
||||
|
||||
<p>Regular text.</p>
|
||||
|
||||
<pre><code>code block indented by spaces
|
||||
</code></pre>
|
||||
|
||||
<p>Regular text.</p>
|
||||
|
||||
<pre><code>the lines in this block
|
||||
all contain trailing spaces
|
||||
</code></pre>
|
||||
|
||||
<p>Regular Text.</p>
|
||||
|
||||
<pre><code>code block on the last line
|
||||
</code></pre>
|
||||
Vendored
+14
@@ -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
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
<p><code><test a="</code> content of attribute <code>"></code></p>
|
||||
|
||||
<p>Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span></p>
|
||||
|
||||
<p>Here's how you put <code>`backticks`</code> in a code span.</p>
|
||||
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
`<test a="` content of attribute `">`
|
||||
|
||||
Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span>
|
||||
|
||||
Here's how you put `` `backticks` `` in a code span.
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<p>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.</p>
|
||||
|
||||
<p>Here's one with a bullet.
|
||||
* criminey.</p>
|
||||
+8
@@ -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.
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<p>Dashes:</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<pre><code>---
|
||||
</code></pre>
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<pre><code>- - -
|
||||
</code></pre>
|
||||
|
||||
<p>Asterisks:</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<pre><code>***
|
||||
</code></pre>
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<pre><code>* * *
|
||||
</code></pre>
|
||||
|
||||
<p>Underscores:</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<pre><code>___
|
||||
</code></pre>
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<pre><code>_ _ _
|
||||
</code></pre>
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
Dashes:
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
- - -
|
||||
|
||||
- - -
|
||||
|
||||
- - -
|
||||
|
||||
- - -
|
||||
|
||||
- - -
|
||||
|
||||
|
||||
Asterisks:
|
||||
|
||||
***
|
||||
|
||||
***
|
||||
|
||||
***
|
||||
|
||||
***
|
||||
|
||||
***
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
|
||||
Underscores:
|
||||
|
||||
___
|
||||
|
||||
___
|
||||
|
||||
___
|
||||
|
||||
___
|
||||
|
||||
___
|
||||
|
||||
_ _ _
|
||||
|
||||
_ _ _
|
||||
|
||||
_ _ _
|
||||
|
||||
_ _ _
|
||||
|
||||
_ _ _
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<p>Simple block on one line:</p>
|
||||
|
||||
<div>foo</div>
|
||||
|
||||
<p>And nested without indentation:</p>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
foo
|
||||
</div>
|
||||
<div style=">"/>
|
||||
</div>
|
||||
<div>bar</div>
|
||||
</div>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
Simple block on one line:
|
||||
|
||||
<div>foo</div>
|
||||
|
||||
And nested without indentation:
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
foo
|
||||
</div>
|
||||
<div style=">"/>
|
||||
</div>
|
||||
<div>bar</div>
|
||||
</div>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<p>Paragraph one.</p>
|
||||
|
||||
<!-- This is a simple comment -->
|
||||
|
||||
<!--
|
||||
This is another comment.
|
||||
-->
|
||||
|
||||
<p>Paragraph two.</p>
|
||||
|
||||
<!-- one comment block -- -- with two comments -->
|
||||
|
||||
<p>The end.</p>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
Paragraph one.
|
||||
|
||||
<!-- This is a simple comment -->
|
||||
|
||||
<!--
|
||||
This is another comment.
|
||||
-->
|
||||
|
||||
Paragraph two.
|
||||
|
||||
<!-- one comment block -- -- with two comments -->
|
||||
|
||||
The end.
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
<p>Here's a simple block:</p>
|
||||
|
||||
<div>
|
||||
foo
|
||||
</div>
|
||||
|
||||
<p>This should be a code block, though:</p>
|
||||
|
||||
<pre><code><div>
|
||||
foo
|
||||
</div>
|
||||
</code></pre>
|
||||
|
||||
<p>As should this:</p>
|
||||
|
||||
<pre><code><div>foo</div>
|
||||
</code></pre>
|
||||
|
||||
<p>Now, nested:</p>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
foo
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>This should just be an HTML comment:</p>
|
||||
|
||||
<!-- Comment -->
|
||||
|
||||
<p>Multiline:</p>
|
||||
|
||||
<!--
|
||||
Blah
|
||||
Blah
|
||||
-->
|
||||
|
||||
<p>Code block:</p>
|
||||
|
||||
<pre><code><!-- Comment -->
|
||||
</code></pre>
|
||||
|
||||
<p>Just plain comment, with trailing spaces on the line:</p>
|
||||
|
||||
<!-- foo -->
|
||||
|
||||
<p>Code:</p>
|
||||
|
||||
<pre><code><hr />
|
||||
</code></pre>
|
||||
|
||||
<p>Hr's:</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<hr/>
|
||||
|
||||
<hr />
|
||||
|
||||
<hr>
|
||||
|
||||
<hr/>
|
||||
|
||||
<hr />
|
||||
|
||||
<hr class="foo" id="bar" />
|
||||
|
||||
<hr class="foo" id="bar"/>
|
||||
|
||||
<hr class="foo" id="bar" >
|
||||
Loaded 100 of 1025 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user