commonmark
Advanced tools
Comparing version 0.29.3 to 0.30.0
@@ -36,3 +36,3 @@ "use strict"; | ||
var reThematicBreak = /^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/; | ||
var reThematicBreak = /^(?:\*[ \t]*){3,}$|^(?:_[ \t]*){3,}$|^(?:-[ \t]*){3,}$/; | ||
@@ -153,3 +153,3 @@ var reMaybeSpecial = /^[#`~*+_=<>0-9-]/; | ||
(match = rest.match(reOrderedListMarker)) && | ||
(container.type !== "paragraph" || match[1] === "1") | ||
(container.type !== "paragraph" || match[1] == 1) | ||
) { | ||
@@ -553,3 +553,6 @@ data.type = "ordered"; | ||
reHtmlBlockOpen[blockType].test(s) && | ||
(blockType < 7 || container.type !== "paragraph") | ||
(blockType < 7 || (container.type !== "paragraph" && | ||
!(!parser.allClosed && !parser.blank && | ||
parser.tip.type === "paragraph") // maybe lazy | ||
)) | ||
) { | ||
@@ -556,0 +559,0 @@ parser.closeUnmatchedBlocks(); |
@@ -39,3 +39,3 @@ "use strict"; | ||
var rePunctuation = new RegExp( | ||
/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/ | ||
/^[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/ | ||
); | ||
@@ -87,3 +87,3 @@ | ||
var reLinkLabel = /^\[(?:[^\\\[\]]|\\.){0,1000}\]/; | ||
var reLinkLabel = /^\[(?:[^\\\[\]]|\\.){0,1000}\]/s; | ||
@@ -380,10 +380,8 @@ // Matches a string of non-special characters. | ||
var opener_found; | ||
var openers_bottom = [[], [], []]; | ||
var openers_bottom = []; | ||
var openers_bottom_index; | ||
var odd_match = false; | ||
for (var i = 0; i < 3; i++) { | ||
openers_bottom[i][C_UNDERSCORE] = stack_bottom; | ||
openers_bottom[i][C_ASTERISK] = stack_bottom; | ||
openers_bottom[i][C_SINGLEQUOTE] = stack_bottom; | ||
openers_bottom[i][C_DOUBLEQUOTE] = stack_bottom; | ||
for (var i = 0; i < 8; i++) { | ||
openers_bottom[i] = stack_bottom; | ||
} | ||
@@ -404,6 +402,21 @@ // find first closer above stack_bottom: | ||
opener_found = false; | ||
switch (closercc) { | ||
case C_SINGLEQUOTE: | ||
openers_bottom_index = 0; | ||
break; | ||
case C_DOUBLEQUOTE: | ||
openers_bottom_index = 1; | ||
break; | ||
case C_UNDERSCORE: | ||
openers_bottom_index = 2; | ||
break; | ||
case C_ASTERISK: | ||
openers_bottom_index = 3 + (closer.can_open ? 3 : 0) | ||
+ (closer.origdelims % 3); | ||
break; | ||
} | ||
while ( | ||
opener !== null && | ||
opener !== stack_bottom && | ||
opener !== openers_bottom[closer.origdelims % 3][closercc] | ||
opener !== openers_bottom[openers_bottom_index] | ||
) { | ||
@@ -489,3 +502,3 @@ odd_match = | ||
// Set lower bound for future searches for openers: | ||
openers_bottom[old_closer.origdelims % 3][closercc] = | ||
openers_bottom[openers_bottom_index] = | ||
old_closer.previous; | ||
@@ -492,0 +505,0 @@ if (!old_closer.can_open) { |
@@ -40,2 +40,5 @@ "use strict"; | ||
// set to " " if you want to ignore line wrapping in source | ||
this.esc = options.esc || escapeXml; | ||
// escape html with a custom function | ||
// else use escapeXml | ||
@@ -42,0 +45,0 @@ this.disableTags = 0; |
@@ -20,2 +20,6 @@ "use strict"; | ||
this.indent = " "; | ||
this.esc = options.esc || escapeXml; | ||
// escape html with a custom function | ||
// else use escapeXml | ||
@@ -22,0 +26,0 @@ this.options = options; |
{ | ||
"name": "commonmark", | ||
"description": "a strongly specified, highly compatible variant of Markdown", | ||
"version": "0.29.3", | ||
"version": "0.30.0", | ||
"homepage": "https://commonmark.org", | ||
@@ -33,3 +33,5 @@ "keywords": [ | ||
"lint": "eslint .", | ||
"test": "node ./test/test" | ||
"test": "node ./test/test", | ||
"prepublish": "npm run build", | ||
"pretest": "npm run build" | ||
}, | ||
@@ -58,5 +60,5 @@ "dependencies": { | ||
"http-server": "^0.12.3", | ||
"lodash": "^4.17.19", | ||
"markdown-it": "^10.0", | ||
"marked": "^0.8.0", | ||
"lodash": "^4.17.21", | ||
"markdown-it": "^12.0", | ||
"marked": "^2.1", | ||
"mem": ">=4.0.0", | ||
@@ -63,0 +65,0 @@ "rollup": "^1.29.0", |
@@ -35,6 +35,17 @@ commonmark.js | ||
For client-side use, fetch the latest from | ||
<https://raw.githubusercontent.com/commonmark/commonmark.js/master/dist/commonmark.js>, | ||
or `bower install commonmark`. | ||
For client-side use, you can use one of the single-file | ||
distributions provided in the `dist/` subdirectory | ||
of the node installation (`node_modules/commonmark/dist/`). | ||
Use either `commonmark.js` (readable source) or | ||
`commonmark.min.js` (minimized source). | ||
Alternatively, `bower install commonmark` will install | ||
the needed distribution files in | ||
`bower_components/commonmark/dist`. | ||
You can also use the version hosted by unpkg: for example, | ||
<https://unpkg.com/commonmark@0.29.3/dist/commonmark.js> | ||
for the unminimized version 0.29.3. | ||
Building | ||
@@ -47,11 +58,9 @@ -------- | ||
To build standalone JavaScript files (`dist/commonmark.js` and | ||
`dist/commonmark.min.js`): | ||
To run tests for the JavaScript library: | ||
make dist | ||
npm test | ||
To run tests for the JavaScript library: | ||
(Running the tests will also rebuild distribution files in | ||
`dist/`.) | ||
make test | ||
To run benchmarks against some other JavaScript converters: | ||
@@ -110,6 +119,4 @@ | ||
- `softbreak`: specify raw string to be used for a softbreak. | ||
- `esc`: specify a function to be used to escape strings. Its | ||
first argument is the string to be escaped, the second argument | ||
is a boolean indicating whether to preserves entities in that | ||
string. | ||
- `esc`: specify a function to be used to escape strings. Its | ||
argument is the string. | ||
@@ -157,3 +164,3 @@ For example, to make soft breaks render as hard breaks in HTML: | ||
- `level`: heading level (Number). | ||
- `listType`: a String, either `Bullet` or `Ordered`. | ||
- `listType`: a String, either `bullet` or `ordered`. | ||
- `listTight`: `true` if list is tight. | ||
@@ -160,0 +167,0 @@ - `listStart`: a Number, the starting number of an ordered list. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13127
360
490041
16