markdown-it
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -0,1 +1,7 @@ | ||
3.0.3 / 2015-01-11 | ||
------------------ | ||
- Fixed punctuation check in emphasis. | ||
3.0.2 / 2015-01-09 | ||
@@ -2,0 +8,0 @@ ------------------ |
@@ -44,3 +44,3 @@ // Utilities | ||
var UNESCAPE_MD_RE = /\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g; | ||
var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g; | ||
@@ -227,2 +227,50 @@ function unescapeMd(str) { | ||
// Markdown ASCII punctuation characters. | ||
// | ||
// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~ | ||
// http://spec.commonmark.org/0.15/#ascii-punctuation-character | ||
// | ||
// Don't confuse with unicode punctuation !!! It lacks some chars in ascii range. | ||
// | ||
function isMdAsciiPunct(ch) { | ||
switch (ch) { | ||
case 0x21/* ! */: | ||
case 0x22/* " */: | ||
case 0x23/* # */: | ||
case 0x24/* $ */: | ||
case 0x25/* % */: | ||
case 0x26/* & */: | ||
case 0x27/* ' */: | ||
case 0x28/* ( */: | ||
case 0x29/* ) */: | ||
case 0x2A/* * */: | ||
case 0x2B/* + */: | ||
case 0x2C/* , */: | ||
case 0x2D/* - */: | ||
case 0x2E/* . */: | ||
case 0x2F/* / */: | ||
case 0x3A/* : */: | ||
case 0x3B/* ; */: | ||
case 0x3C/* < */: | ||
case 0x3D/* = */: | ||
case 0x3E/* > */: | ||
case 0x3F/* ? */: | ||
case 0x40/* @ */: | ||
case 0x5B/* [ */: | ||
case 0x5C/* \ */: | ||
case 0x5D/* ] */: | ||
case 0x5E/* ^ */: | ||
case 0x5F/* _ */: | ||
case 0x60/* ` */: | ||
case 0x7B/* { */: | ||
case 0x7C/* | */: | ||
case 0x7D/* } */: | ||
case 0x7E/* ~ */: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
//////////////////////////////////////////////////////////////////////////////// | ||
@@ -241,3 +289,4 @@ | ||
exports.isWhiteSpace = isWhiteSpace; | ||
exports.isMdAsciiPunct = isMdAsciiPunct; | ||
exports.isPunctChar = isPunctChar; | ||
exports.escapeRE = escapeRE; |
@@ -96,15 +96,4 @@ /** | ||
rules.paragraph_close = function (tokens, idx /*, options, env */) { | ||
// We have 2 cases of "hidden" paragraphs | ||
// | ||
// 1. In tight lists | ||
// 2. When content was stripped (reference definition, for example) | ||
// | ||
if (tokens[idx].tight === true) { | ||
if (!tokens[idx - 1].content) { | ||
return ''; | ||
} | ||
if (tokens[idx + 1].type.slice(-5) === 'close') { | ||
return ''; | ||
} | ||
return '\n'; | ||
return tokens[idx + 1].type.slice(-5) === 'close' ? '' : '\n'; | ||
} | ||
@@ -111,0 +100,0 @@ return '</p>\n'; |
@@ -5,4 +5,5 @@ // Process *this* and _that_ | ||
var isWhiteSpace = require('../common/utils').isWhiteSpace; | ||
var isPunctChar = require('../common/utils').isPunctChar; | ||
var isWhiteSpace = require('../common/utils').isWhiteSpace; | ||
var isPunctChar = require('../common/utils').isPunctChar; | ||
var isMdAsciiPunct = require('../common/utils').isMdAsciiPunct; | ||
@@ -35,4 +36,6 @@ | ||
isLastPunctChar = lastChar >= 0 && isPunctChar(String.fromCharCode(lastChar)); | ||
isNextPunctChar = nextChar >= 0 && isPunctChar(String.fromCharCode(nextChar)); | ||
isLastPunctChar = lastChar >= 0 && | ||
(isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar))); | ||
isNextPunctChar = nextChar >= 0 && | ||
(isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar))); | ||
isLastWhiteSpace = lastChar >= 0 && isWhiteSpace(lastChar); | ||
@@ -39,0 +42,0 @@ isNextWhiteSpace = nextChar >= 0 && isWhiteSpace(nextChar); |
@@ -10,26 +10,31 @@ // Skip text characters for text token, place those to pending buffer | ||
// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~ | ||
// !!!! Don't confuse with "Markdown ASCII Punctuation" chars | ||
// http://spec.commonmark.org/0.15/#ascii-punctuation-character | ||
function isTerminatorChar(ch) { | ||
switch (ch) { | ||
case 0x0A/* \n */: | ||
case 0x5C/* \ */: | ||
case 0x60/* ` */: | ||
case 0x2A/* * */: | ||
case 0x5F/* _ */: | ||
case 0x5E/* ^ */: | ||
case 0x5B/* [ */: | ||
case 0x5D/* ] */: | ||
case 0x21/* ! */: | ||
case 0x23/* # */: | ||
case 0x24/* $ */: | ||
case 0x25/* % */: | ||
case 0x26/* & */: | ||
case 0x2A/* * */: | ||
case 0x2B/* + */: | ||
case 0x2D/* - */: | ||
case 0x3A/* : */: | ||
case 0x3C/* < */: | ||
case 0x3D/* = */: | ||
case 0x3E/* > */: | ||
case 0x40/* @ */: | ||
case 0x5B/* [ */: | ||
case 0x5C/* \ */: | ||
case 0x5D/* ] */: | ||
case 0x5E/* ^ */: | ||
case 0x5F/* _ */: | ||
case 0x60/* ` */: | ||
case 0x7B/* { */: | ||
case 0x7D/* } */: | ||
case 0x24/* $ */: | ||
case 0x25/* % */: | ||
case 0x40/* @ */: | ||
case 0x7E/* ~ */: | ||
case 0x2B/* + */: | ||
case 0x3D/* = */: | ||
case 0x3A/* : */: | ||
return true; | ||
@@ -36,0 +41,0 @@ default: |
{ | ||
"name": "markdown-it", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Markdown-it - modern pluggable markdown parser.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
549351
14749