Comparing version 0.5.3 to 0.6.0
@@ -213,2 +213,3 @@ #!/usr/bin/env node | ||
console.log(' - `pedantic` (boolean, default: false)'); | ||
console.log(' - `commonmark` (boolean, default: false)'); | ||
console.log(' - `breaks` (boolean, default: false)'); | ||
@@ -215,0 +216,0 @@ console.log(' - `footnotes` (boolean, default: false)'); |
0.6.0 / 2015-02-23 | ||
================== | ||
* Refactor code style in `lib/expressions.js` (1d84c60) | ||
* Add CommonMark paragraph parsing (2dda62f) | ||
* Add iojs, node 0.12 to travis (465d2fc) | ||
* Update browserify (965592d) | ||
0.5.3 / 2015-02-20 | ||
@@ -3,0 +11,0 @@ ================== |
/* This file is generated by `script/build-expressions.js` */ | ||
module.exports={ | ||
"rules": { | ||
"newline":/^\n+/, | ||
"bullet":/(?:[*+-]|\d+\.)/, | ||
"code":/^((?: {4}|\t)[^\n]+\n*)+/, | ||
"horizontalRule":/^ *([-*_])( *\1){2,} *(?=\n|$)/, | ||
"heading":/^ *((#{1,6})[ \t]+)([^\n]+?) *#* *(?=\n|$)/, | ||
"lineHeading":/^([^\n]+)\n *(=|-){2,} *(?=\n|$)/, | ||
"linkDefinition":/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$)/, | ||
"blockText":/^[^\n]+/, | ||
"item":/^([ \t]*)((?:[*+-]|\d+\.))[ \t][^\n]*(?:\n(?!\1(?:[*+-]|\d+\.)[ \t])[^\n]*)*/gm, | ||
"list":/^([ \t]*)((?:[*+-]|\d+\.))((?:[ \t][\s\S]+?)(?:\n+(?=\1?(?:[-*_][ \t]*){3,}(?=\n|$))|\n+(?= *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))|\n{2,}(?![ \t])(?!\1(?:[*+-]|\d+\.)[ \t])|\s*$))/, | ||
"blockquote":/^([ \t]*>[^\n]+(\n(?! *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))[^\n]+)*)+/, | ||
"html":/^[ \t]*(?:<!--[\s\S]*?-->[ \t]*(?:\n|\s*$)|<((?!(?: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)[\s\S]+?<\/\1>[ \t]*(?:\n{2,}|\s*$)|<(?!(?: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(?:"[^"]*"|'[^']*'|[^'">])*?>[ \t]*(?:\n{2,}|\s*$))/, | ||
"paragraph":/^(?:(?:[^\n]+\n?(?! *([-*_])( *\1){2,} *(?=\n|$)| *((#{1,6})[ \t]+)([^\n]+?) *#* *(?=\n|$)|([^\n]+)\n *(=|-){2,} *(?=\n|$)|([ \t]*>[^\n]+(\n(?! *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))[^\n]+)*)+|<(?!(?: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| *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$)))+)/, | ||
"escape":/^\\([\\`*{}\[\]()#+\-.!_>])/, | ||
"autoLink":/^<([^ >]+(@|:\/)[^ >]+)>/, | ||
"tag":/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, | ||
"invalidLink":/^(!?\[)((?:\[[^\]]*\]|[^\[\]])*)\]/, | ||
"strong":/^(_)_([\s\S]+?)__(?!_)|^(\*)\*([\s\S]+?)\*\*(?!\*)/, | ||
"emphasis":/^\b(_)((?:__|[\s\S])+?)_\b|^(\*)((?:\*\*|[\s\S])+?)\*(?!\*)/, | ||
"inlineCode":/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/, | ||
"break":/^ {2,}\n(?!\s*$)/, | ||
"text":/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/, | ||
"inside":/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/, | ||
"href":/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/, | ||
"link":/^(!?\[)((?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*)\]\(\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*\)/, | ||
"referenceLink":/^(!?\[)((?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*)\]\s*\[([^\]]*)\]/ | ||
module.exports = { | ||
'rules': { | ||
'newline': /^\n+/, | ||
'bullet': /(?:[*+-]|\d+\.)/, | ||
'code': /^((?: {4}|\t)[^\n]+\n*)+/, | ||
'horizontalRule': /^[ \t]*([-*_])( *\1){2,} *(?=\n|$)/, | ||
'heading': /^[ \t]*((#{1,6})[ \t]+)([^\n]+?) *#* *(?=\n|$)/, | ||
'lineHeading': /^([^\n]+)\n *(=|-){2,} *(?=\n|$)/, | ||
'linkDefinition': /^[ \t]*\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$)/, | ||
'blockText': /^[^\n]+/, | ||
'item': /^([ \t]*)((?:[*+-]|\d+\.))[ \t][^\n]*(?:\n(?!\1(?:[*+-]|\d+\.)[ \t])[^\n]*)*/gm, | ||
'list': /^([ \t]*)((?:[*+-]|\d+\.))((?:[ \t][\s\S]+?)(?:\n+(?=\1?(?:[-*_][ \t]*){3,}(?=\n|$))|\n+(?=[ \t]*\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))|\n{2,}(?![ \t])(?!\1(?:[*+-]|\d+\.)[ \t])|\s*$))/, | ||
'blockquote': /^([ \t]*>[^\n]+(\n(?![ \t]*\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))[^\n]+)*)+/, | ||
'html': /^[ \t]*(?:<!--[\s\S]*?-->[ \t]*(?:\n|\s*$)|<((?!(?: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)[\s\S]+?<\/\1>[ \t]*(?:\n{2,}|\s*$)|<(?!(?: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(?:"[^"]*"|'[^']*'|[^'">])*?>[ \t]*(?:\n{2,}|\s*$))/, | ||
'paragraph': /^(?:(?:[^\n]+\n?(?![ \t]*([-*_])( *\1){2,} *(?=\n|$)|[ \t]*((#{1,6})[ \t]+)([^\n]+?) *#* *(?=\n|$)|([^\n]+)\n *(=|-){2,} *(?=\n|$)|([ \t]*>[^\n]+(\n(?![ \t]*\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))[^\n]+)*)+|<(?!(?: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|[ \t]*\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$)))+)/, | ||
'escape': /^\\([\\`*{}\[\]()#+\-.!_>])/, | ||
'autoLink': /^<([^ >]+(@|:\/)[^ >]+)>/, | ||
'tag': /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, | ||
'invalidLink': /^(!?\[)((?:\[[^\]]*\]|[^\[\]])*)\]/, | ||
'strong': /^(_)_([\s\S]+?)__(?!_)|^(\*)\*([\s\S]+?)\*\*(?!\*)/, | ||
'emphasis': /^\b(_)((?:__|[\s\S])+?)_\b|^(\*)((?:\*\*|[\s\S])+?)\*(?!\*)/, | ||
'inlineCode': /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/, | ||
'break': /^ {2,}\n(?!\s*$)/, | ||
'text': /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/, | ||
'inside': /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/, | ||
'href': /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/, | ||
'link': /^(!?\[)((?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*)\]\(\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*\)/, | ||
'referenceLink': /^(!?\[)((?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*)\]\s*\[([^\]]*)\]/ | ||
}, | ||
"tables": { | ||
"table":/^( *\|(.+))\n( *\|( *[-:]+[-| :]*)\n)((?: *\|.*(?:\n|$))*)/, | ||
"looseTable":/^( *(\S.*\|.*))\n( *([-:]+ *\|[-| :]*)\n)((?:.*\|.*(?:\n|$))*)/ | ||
'tables': { | ||
'table': /^( *\|(.+))\n( *\|( *[-:]+[-| :]*)\n)((?: *\|.*(?:\n|$))*)/, | ||
'looseTable': /^( *(\S.*\|.*))\n( *([-:]+ *\|[-| :]*)\n)((?:.*\|.*(?:\n|$))*)/ | ||
}, | ||
"gfm": { | ||
"fences":/^[ \t]*(`{3,}|~{3,})[ \t]*(\S+)?[ \t]*\n([\s\S]*?)\s*\1[ \t]*(?=\n|$)/, | ||
"paragraph":/^(?:(?:[^\n]+\n?(?![ \t]*(`{3,}|~{3,})[ \t]*(\S+)?[ \t]*\n([\s\S]*?)\s*\2[ \t]*(?=\n|$)|([ \t]*)((?:[*+-]|\d+\.))((?:[ \t][\s\S]+?)(?:\n+(?=\3?(?:[-*_][ \t]*){3,}(?=\n|$))|\n+(?= *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))|\n{2,}(?![ \t])(?!\1(?:[*+-]|\d+\.)[ \t])|\s*$))| *([-*_])( *\1){2,} *(?=\n|$)| *((#{1,6})[ \t]+)([^\n]+?) *#* *(?=\n|$)|([^\n]+)\n *(=|-){2,} *(?=\n|$)|([ \t]*>[^\n]+(\n(?! *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))[^\n]+)*)+|<(?!(?: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| *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$)))+)/, | ||
"escape":/^\\([\\`*{}\[\]()#+\-.!_>~|])/, | ||
"url":/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, | ||
"deletion":/^~~(?=\S)([\s\S]*?\S)~~/, | ||
"text":/^[\s\S]+?(?=[\\<!\[_*`~]|https?:\/\/| {2,}\n|$)/ | ||
'gfm': { | ||
'fences': /^[ \t]*(`{3,}|~{3,})[ \t]*(\S+)?[ \t]*\n([\s\S]*?)\s*\1[ \t]*(?=\n|$)/, | ||
'paragraph': /^(?:(?:[^\n]+\n?(?![ \t]*([-*_])( *\1){2,} *(?=\n|$)|[ \t]*(`{3,}|~{3,})[ \t]*(\S+)?[ \t]*\n([\s\S]*?)\s*\3[ \t]*(?=\n|$)|([ \t]*)((?:[*+-]|\d+\.))((?:[ \t][\s\S]+?)(?:\n+(?=\6?(?:[-*_][ \t]*){3,}(?=\n|$))|\n+(?=[ \t]*\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))|\n{2,}(?![ \t])(?!\6(?:[*+-]|\d+\.)[ \t])|\s*$))|[ \t]*((#{1,6})[ \t]+)([^\n]+?) *#* *(?=\n|$)|([^\n]+)\n *(=|-){2,} *(?=\n|$)|([ \t]*>[^\n]+(\n(?![ \t]*\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))[^\n]+)*)+|<(?!(?: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|[ \t]*\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$)))+)/, | ||
'escape': /^\\([\\`*{}\[\]()#+\-.!_>~|])/, | ||
'url': /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, | ||
'deletion': /^~~(?=\S)([\s\S]*?\S)~~/, | ||
'text': /^[\s\S]+?(?=[\\<!\[_*`~]|https?:\/\/| {2,}\n|$)/ | ||
}, | ||
"footnotes": { | ||
"footnoteDefinition":/^( *\[\^([^\]]+)\]: *)([^\n]+(\n+ +[^\n]+)*)/ | ||
'footnotes': { | ||
'footnoteDefinition': /^( *\[\^([^\]]+)\]: *)([^\n]+(\n+ +[^\n]+)*)/ | ||
}, | ||
"yaml": { | ||
"yamlFrontMatter":/^-{3}\n([\s\S]+?\n)?-{3}/ | ||
'yaml': { | ||
'yamlFrontMatter': /^-{3}\n([\s\S]+?\n)?-{3}/ | ||
}, | ||
"pedantic": { | ||
"strong":/^(_)_(?=\S)([\s\S]*?\S)__(?!_)|^(\*)\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, | ||
"emphasis":/^(_)(?=\S)([\s\S]*?\S)_(?!_)|^(\*)(?=\S)([\s\S]*?\S)\*(?!\*)/ | ||
'pedantic': { | ||
'strong': /^(_)_(?=\S)([\s\S]*?\S)__(?!_)|^(\*)\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, | ||
'emphasis': /^(_)(?=\S)([\s\S]*?\S)_(?!_)|^(\*)(?=\S)([\s\S]*?\S)\*(?!\*)/ | ||
}, | ||
"breaks": { | ||
"break":/^ *\n(?!\s*$)/, | ||
"text":/^[\s\S]+?(?=[\\<!\[_*`]| *\n|$)/ | ||
'commonmark': { | ||
'paragraph': /^(?:(?:[^\n]+\n?(?!\ {0,3}([-*_])( *\1){2,} *(?=\n|$)|\ {0,3}((#{1,6})[ \t]+)([^\n]+?) *#* *(?=\n|$)|([^\n]+)\n *(=|-){2,} *(?=\n|$)|(\ {0,3}>[^\n]+(\n(?!\ {0,3}\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))[^\n]+)*)+|<(?!(?: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|\ {0,3}\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$)))+)/ | ||
}, | ||
"breaksGFM": { | ||
"text":/^[\s\S]+?(?=[\\<!\[_*`~]|https?:\/\/| *\n|$)/ | ||
'commonmarkGFM': { | ||
'paragraph': /^(?:(?:[^\n]+\n?(?!\ {0,3}([-*_])( *\1){2,} *(?=\n|$)|\ {0,3}(`{3,}|~{3,})\ {0,3}(\S+)?\ {0,3}\n([\s\S]*?)\s*\3\ {0,3}(?=\n|$)|(\ {0,3})((?:[*+-]|\d+\.))((?:[ \t][\s\S]+?)(?:\n+(?=\6?(?:[-*_]\ {0,3}){3,}(?=\n|$))|\n+(?=\ {0,3}\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))|\n{2,}(?![ \t])(?!\6(?:[*+-]|\d+\.)[ \t])|\s*$))|\ {0,3}((#{1,6})[ \t]+)([^\n]+?) *#* *(?=\n|$)|([^\n]+)\n *(=|-){2,} *(?=\n|$)|(\ {0,3}>[^\n]+(\n(?!\ {0,3}\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$))[^\n]+)*)+|<(?!(?: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|\ {0,3}\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?=\n|$)))+)/ | ||
}, | ||
'breaks': { | ||
'break': /^ *\n(?!\s*$)/, | ||
'text': /^[\s\S]+?(?=[\\<!\[_*`]| *\n|$)/ | ||
}, | ||
'breaksGFM': { | ||
'text': /^[\s\S]+?(?=[\\<!\[_*`~]|https?:\/\/| *\n|$)/ | ||
} | ||
}; |
@@ -1341,2 +1341,10 @@ 'use strict'; | ||
if (options.commonmark) { | ||
copy(rules, expressions.commonmark); | ||
} | ||
if (options.gfm && options.commonmark) { | ||
copy(rules, expressions.commonmarkGFM); | ||
} | ||
/* | ||
@@ -1343,0 +1351,0 @@ * Tables only occur with `gfm: true`. |
{ | ||
"name": "mdast", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"description": "Speedy Markdown parser/stringifier for multipurpose analysis", | ||
@@ -41,3 +41,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"browserify": "^8.0.0", | ||
"browserify": "^9.0.0", | ||
"chalk": "^0.5.0", | ||
@@ -63,3 +63,3 @@ "diff": "^1.0.0", | ||
"test": "npm run test-api && npm run test-cli", | ||
"lint-api": "eslint --env browser index.js lib/parse.js lib/stringify.js lib/utilities.js", | ||
"lint-api": "eslint --env browser index.js lib/parse.js lib/stringify.js lib/utilities.js lib/expressions.js", | ||
"lint-benchmark": "eslint --global suite,set,bench benchmark.js", | ||
@@ -66,0 +66,0 @@ "lint-cli": "eslint --rule no-process-exit:false cli.js", |
@@ -245,2 +245,3 @@ # ![mdast](https://cdn.rawgit.com/wooorm/mdast/master/logo.svg) | ||
- `yaml` (`boolean`, default: `true`). See [YAML](doc/Options.md#yaml); | ||
- `commonmark` (`boolean`, default: `false`). See [CommonMark](doc/Options.md#commonmark); | ||
- `footnotes` (`boolean`, default: `false`). See [Footnotes](doc/Options.md#footnotes). | ||
@@ -247,0 +248,0 @@ - `pedantic` (`boolean`, default: `false`). See [Pedantic](doc/Options.md#pedantic); |
118208
2919
348