remark-parse
Advanced tools
Comparing version 7.0.2 to 8.0.0
@@ -7,5 +7,4 @@ 'use strict' | ||
commonmark: false, | ||
footnotes: false, | ||
pedantic: false, | ||
blocks: require('./block-elements') | ||
} |
@@ -5,18 +5,21 @@ 'use strict' | ||
var protocols = ['https://', 'http://', 'mailto:'] | ||
var values = ['www.', 'http://', 'https://'] | ||
function locate(value, fromIndex) { | ||
var length = protocols.length | ||
var index = -1 | ||
var min = -1 | ||
var index | ||
var length | ||
var position | ||
if (!this.options.gfm) { | ||
return -1 | ||
return min | ||
} | ||
length = values.length | ||
index = -1 | ||
while (++index < length) { | ||
position = value.indexOf(protocols[index], fromIndex) | ||
position = value.indexOf(values[index], fromIndex) | ||
if (position !== -1 && (position < min || min === -1)) { | ||
if (position !== -1 && (min === -1 || position < min)) { | ||
min = position | ||
@@ -23,0 +26,0 @@ } |
@@ -58,4 +58,3 @@ 'use strict' | ||
['setextHeading', {commonmark: false}], | ||
['definition', {commonmark: false}], | ||
['footnote', {commonmark: false}] | ||
['definition', {commonmark: false}] | ||
] | ||
@@ -75,4 +74,3 @@ | ||
['thematicBreak', {pedantic: false}], | ||
['definition', {commonmark: false}], | ||
['footnote', {commonmark: false}] | ||
['definition', {commonmark: false}] | ||
] | ||
@@ -96,4 +94,3 @@ | ||
['list', {commonmark: true}], | ||
['definition', {commonmark: false}], | ||
['footnote', {commonmark: false}] | ||
['definition', {commonmark: false}] | ||
] | ||
@@ -103,3 +100,3 @@ | ||
proto.blockTokenizers = { | ||
newline: require('./tokenize/newline'), | ||
blankLine: require('./tokenize/blank-line'), | ||
indentedCode: require('./tokenize/code-indented'), | ||
@@ -113,3 +110,2 @@ fencedCode: require('./tokenize/code-fenced'), | ||
html: require('./tokenize/html-block'), | ||
footnote: require('./tokenize/footnote-definition'), | ||
definition: require('./tokenize/definition'), | ||
@@ -124,2 +120,3 @@ table: require('./tokenize/table'), | ||
url: require('./tokenize/url'), | ||
email: require('./tokenize/email'), | ||
html: require('./tokenize/html-inline'), | ||
@@ -126,0 +123,0 @@ link: require('./tokenize/link'), |
@@ -25,3 +25,3 @@ 'use strict' | ||
var length | ||
var prev | ||
var previous | ||
@@ -45,10 +45,10 @@ if (character !== asterisk && character !== underscore) { | ||
while (index < length) { | ||
prev = character | ||
previous = character | ||
character = value.charAt(index) | ||
if (character === marker && (!pedantic || !whitespace(prev))) { | ||
if (character === marker && (!pedantic || !whitespace(previous))) { | ||
character = value.charAt(++index) | ||
if (character !== marker) { | ||
if (!trim(queue) || prev === marker) { | ||
if (!trim(queue) || previous === marker) { | ||
return | ||
@@ -55,0 +55,0 @@ } |
@@ -21,3 +21,3 @@ 'use strict' | ||
var cdataOpenExpression = /^<!\[CDATA\[/ | ||
var cdataCloseExpression = /\]\]>/ | ||
var cdataCloseExpression = /]]>/ | ||
var elementCloseExpression = /^$/ | ||
@@ -24,0 +24,0 @@ var otherElementOpenExpression = new RegExp(openCloseTag.source + '\\s*$') |
@@ -109,16 +109,2 @@ 'use strict' | ||
} else { | ||
// Allow white-space between content and url in GFM mode. | ||
if (!pedantic) { | ||
while (index < length) { | ||
character = value.charAt(index + 1) | ||
if (!whitespace(character)) { | ||
break | ||
} | ||
subqueue += character | ||
index++ | ||
} | ||
} | ||
if (value.charAt(index + 1) !== leftParenthesis) { | ||
@@ -125,0 +111,0 @@ return |
@@ -25,3 +25,3 @@ 'use strict' | ||
var looseListItemExpression = /\n\n(?!\s*$)/ | ||
var taskItemExpression = /^\[([ \t]|x|X)][ \t]/ | ||
var taskItemExpression = /^\[([ X\tx])][ \t]/ | ||
var bulletExpression = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/ | ||
@@ -51,3 +51,3 @@ var pedanticBulletExpression = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/ | ||
var line | ||
var prevEmpty | ||
var previousEmpty | ||
var empty | ||
@@ -267,3 +267,3 @@ var items | ||
prevEmpty = empty | ||
previousEmpty = empty | ||
empty = !prefixed && !trim(content).length | ||
@@ -292,3 +292,3 @@ | ||
} else if (empty) { | ||
if (prevEmpty && !commonmark) { | ||
if (previousEmpty && !commonmark) { | ||
break | ||
@@ -299,3 +299,3 @@ } | ||
} else { | ||
if (prevEmpty) { | ||
if (previousEmpty) { | ||
break | ||
@@ -302,0 +302,0 @@ } |
@@ -99,8 +99,2 @@ 'use strict' | ||
if (trim(subvalue) === '') { | ||
eat(subvalue) | ||
return null | ||
} | ||
/* istanbul ignore if - never used (yet) */ | ||
@@ -107,0 +101,0 @@ if (silent) { |
@@ -12,7 +12,5 @@ 'use strict' | ||
var image = 'image' | ||
var footnote = 'footnote' | ||
var shortcut = 'shortcut' | ||
var collapsed = 'collapsed' | ||
var full = 'full' | ||
var space = ' ' | ||
var exclamationMark = '!' | ||
@@ -22,3 +20,2 @@ var leftSquareBracket = '[' | ||
var rightSquareBracket = ']' | ||
var caret = '^' | ||
@@ -28,3 +25,2 @@ function reference(eat, value, silent) { | ||
var commonmark = self.options.commonmark | ||
var footnotes = self.options.footnotes | ||
var character = value.charAt(0) | ||
@@ -61,15 +57,2 @@ var index = 0 | ||
// Check whether we’re eating a footnote. | ||
if (footnotes && value.charAt(index) === caret) { | ||
// Exit if `![^` is found, so the `!` will be seen as text after this, | ||
// and we’ll enter this function again when `[^` is found. | ||
if (type === image) { | ||
return | ||
} | ||
intro += caret | ||
index++ | ||
type = footnote | ||
} | ||
// Eat the text. | ||
@@ -131,9 +114,3 @@ depth = 0 | ||
// Inline footnotes cannot have a label. | ||
// If footnotes are enabled, link labels cannot start with a caret. | ||
if ( | ||
type !== footnote && | ||
character === leftSquareBracket && | ||
(!footnotes || value.charAt(index + 1) !== caret) | ||
) { | ||
if (character === leftSquareBracket) { | ||
identifier = '' | ||
@@ -195,9 +172,2 @@ queue += character | ||
if (type === footnote && content.indexOf(space) !== -1) { | ||
return eat(subvalue)({ | ||
type: footnote, | ||
children: this.tokenizeInline(content, eat.now()) | ||
}) | ||
} | ||
now = eat.now() | ||
@@ -211,9 +181,6 @@ now.column += intro.length | ||
identifier: normalize(identifier), | ||
label: identifier | ||
label: identifier, | ||
referenceType: referenceType | ||
} | ||
if (type === link || type === image) { | ||
node.referenceType = referenceType | ||
} | ||
if (type === link) { | ||
@@ -223,3 +190,3 @@ exit = self.enterLink() | ||
exit() | ||
} else if (type === image) { | ||
} else { | ||
node.alt = self.decode.raw(self.unescape(content), now) || null | ||
@@ -226,0 +193,0 @@ } |
@@ -24,3 +24,3 @@ 'use strict' | ||
var length | ||
var prev | ||
var previous | ||
@@ -47,3 +47,3 @@ if ( | ||
while (index < length) { | ||
prev = character | ||
previous = character | ||
character = value.charAt(index) | ||
@@ -54,3 +54,3 @@ | ||
value.charAt(index + 1) === marker && | ||
(!pedantic || !whitespace(prev)) | ||
(!pedantic || !whitespace(previous)) | ||
) { | ||
@@ -57,0 +57,0 @@ character = value.charAt(index + 2) |
@@ -186,3 +186,3 @@ 'use strict' | ||
if (character) { | ||
subvalue += queue.slice(0, queue.length - 1) | ||
subvalue += queue.slice(0, -1) | ||
queue = queue.charAt(queue.length - 1) | ||
@@ -189,0 +189,0 @@ } else { |
'use strict' | ||
var ccount = require('ccount') | ||
var decode = require('parse-entities') | ||
var decimal = require('is-decimal') | ||
var alphabetical = require('is-alphabetical') | ||
var whitespace = require('is-whitespace-character') | ||
@@ -11,125 +14,186 @@ var locate = require('../locate/url') | ||
var quotationMark = '"' | ||
var apostrophe = "'" | ||
var leftParenthesis = '(' | ||
var rightParenthesis = ')' | ||
var comma = ',' | ||
var dot = '.' | ||
var colon = ':' | ||
var semicolon = ';' | ||
var lessThan = '<' | ||
var atSign = '@' | ||
var leftSquareBracket = '[' | ||
var rightSquareBracket = ']' | ||
var exclamationMark = 33 // '!' | ||
var ampersand = 38 // '&' | ||
var rightParenthesis = 41 // ')' | ||
var asterisk = 42 // '*' | ||
var comma = 44 // ',' | ||
var dash = 45 // '-' | ||
var dot = 46 // '.' | ||
var colon = 58 // ':' | ||
var semicolon = 59 // ';' | ||
var questionMark = 63 // '?' | ||
var lessThan = 60 // '<' | ||
var underscore = 95 // '_' | ||
var tilde = 126 // '~' | ||
var http = 'http://' | ||
var https = 'https://' | ||
var mailto = 'mailto:' | ||
var leftParenthesisCharacter = '(' | ||
var rightParenthesisCharacter = ')' | ||
var protocols = [http, https, mailto] | ||
var protocolsLength = protocols.length | ||
function url(eat, value, silent) { | ||
var self = this | ||
var subvalue | ||
var gfm = self.options.gfm | ||
var tokenizers = self.inlineTokenizers | ||
var length = value.length | ||
var previousDot = -1 | ||
var protocolless = false | ||
var dots | ||
var lastTwoPartsStart | ||
var start | ||
var index | ||
var pathStart | ||
var path | ||
var code | ||
var end | ||
var leftCount | ||
var rightCount | ||
var content | ||
var character | ||
var index | ||
var position | ||
var protocol | ||
var match | ||
var length | ||
var queue | ||
var parenCount | ||
var nextCharacter | ||
var tokenizers | ||
var children | ||
var url | ||
var exit | ||
if (!self.options.gfm) { | ||
if (!gfm) { | ||
return | ||
} | ||
subvalue = '' | ||
index = -1 | ||
// `WWW.` doesn’t work. | ||
if (value.slice(0, 4) === 'www.') { | ||
protocolless = true | ||
index = 4 | ||
} else if (value.slice(0, 7).toLowerCase() === 'http://') { | ||
index = 7 | ||
} else if (value.slice(0, 8).toLowerCase() === 'https://') { | ||
index = 8 | ||
} else { | ||
return | ||
} | ||
while (++index < protocolsLength) { | ||
protocol = protocols[index] | ||
match = value.slice(0, protocol.length) | ||
// Act as if the starting boundary is a dot. | ||
previousDot = index - 1 | ||
if (match.toLowerCase() === protocol) { | ||
subvalue = match | ||
break | ||
// Parse a valid domain. | ||
start = index | ||
dots = [] | ||
while (index < length) { | ||
code = value.charCodeAt(index) | ||
if (code === dot) { | ||
// Dots may not appear after each other. | ||
if (previousDot === index - 1) { | ||
break | ||
} | ||
dots.push(index) | ||
previousDot = index | ||
index++ | ||
continue | ||
} | ||
if ( | ||
decimal(code) || | ||
alphabetical(code) || | ||
code === dash || | ||
code === underscore | ||
) { | ||
index++ | ||
continue | ||
} | ||
break | ||
} | ||
if (!subvalue) { | ||
// Ignore a final dot: | ||
if (code === dot) { | ||
dots.pop() | ||
index-- | ||
} | ||
// If there are not dots, exit. | ||
if (dots[0] === undefined) { | ||
return | ||
} | ||
index = subvalue.length | ||
length = value.length | ||
queue = '' | ||
parenCount = 0 | ||
// If there is an underscore in the last two domain parts, exit: | ||
// `www.example.c_m` and `www.ex_ample.com` are not OK, but | ||
// `www.sub_domain.example.com` is. | ||
lastTwoPartsStart = dots.length < 2 ? start : dots[dots.length - 2] + 1 | ||
if (value.slice(lastTwoPartsStart, index).indexOf('_') !== -1) { | ||
return | ||
} | ||
/* istanbul ignore if - never used (yet) */ | ||
if (silent) { | ||
return true | ||
} | ||
end = index | ||
pathStart = index | ||
// Parse a path. | ||
while (index < length) { | ||
character = value.charAt(index) | ||
code = value.charCodeAt(index) | ||
if (whitespace(character) || character === lessThan) { | ||
if (whitespace(code) || code === lessThan) { | ||
break | ||
} | ||
index++ | ||
if ( | ||
character === dot || | ||
character === comma || | ||
character === colon || | ||
character === semicolon || | ||
character === quotationMark || | ||
character === apostrophe || | ||
character === rightParenthesis || | ||
character === rightSquareBracket | ||
code === exclamationMark || | ||
code === asterisk || | ||
code === comma || | ||
code === dot || | ||
code === colon || | ||
code === questionMark || | ||
code === underscore || | ||
code === tilde | ||
) { | ||
nextCharacter = value.charAt(index + 1) | ||
if (!nextCharacter || whitespace(nextCharacter)) { | ||
break | ||
} | ||
// Empty | ||
} else { | ||
end = index | ||
} | ||
} | ||
if (character === leftParenthesis || character === leftSquareBracket) { | ||
parenCount++ | ||
} | ||
index = end | ||
if (character === rightParenthesis || character === rightSquareBracket) { | ||
parenCount-- | ||
// If the path ends in a closing paren, and the count of closing parens is | ||
// higher than the opening count, then remove the supefluous closing parens. | ||
if (value.charCodeAt(index - 1) === rightParenthesis) { | ||
path = value.slice(pathStart, index) | ||
leftCount = ccount(path, leftParenthesisCharacter) | ||
rightCount = ccount(path, rightParenthesisCharacter) | ||
if (parenCount < 0) { | ||
break | ||
} | ||
while (rightCount > leftCount) { | ||
index = pathStart + path.lastIndexOf(rightParenthesisCharacter) | ||
path = value.slice(pathStart, index) | ||
rightCount-- | ||
} | ||
queue += character | ||
index++ | ||
} | ||
if (!queue) { | ||
return | ||
} | ||
if (value.charCodeAt(index - 1) === semicolon) { | ||
// GitHub doesn’t document this, but final semicolons aren’t paret of the | ||
// URL either. | ||
index-- | ||
subvalue += queue | ||
content = subvalue | ||
// // If the path ends in what looks like an entity, it’s not part of the path. | ||
if (alphabetical(value.charCodeAt(index - 1))) { | ||
end = index - 2 | ||
if (protocol === mailto) { | ||
position = queue.indexOf(atSign) | ||
while (alphabetical(value.charCodeAt(end))) { | ||
end-- | ||
} | ||
if (position === -1 || position === length - 1) { | ||
return | ||
if (value.charCodeAt(end) === ampersand) { | ||
index = end | ||
} | ||
} | ||
content = content.slice(mailto.length) | ||
} | ||
/* istanbul ignore if - never used (yet) */ | ||
if (silent) { | ||
return true | ||
content = value.slice(0, index) | ||
url = decode(content, {nonTerminated: false}) | ||
if (protocolless) { | ||
url = 'http://' + url | ||
} | ||
@@ -140,16 +204,9 @@ | ||
// Temporarily remove all tokenizers except text in url. | ||
tokenizers = self.inlineTokenizers | ||
self.inlineTokenizers = {text: tokenizers.text} | ||
children = self.tokenizeInline(content, eat.now()) | ||
self.inlineTokenizers = tokenizers | ||
content = self.tokenizeInline(content, eat.now()) | ||
self.inlineTokenizers = tokenizers | ||
exit() | ||
return eat(subvalue)({ | ||
type: 'link', | ||
title: null, | ||
url: decode(subvalue, {nonTerminated: false}), | ||
children: content | ||
}) | ||
return eat(content)({type: 'link', title: null, url: url, children: children}) | ||
} |
@@ -49,7 +49,11 @@ 'use strict' | ||
// Previously, we had constructs such as footnotes and YAML that used | ||
// these properties. | ||
// Those are now external (plus there are userland extensions), that may | ||
// still use them. | ||
if ( | ||
method && | ||
/* istanbul ignore next */ (!method.onlyAtStart || self.atStart) && | ||
(!method.notInList || !self.inList) && | ||
(!method.notInBlock || !self.inBlock) && | ||
/* istanbul ignore next */ (!method.notInList || !self.inList) && | ||
/* istanbul ignore next */ (!method.notInBlock || !self.inBlock) && | ||
(!method.notInLink || !self.inLink) | ||
@@ -113,3 +117,3 @@ ) { | ||
// offsets. | ||
return function() { | ||
return function () { | ||
var last = line + 1 | ||
@@ -165,6 +169,6 @@ | ||
function update(node, indent) { | ||
var prev = node.position | ||
var start = prev ? prev.start : before | ||
var previous = node.position | ||
var start = previous ? previous.start : before | ||
var combined = [] | ||
var n = prev && prev.end.line | ||
var n = previous && previous.end.line | ||
var l = before.line | ||
@@ -179,4 +183,4 @@ | ||
// safely check for it now. | ||
if (prev && indent && prev.indent) { | ||
combined = prev.indent | ||
if (previous && indent && previous.indent) { | ||
combined = previous.indent | ||
@@ -204,17 +208,17 @@ if (n < l) { | ||
var children = parent ? parent.children : tokens | ||
var prev = children[children.length - 1] | ||
var previous = children[children.length - 1] | ||
var fn | ||
if ( | ||
prev && | ||
node.type === prev.type && | ||
previous && | ||
node.type === previous.type && | ||
(node.type === 'text' || node.type === 'blockquote') && | ||
mergeable(prev) && | ||
mergeable(previous) && | ||
mergeable(node) | ||
) { | ||
fn = node.type === 'text' ? mergeText : mergeBlockquote | ||
node = fn.call(self, prev, node) | ||
node = fn.call(self, previous, node) | ||
} | ||
if (node !== prev) { | ||
if (node !== previous) { | ||
children.push(node) | ||
@@ -304,10 +308,10 @@ } | ||
// Merge two text nodes: `node` into `prev`. | ||
function mergeText(prev, node) { | ||
prev.value += node.value | ||
function mergeText(previous, node) { | ||
previous.value += node.value | ||
return prev | ||
return previous | ||
} | ||
// Merge two blockquotes: `node` into `prev`, unless in CommonMark or gfm modes. | ||
function mergeBlockquote(prev, node) { | ||
function mergeBlockquote(previous, node) { | ||
if (this.options.commonmark || this.options.gfm) { | ||
@@ -317,5 +321,5 @@ return node | ||
prev.children = prev.children.concat(node.children) | ||
previous.children = previous.children.concat(node.children) | ||
return prev | ||
return previous | ||
} |
@@ -13,3 +13,3 @@ 'use strict' | ||
function unescape(value) { | ||
var prev = 0 | ||
var previous = 0 | ||
var index = value.indexOf(backslash) | ||
@@ -21,5 +21,5 @@ var escape = ctx[key] | ||
while (index !== -1) { | ||
queue.push(value.slice(prev, index)) | ||
prev = index + 1 | ||
character = value.charAt(prev) | ||
queue.push(value.slice(previous, index)) | ||
previous = index + 1 | ||
character = value.charAt(previous) | ||
@@ -31,6 +31,6 @@ // If the following character is not a valid escape, add the slash. | ||
index = value.indexOf(backslash, prev + 1) | ||
index = value.indexOf(backslash, previous + 1) | ||
} | ||
queue.push(value.slice(prev)) | ||
queue.push(value.slice(previous)) | ||
@@ -37,0 +37,0 @@ return queue.join('') |
@@ -5,3 +5,3 @@ 'use strict' | ||
function interrupt(interruptors, tokenizers, ctx, params) { | ||
function interrupt(interruptors, tokenizers, ctx, parameters) { | ||
var length = interruptors.length | ||
@@ -30,3 +30,3 @@ var index = -1 | ||
if (tokenizers[interruptor[0]].apply(ctx, params)) { | ||
if (tokenizers[interruptor[0]].apply(ctx, parameters)) { | ||
return true | ||
@@ -33,0 +33,0 @@ } |
{ | ||
"name": "remark-parse", | ||
"version": "7.0.2", | ||
"version": "8.0.0", | ||
"description": "remark plugin to parse Markdown", | ||
@@ -9,2 +9,3 @@ "license": "MIT", | ||
"remark", | ||
"remark-plugin", | ||
"plugin", | ||
@@ -41,2 +42,3 @@ "markdown", | ||
"dependencies": { | ||
"ccount": "^1.0.0", | ||
"collapse-white-space": "^1.0.2", | ||
@@ -48,3 +50,3 @@ "is-alphabetical": "^1.0.0", | ||
"markdown-escapes": "^1.0.0", | ||
"parse-entities": "^1.1.0", | ||
"parse-entities": "^2.0.0", | ||
"repeat-string": "^1.5.4", | ||
@@ -55,4 +57,4 @@ "state-toggle": "^1.0.0", | ||
"unherit": "^1.0.4", | ||
"unist-util-remove-position": "^1.0.0", | ||
"vfile-location": "^2.0.0", | ||
"unist-util-remove-position": "^2.0.0", | ||
"vfile-location": "^3.0.0", | ||
"xtend": "^4.0.1" | ||
@@ -59,0 +61,0 @@ }, |
113
readme.md
@@ -14,3 +14,3 @@ # remark-parse | ||
Used in the [**remark** processor][remark] but can be used on its own as well. | ||
Can be [extended][extend] to change how markdown is parsed. | ||
Can be [extended][extend] to change how Markdown is parsed. | ||
@@ -23,25 +23,33 @@ ## Sponsors | ||
<tr valign="top"> | ||
<td width="20%" align="center"> | ||
<a href="https://zeit.co"><img src="https://avatars1.githubusercontent.com/u/14985020?s=400&v=4"></a> | ||
<br><br>🥇 | ||
<a href="https://zeit.co">ZEIT</a> | ||
<td width="33.33%" align="center" colspan="2"> | ||
<a href="https://www.gatsbyjs.org">Gatsby</a><br>🥇<br><br> | ||
<a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=900&v=4"></a> | ||
</td> | ||
<td width="20%" align="center"> | ||
<a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=400&v=4"></a> | ||
<br><br>🥇 | ||
<a href="https://www.gatsbyjs.org">Gatsby</a> | ||
<td width="33.33%" align="center" colspan="2"> | ||
<a href="https://zeit.co">ZEIT</a><br>🥇<br><br> | ||
<!--OC has a sharper image--> | ||
<a href="https://zeit.co"><img src="https://images.opencollective.com/zeit/d8a5bee/logo/512.png"></a> | ||
</td> | ||
<td width="20%" align="center"> | ||
<a href="https://www.netlify.com"><img src="https://avatars1.githubusercontent.com/u/7892489?s=400&v=4"></a> | ||
<br><br>🥇 | ||
<a href="https://www.netlify.com">Netlify</a> | ||
<td width="33.33%" align="center" colspan="2"> | ||
<a href="https://www.netlify.com">Netlify</a><br>🥇<br><br> | ||
<!--OC has a sharper image--> | ||
<a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/512.png"></a> | ||
</td> | ||
<td width="20%" align="center"> | ||
<a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=400&v=4"></a> | ||
<br><br> | ||
<a href="https://www.holloway.com">Holloway</a> | ||
</tr> | ||
<tr valign="top"> | ||
<td width="16.67%" align="center"> | ||
<a href="https://www.holloway.com">Holloway</a><br><br><br> | ||
<a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=300&v=4"></a> | ||
</td> | ||
<td width="20%" align="center"> | ||
<td width="16.67%" align="center"> | ||
<a href="https://themeisle.com">ThemeIsle</a><br>🥉<br><br> | ||
<a href="https://themeisle.com"><img src="https://twitter-avatar.now.sh/themeisle"></a> | ||
</td> | ||
<td width="16.67%" align="center"> | ||
<a href="https://boostio.co">BoostIO</a><br>🥉<br><br> | ||
<a href="https://boostio.co"><img src="https://avatars1.githubusercontent.com/u/13612118?s=300&v=4"></a> | ||
</td> | ||
<td width="50%" align="center" colspan="3"> | ||
<br><br><br><br> | ||
<a href="https://opencollective.com/unified"><strong>You?</strong> | ||
<a href="https://opencollective.com/unified"><strong>You?</strong></a> | ||
</td> | ||
@@ -51,4 +59,2 @@ </tr> | ||
[**Read more about the unified collective on Medium »**][announcement] | ||
## Install | ||
@@ -81,3 +87,3 @@ | ||
## Table of Contents | ||
## Contents | ||
@@ -87,3 +93,3 @@ * [API](#api) | ||
* [`parse.Parser`](#parseparser) | ||
* [Extending the Parser](#extending-the-parser) | ||
* [Extending the `Parser`](#extending-the-parser) | ||
* [`Parser#blockTokenizers`](#parserblocktokenizers) | ||
@@ -145,7 +151,7 @@ * [`Parser#blockMethods`](#parserblockmethods) | ||
* Empty lines to split blockquotes | ||
* Empty lines to split block quotes | ||
* Parentheses (`(` and `)`) around link and image titles | ||
* Any escaped [ASCII punctuation][escapes] character | ||
* Closing parenthesis (`)`) as an ordered list marker | ||
* URL definitions (and footnotes, when enabled) in blockquotes | ||
* URL definitions in block quotes | ||
@@ -161,40 +167,12 @@ Disallows: | ||
`>`) | ||
* Lazy blockquote continuation, lines not preceded by a greater than character | ||
(`>`), for lists, code, and thematic breaks | ||
* Lazy block quote continuation, lines not preceded by a greater than | ||
character (`>`), for lists, code, and thematic breaks | ||
###### `options.footnotes` | ||
Footnotes mode (`boolean`, default: `false`). | ||
```markdown | ||
Something something[^or something?]. | ||
And something else[^1]. | ||
[^1]: This reference footnote contains a paragraph... | ||
* ...and a list | ||
``` | ||
Enables reference footnotes and inline footnotes. | ||
Both are wrapped in square brackets and preceded by a caret (`^`), and can be | ||
referenced from inside other footnotes. | ||
###### `options.pedantic` | ||
Pedantic mode (`boolean`, default: `false`). | ||
⚠️ Pedantic was previously used to mimic old-style Markdown mode: no tables, no | ||
fenced code, and with many bugs. | ||
It’s currently still “working”, but please do not use it, it’ll be removed in | ||
the future. | ||
```markdown | ||
Check out some_file_name.txt | ||
``` | ||
Turns on: | ||
* Emphasis (`_alpha_`) and importance (`__bravo__`) with underscores in words | ||
* Unordered lists with different markers (`*`, `-`, `+`) | ||
* If `commonmark` is also turned on, ordered lists with different markers | ||
(`.`, `)`) | ||
* And removes less spaces in list items (at most four, instead of the whole | ||
indent) | ||
###### `options.blocks` | ||
@@ -215,3 +193,3 @@ | ||
## Extending the Parser | ||
## Extending the `Parser` | ||
@@ -263,3 +241,3 @@ Typically, using [*transformers*][transformer] to manipulate a syntax tree | ||
* `newline` | ||
* `blankLine` | ||
* `indentedCode` | ||
@@ -273,3 +251,2 @@ * `fencedCode` | ||
* `html` | ||
* `footnote` | ||
* `definition` | ||
@@ -302,2 +279,3 @@ * `table` | ||
* `url` | ||
* `email` | ||
* `html` | ||
@@ -368,4 +346,3 @@ * `link` | ||
of the document | ||
* `notInBlock` (`boolean`) — Whether nodes cannot be in blockquotes, lists, or | ||
footnote definitions | ||
* `notInBlock` (`boolean`) — Whether nodes cannot be in block quotes or lists | ||
* `notInList` (`boolean`) — Whether nodes cannot be in lists | ||
@@ -515,4 +492,4 @@ * `notInLink` (`boolean`) — Whether nodes cannot be in links | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
This project has a [code of conduct][coc]. | ||
By interacting with this repository, organization, or community you agree to | ||
abide by its terms. | ||
@@ -548,3 +525,3 @@ | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg | ||
@@ -603,4 +580,2 @@ [chat]: https://spectrum.chat/unified/remark | ||
[announcement]: https://medium.com/unifiedjs/collectively-evolving-through-crowdsourcing-22c359ea95cc | ||
[remark-disable-tokenizers]: https://github.com/zestedesavoir/zmarkdown/tree/master/packages/remark-disable-tokenizers | ||
@@ -607,0 +582,0 @@ |
@@ -12,2 +12,3 @@ // TypeScript Version: 3.0 | ||
} | ||
inlineMethods: string[] | ||
@@ -17,4 +18,4 @@ } | ||
declare namespace remarkParse { | ||
interface Parse extends Plugin<[Partial<RemarkParseOptions>?]> { | ||
(options: Partial<RemarkParseOptions>): void | ||
interface Parse extends Plugin<[PartialRemarkParseOptions?]> { | ||
(options: PartialRemarkParseOptions): void | ||
Parser: typeof RemarkParser | ||
@@ -26,9 +27,62 @@ } | ||
interface RemarkParseOptions { | ||
/** | ||
* GFM mode | ||
* | ||
* Turns on: | ||
* * Fenced code blocks | ||
* * Autolinking of URLs | ||
* * Deletions (strikethrough) | ||
* * Task lists | ||
* * Tables | ||
* | ||
* @defaultValue `true` | ||
*/ | ||
gfm: boolean | ||
/** | ||
* CommonMark mode | ||
* | ||
* Allows: | ||
* * Empty lines to split blockquotes | ||
* * Parentheses (`(` and `)`) around link and image titles | ||
* * Any escaped ASCII punctuation character | ||
* * Closing parenthesis (`)`) as an ordered list marker | ||
* * URL definitions in blockquotes | ||
* | ||
* Disallows: | ||
* * Indented code blocks directly following a paragraph | ||
* * ATX headings (# Hash headings) without spacing after opening hashes or and before closing hashes | ||
* * Setext headings (`Underline headings\n---`) when following a paragraph | ||
* * Newlines in link and image titles | ||
* * White space in link and image URLs in auto-links (links in brackets, `<` and `>`) | ||
* * Lazy blockquote continuation, lines not preceded by a greater than character (`>`), for lists, code, and thematic breaks | ||
* | ||
* @defaultValue `false` | ||
*/ | ||
commonmark: boolean | ||
footnotes: boolean | ||
/** | ||
* Defines which HTML elements are seen as block level. | ||
* | ||
* @defaultValue blocks listed in <https://github.com/remarkjs/remark/blob/master/packages/remark-parse/lib/block-elements.js> | ||
*/ | ||
blocks: string[] | ||
/** | ||
* Pedantic mode | ||
* | ||
* Turns on: | ||
* * Emphasis (`_alpha_`) and importance (`__bravo__`) with underscores in words | ||
* * Unordered lists with different markers (`*`, `-`, `+`) | ||
* * If commonmark is also turned on, ordered lists with different markers (`.`, `)`) | ||
* * And removes less spaces in list items (at most four, instead of the whole indent) | ||
* | ||
* @defaultValue `false` | ||
* @deprecated pedantic mode is buggy. It won’t be in micromark, which will be the basis of a future version of remark. | ||
*/ | ||
pedantic: boolean | ||
} | ||
type PartialRemarkParseOptions = Partial<RemarkParseOptions> | ||
interface Add { | ||
@@ -35,0 +89,0 @@ (node: Node, parent?: Parent): Node |
121344
54
3844
16
573
+ Addedccount@^1.0.0
+ Added@types/unist@2.0.10(transitive)
+ Addedccount@1.1.0(transitive)
+ Addedparse-entities@2.0.0(transitive)
+ Addedunist-util-is@4.1.0(transitive)
+ Addedunist-util-remove-position@2.0.1(transitive)
+ Addedunist-util-visit@2.0.3(transitive)
+ Addedunist-util-visit-parents@3.1.1(transitive)
+ Addedvfile-location@3.2.0(transitive)
- Removedparse-entities@1.2.2(transitive)
- Removedunist-util-is@3.0.0(transitive)
- Removedunist-util-remove-position@1.1.4(transitive)
- Removedunist-util-visit@1.4.1(transitive)
- Removedunist-util-visit-parents@2.1.2(transitive)
- Removedvfile-location@2.0.6(transitive)
Updatedparse-entities@^2.0.0
Updatedvfile-location@^3.0.0