This commit is contained in:
15
node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
generated
vendored
Normal file
15
node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
module.exports = blockquote
|
||||
|
||||
var flow = require('../util/container-flow')
|
||||
var indentLines = require('../util/indent-lines')
|
||||
|
||||
function blockquote(node, _, context) {
|
||||
var exit = context.enter('blockquote')
|
||||
var value = indentLines(flow(node, context), map)
|
||||
exit()
|
||||
return value
|
||||
}
|
||||
|
||||
function map(line, index, blank) {
|
||||
return '>' + (blank ? '' : ' ') + line
|
||||
}
|
||||
20
node_modules/mdast-util-to-markdown/lib/handle/break.js
generated
vendored
Normal file
20
node_modules/mdast-util-to-markdown/lib/handle/break.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
module.exports = hardBreak
|
||||
|
||||
var patternInScope = require('../util/pattern-in-scope')
|
||||
|
||||
function hardBreak(node, _, context, safe) {
|
||||
var index = -1
|
||||
|
||||
while (++index < context.unsafe.length) {
|
||||
// If we can’t put eols in this construct (setext headings, tables), use a
|
||||
// space instead.
|
||||
if (
|
||||
context.unsafe[index].character === '\n' &&
|
||||
patternInScope(context.stack, context.unsafe[index])
|
||||
) {
|
||||
return /[ \t]/.test(safe.before) ? '' : ' '
|
||||
}
|
||||
}
|
||||
|
||||
return '\\\n'
|
||||
}
|
||||
64
node_modules/mdast-util-to-markdown/lib/handle/code.js
generated
vendored
Normal file
64
node_modules/mdast-util-to-markdown/lib/handle/code.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
module.exports = code
|
||||
|
||||
var repeat = require('repeat-string')
|
||||
var streak = require('longest-streak')
|
||||
var formatCodeAsIndented = require('../util/format-code-as-indented')
|
||||
var checkFence = require('../util/check-fence')
|
||||
var indentLines = require('../util/indent-lines')
|
||||
var safe = require('../util/safe')
|
||||
|
||||
function code(node, _, context) {
|
||||
var marker = checkFence(context)
|
||||
var raw = node.value || ''
|
||||
var suffix = marker === '`' ? 'GraveAccent' : 'Tilde'
|
||||
var value
|
||||
var sequence
|
||||
var exit
|
||||
var subexit
|
||||
|
||||
if (formatCodeAsIndented(node, context)) {
|
||||
exit = context.enter('codeIndented')
|
||||
value = indentLines(raw, map)
|
||||
} else {
|
||||
sequence = repeat(marker, Math.max(streak(raw, marker) + 1, 3))
|
||||
exit = context.enter('codeFenced')
|
||||
value = sequence
|
||||
|
||||
if (node.lang) {
|
||||
subexit = context.enter('codeFencedLang' + suffix)
|
||||
value += safe(context, node.lang, {
|
||||
before: '`',
|
||||
after: ' ',
|
||||
encode: ['`']
|
||||
})
|
||||
subexit()
|
||||
}
|
||||
|
||||
if (node.lang && node.meta) {
|
||||
subexit = context.enter('codeFencedMeta' + suffix)
|
||||
value +=
|
||||
' ' +
|
||||
safe(context, node.meta, {
|
||||
before: ' ',
|
||||
after: '\n',
|
||||
encode: ['`']
|
||||
})
|
||||
subexit()
|
||||
}
|
||||
|
||||
value += '\n'
|
||||
|
||||
if (raw) {
|
||||
value += raw + '\n'
|
||||
}
|
||||
|
||||
value += sequence
|
||||
}
|
||||
|
||||
exit()
|
||||
return value
|
||||
}
|
||||
|
||||
function map(line, _, blank) {
|
||||
return (blank ? '' : ' ') + line
|
||||
}
|
||||
46
node_modules/mdast-util-to-markdown/lib/handle/definition.js
generated
vendored
Normal file
46
node_modules/mdast-util-to-markdown/lib/handle/definition.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
module.exports = definition
|
||||
|
||||
var association = require('../util/association')
|
||||
var checkQuote = require('../util/check-quote')
|
||||
var safe = require('../util/safe')
|
||||
|
||||
function definition(node, _, context) {
|
||||
var marker = checkQuote(context)
|
||||
var suffix = marker === '"' ? 'Quote' : 'Apostrophe'
|
||||
var exit = context.enter('definition')
|
||||
var subexit = context.enter('label')
|
||||
var value =
|
||||
'[' + safe(context, association(node), {before: '[', after: ']'}) + ']: '
|
||||
|
||||
subexit()
|
||||
|
||||
if (
|
||||
// If there’s no url, or…
|
||||
!node.url ||
|
||||
// If there’s whitespace, enclosed is prettier.
|
||||
/[ \t\r\n]/.test(node.url)
|
||||
) {
|
||||
subexit = context.enter('destinationLiteral')
|
||||
value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'
|
||||
} else {
|
||||
// No whitespace, raw is prettier.
|
||||
subexit = context.enter('destinationRaw')
|
||||
value += safe(context, node.url, {before: ' ', after: ' '})
|
||||
}
|
||||
|
||||
subexit()
|
||||
|
||||
if (node.title) {
|
||||
subexit = context.enter('title' + suffix)
|
||||
value +=
|
||||
' ' +
|
||||
marker +
|
||||
safe(context, node.title, {before: marker, after: marker}) +
|
||||
marker
|
||||
subexit()
|
||||
}
|
||||
|
||||
exit()
|
||||
|
||||
return value
|
||||
}
|
||||
21
node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
module.exports = emphasis
|
||||
emphasis.peek = emphasisPeek
|
||||
|
||||
var checkEmphasis = require('../util/check-emphasis')
|
||||
var phrasing = require('../util/container-phrasing')
|
||||
|
||||
// To do: there are cases where emphasis cannot “form” depending on the
|
||||
// previous or next character of sequences.
|
||||
// There’s no way around that though, except for injecting zero-width stuff.
|
||||
// Do we need to safeguard against that?
|
||||
function emphasis(node, _, context) {
|
||||
var marker = checkEmphasis(context)
|
||||
var exit = context.enter('emphasis')
|
||||
var value = phrasing(node, context, {before: marker, after: marker})
|
||||
exit()
|
||||
return marker + value + marker
|
||||
}
|
||||
|
||||
function emphasisPeek(node, _, context) {
|
||||
return context.options.emphasis || '*'
|
||||
}
|
||||
48
node_modules/mdast-util-to-markdown/lib/handle/heading.js
generated
vendored
Normal file
48
node_modules/mdast-util-to-markdown/lib/handle/heading.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
module.exports = heading
|
||||
|
||||
var repeat = require('repeat-string')
|
||||
var formatHeadingAsSetext = require('../util/format-heading-as-setext')
|
||||
var phrasing = require('../util/container-phrasing')
|
||||
|
||||
function heading(node, _, context) {
|
||||
var rank = Math.max(Math.min(6, node.depth || 1), 1)
|
||||
var exit
|
||||
var subexit
|
||||
var value
|
||||
var sequence
|
||||
|
||||
if (formatHeadingAsSetext(node, context)) {
|
||||
exit = context.enter('headingSetext')
|
||||
subexit = context.enter('phrasing')
|
||||
value = phrasing(node, context, {before: '\n', after: '\n'})
|
||||
subexit()
|
||||
exit()
|
||||
|
||||
return (
|
||||
value +
|
||||
'\n' +
|
||||
repeat(
|
||||
rank === 1 ? '=' : '-',
|
||||
// The whole size…
|
||||
value.length -
|
||||
// Minus the position of the character after the last EOL (or
|
||||
// 0 if there is none)…
|
||||
(Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
sequence = repeat('#', rank)
|
||||
exit = context.enter('headingAtx')
|
||||
subexit = context.enter('phrasing')
|
||||
value = phrasing(node, context, {before: '# ', after: '\n'})
|
||||
value = value ? sequence + ' ' + value : sequence
|
||||
if (context.options.closeAtx) {
|
||||
value += ' ' + sequence
|
||||
}
|
||||
|
||||
subexit()
|
||||
exit()
|
||||
|
||||
return value
|
||||
}
|
||||
10
node_modules/mdast-util-to-markdown/lib/handle/html.js
generated
vendored
Normal file
10
node_modules/mdast-util-to-markdown/lib/handle/html.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = html
|
||||
html.peek = htmlPeek
|
||||
|
||||
function html(node) {
|
||||
return node.value || ''
|
||||
}
|
||||
|
||||
function htmlPeek() {
|
||||
return '<'
|
||||
}
|
||||
37
node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
generated
vendored
Normal file
37
node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
module.exports = imageReference
|
||||
imageReference.peek = imageReferencePeek
|
||||
|
||||
var association = require('../util/association')
|
||||
var safe = require('../util/safe')
|
||||
|
||||
function imageReference(node, _, context) {
|
||||
var type = node.referenceType
|
||||
var exit = context.enter('imageReference')
|
||||
var subexit = context.enter('label')
|
||||
var alt = safe(context, node.alt, {before: '[', after: ']'})
|
||||
var value = '![' + alt + ']'
|
||||
var reference
|
||||
var stack
|
||||
|
||||
subexit()
|
||||
// Hide the fact that we’re in phrasing, because escapes don’t work.
|
||||
stack = context.stack
|
||||
context.stack = []
|
||||
subexit = context.enter('reference')
|
||||
reference = safe(context, association(node), {before: '[', after: ']'})
|
||||
subexit()
|
||||
context.stack = stack
|
||||
exit()
|
||||
|
||||
if (type === 'full' || !alt || alt !== reference) {
|
||||
value += '[' + reference + ']'
|
||||
} else if (type !== 'shortcut') {
|
||||
value += '[]'
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
function imageReferencePeek() {
|
||||
return '!'
|
||||
}
|
||||
53
node_modules/mdast-util-to-markdown/lib/handle/image.js
generated
vendored
Normal file
53
node_modules/mdast-util-to-markdown/lib/handle/image.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
module.exports = image
|
||||
image.peek = imagePeek
|
||||
|
||||
var checkQuote = require('../util/check-quote')
|
||||
var safe = require('../util/safe')
|
||||
|
||||
function image(node, _, context) {
|
||||
var quote = checkQuote(context)
|
||||
var suffix = quote === '"' ? 'Quote' : 'Apostrophe'
|
||||
var exit = context.enter('image')
|
||||
var subexit = context.enter('label')
|
||||
var value = '![' + safe(context, node.alt, {before: '[', after: ']'}) + ']('
|
||||
|
||||
subexit()
|
||||
|
||||
if (
|
||||
// If there’s no url but there is a title…
|
||||
(!node.url && node.title) ||
|
||||
// Or if there’s markdown whitespace or an eol, enclose.
|
||||
/[ \t\r\n]/.test(node.url)
|
||||
) {
|
||||
subexit = context.enter('destinationLiteral')
|
||||
value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'
|
||||
} else {
|
||||
// No whitespace, raw is prettier.
|
||||
subexit = context.enter('destinationRaw')
|
||||
value += safe(context, node.url, {
|
||||
before: '(',
|
||||
after: node.title ? ' ' : ')'
|
||||
})
|
||||
}
|
||||
|
||||
subexit()
|
||||
|
||||
if (node.title) {
|
||||
subexit = context.enter('title' + suffix)
|
||||
value +=
|
||||
' ' +
|
||||
quote +
|
||||
safe(context, node.title, {before: quote, after: quote}) +
|
||||
quote
|
||||
subexit()
|
||||
}
|
||||
|
||||
value += ')'
|
||||
exit()
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
function imagePeek() {
|
||||
return '!'
|
||||
}
|
||||
20
node_modules/mdast-util-to-markdown/lib/handle/index.js
generated
vendored
Normal file
20
node_modules/mdast-util-to-markdown/lib/handle/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
exports.blockquote = require('./blockquote')
|
||||
exports.break = require('./break')
|
||||
exports.code = require('./code')
|
||||
exports.definition = require('./definition')
|
||||
exports.emphasis = require('./emphasis')
|
||||
exports.hardBreak = require('./break')
|
||||
exports.heading = require('./heading')
|
||||
exports.html = require('./html')
|
||||
exports.image = require('./image')
|
||||
exports.imageReference = require('./image-reference')
|
||||
exports.inlineCode = require('./inline-code')
|
||||
exports.link = require('./link')
|
||||
exports.linkReference = require('./link-reference')
|
||||
exports.list = require('./list')
|
||||
exports.listItem = require('./list-item')
|
||||
exports.paragraph = require('./paragraph')
|
||||
exports.root = require('./root')
|
||||
exports.strong = require('./strong')
|
||||
exports.text = require('./text')
|
||||
exports.thematicBreak = require('./thematic-break')
|
||||
69
node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
generated
vendored
Normal file
69
node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
module.exports = inlineCode
|
||||
inlineCode.peek = inlineCodePeek
|
||||
|
||||
var patternCompile = require('../util/pattern-compile')
|
||||
|
||||
function inlineCode(node, parent, context) {
|
||||
var value = node.value || ''
|
||||
var sequence = '`'
|
||||
var index = -1
|
||||
var pattern
|
||||
var expression
|
||||
var match
|
||||
var position
|
||||
|
||||
// If there is a single grave accent on its own in the code, use a fence of
|
||||
// two.
|
||||
// If there are two in a row, use one.
|
||||
while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {
|
||||
sequence += '`'
|
||||
}
|
||||
|
||||
// If this is not just spaces or eols (tabs don’t count), and either the
|
||||
// first or last character are a space, eol, or tick, then pad with spaces.
|
||||
if (
|
||||
/[^ \r\n]/.test(value) &&
|
||||
(/[ \r\n`]/.test(value.charAt(0)) ||
|
||||
/[ \r\n`]/.test(value.charAt(value.length - 1)))
|
||||
) {
|
||||
value = ' ' + value + ' '
|
||||
}
|
||||
|
||||
// We have a potential problem: certain characters after eols could result in
|
||||
// blocks being seen.
|
||||
// For example, if someone injected the string `'\n# b'`, then that would
|
||||
// result in an ATX heading.
|
||||
// We can’t escape characters in `inlineCode`, but because eols are
|
||||
// transformed to spaces when going from markdown to HTML anyway, we can swap
|
||||
// them out.
|
||||
while (++index < context.unsafe.length) {
|
||||
pattern = context.unsafe[index]
|
||||
|
||||
// Only look for `atBreak`s.
|
||||
// Btw: note that `atBreak` patterns will always start the regex at LF or
|
||||
// CR.
|
||||
if (!pattern.atBreak) continue
|
||||
|
||||
expression = patternCompile(pattern)
|
||||
|
||||
while ((match = expression.exec(value))) {
|
||||
position = match.index
|
||||
|
||||
// Support CRLF (patterns only look for one of the characters).
|
||||
if (
|
||||
value.charCodeAt(position) === 10 /* `\n` */ &&
|
||||
value.charCodeAt(position - 1) === 13 /* `\r` */
|
||||
) {
|
||||
position--
|
||||
}
|
||||
|
||||
value = value.slice(0, position) + ' ' + value.slice(match.index + 1)
|
||||
}
|
||||
}
|
||||
|
||||
return sequence + value + sequence
|
||||
}
|
||||
|
||||
function inlineCodePeek() {
|
||||
return '`'
|
||||
}
|
||||
38
node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
generated
vendored
Normal file
38
node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
module.exports = linkReference
|
||||
linkReference.peek = linkReferencePeek
|
||||
|
||||
var association = require('../util/association')
|
||||
var phrasing = require('../util/container-phrasing')
|
||||
var safe = require('../util/safe')
|
||||
|
||||
function linkReference(node, _, context) {
|
||||
var type = node.referenceType
|
||||
var exit = context.enter('linkReference')
|
||||
var subexit = context.enter('label')
|
||||
var text = phrasing(node, context, {before: '[', after: ']'})
|
||||
var value = '[' + text + ']'
|
||||
var reference
|
||||
var stack
|
||||
|
||||
subexit()
|
||||
// Hide the fact that we’re in phrasing, because escapes don’t work.
|
||||
stack = context.stack
|
||||
context.stack = []
|
||||
subexit = context.enter('reference')
|
||||
reference = safe(context, association(node), {before: '[', after: ']'})
|
||||
subexit()
|
||||
context.stack = stack
|
||||
exit()
|
||||
|
||||
if (type === 'full' || !text || text !== reference) {
|
||||
value += '[' + reference + ']'
|
||||
} else if (type !== 'shortcut') {
|
||||
value += '[]'
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
function linkReferencePeek() {
|
||||
return '['
|
||||
}
|
||||
70
node_modules/mdast-util-to-markdown/lib/handle/link.js
generated
vendored
Normal file
70
node_modules/mdast-util-to-markdown/lib/handle/link.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
module.exports = link
|
||||
link.peek = linkPeek
|
||||
|
||||
var checkQuote = require('../util/check-quote')
|
||||
var formatLinkAsAutolink = require('../util/format-link-as-autolink')
|
||||
var phrasing = require('../util/container-phrasing')
|
||||
var safe = require('../util/safe')
|
||||
|
||||
function link(node, _, context) {
|
||||
var quote = checkQuote(context)
|
||||
var suffix = quote === '"' ? 'Quote' : 'Apostrophe'
|
||||
var exit
|
||||
var subexit
|
||||
var value
|
||||
var stack
|
||||
|
||||
if (formatLinkAsAutolink(node, context)) {
|
||||
// Hide the fact that we’re in phrasing, because escapes don’t work.
|
||||
stack = context.stack
|
||||
context.stack = []
|
||||
exit = context.enter('autolink')
|
||||
value = '<' + phrasing(node, context, {before: '<', after: '>'}) + '>'
|
||||
exit()
|
||||
context.stack = stack
|
||||
return value
|
||||
}
|
||||
|
||||
exit = context.enter('link')
|
||||
subexit = context.enter('label')
|
||||
value = '[' + phrasing(node, context, {before: '[', after: ']'}) + ']('
|
||||
subexit()
|
||||
|
||||
if (
|
||||
// If there’s no url but there is a title…
|
||||
(!node.url && node.title) ||
|
||||
// Or if there’s markdown whitespace or an eol, enclose.
|
||||
/[ \t\r\n]/.test(node.url)
|
||||
) {
|
||||
subexit = context.enter('destinationLiteral')
|
||||
value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'
|
||||
} else {
|
||||
// No whitespace, raw is prettier.
|
||||
subexit = context.enter('destinationRaw')
|
||||
value += safe(context, node.url, {
|
||||
before: '(',
|
||||
after: node.title ? ' ' : ')'
|
||||
})
|
||||
}
|
||||
|
||||
subexit()
|
||||
|
||||
if (node.title) {
|
||||
subexit = context.enter('title' + suffix)
|
||||
value +=
|
||||
' ' +
|
||||
quote +
|
||||
safe(context, node.title, {before: quote, after: quote}) +
|
||||
quote
|
||||
subexit()
|
||||
}
|
||||
|
||||
value += ')'
|
||||
|
||||
exit()
|
||||
return value
|
||||
}
|
||||
|
||||
function linkPeek(node, _, context) {
|
||||
return formatLinkAsAutolink(node, context) ? '<' : '['
|
||||
}
|
||||
47
node_modules/mdast-util-to-markdown/lib/handle/list-item.js
generated
vendored
Normal file
47
node_modules/mdast-util-to-markdown/lib/handle/list-item.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
module.exports = listItem
|
||||
|
||||
var repeat = require('repeat-string')
|
||||
var checkBullet = require('../util/check-bullet')
|
||||
var checkListItemIndent = require('../util/check-list-item-indent')
|
||||
var flow = require('../util/container-flow')
|
||||
var indentLines = require('../util/indent-lines')
|
||||
|
||||
function listItem(node, parent, context) {
|
||||
var bullet = checkBullet(context)
|
||||
var listItemIndent = checkListItemIndent(context)
|
||||
var size
|
||||
var value
|
||||
var exit
|
||||
|
||||
if (parent && parent.ordered) {
|
||||
bullet =
|
||||
(parent.start > -1 ? parent.start : 1) +
|
||||
(context.options.incrementListMarker === false
|
||||
? 0
|
||||
: parent.children.indexOf(node)) +
|
||||
'.'
|
||||
}
|
||||
|
||||
size = bullet.length + 1
|
||||
|
||||
if (
|
||||
listItemIndent === 'tab' ||
|
||||
(listItemIndent === 'mixed' && ((parent && parent.spread) || node.spread))
|
||||
) {
|
||||
size = Math.ceil(size / 4) * 4
|
||||
}
|
||||
|
||||
exit = context.enter('listItem')
|
||||
value = indentLines(flow(node, context), map)
|
||||
exit()
|
||||
|
||||
return value
|
||||
|
||||
function map(line, index, blank) {
|
||||
if (index) {
|
||||
return (blank ? '' : repeat(' ', size)) + line
|
||||
}
|
||||
|
||||
return (blank ? bullet : bullet + repeat(' ', size - bullet.length)) + line
|
||||
}
|
||||
}
|
||||
10
node_modules/mdast-util-to-markdown/lib/handle/list.js
generated
vendored
Normal file
10
node_modules/mdast-util-to-markdown/lib/handle/list.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = list
|
||||
|
||||
var flow = require('../util/container-flow')
|
||||
|
||||
function list(node, _, context) {
|
||||
var exit = context.enter('list')
|
||||
var value = flow(node, context)
|
||||
exit()
|
||||
return value
|
||||
}
|
||||
12
node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
generated
vendored
Normal file
12
node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = paragraph
|
||||
|
||||
var phrasing = require('../util/container-phrasing')
|
||||
|
||||
function paragraph(node, _, context) {
|
||||
var exit = context.enter('paragraph')
|
||||
var subexit = context.enter('phrasing')
|
||||
var value = phrasing(node, context, {before: '\n', after: '\n'})
|
||||
subexit()
|
||||
exit()
|
||||
return value
|
||||
}
|
||||
7
node_modules/mdast-util-to-markdown/lib/handle/root.js
generated
vendored
Normal file
7
node_modules/mdast-util-to-markdown/lib/handle/root.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = root
|
||||
|
||||
var flow = require('../util/container-flow')
|
||||
|
||||
function root(node, _, context) {
|
||||
return flow(node, context)
|
||||
}
|
||||
21
node_modules/mdast-util-to-markdown/lib/handle/strong.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/handle/strong.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
module.exports = strong
|
||||
strong.peek = strongPeek
|
||||
|
||||
var checkStrong = require('../util/check-strong')
|
||||
var phrasing = require('../util/container-phrasing')
|
||||
|
||||
// To do: there are cases where emphasis cannot “form” depending on the
|
||||
// previous or next character of sequences.
|
||||
// There’s no way around that though, except for injecting zero-width stuff.
|
||||
// Do we need to safeguard against that?
|
||||
function strong(node, _, context) {
|
||||
var marker = checkStrong(context)
|
||||
var exit = context.enter('strong')
|
||||
var value = phrasing(node, context, {before: marker, after: marker})
|
||||
exit()
|
||||
return marker + marker + value + marker + marker
|
||||
}
|
||||
|
||||
function strongPeek(node, _, context) {
|
||||
return context.options.strong || '*'
|
||||
}
|
||||
7
node_modules/mdast-util-to-markdown/lib/handle/text.js
generated
vendored
Normal file
7
node_modules/mdast-util-to-markdown/lib/handle/text.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = text
|
||||
|
||||
var safe = require('../util/safe')
|
||||
|
||||
function text(node, parent, context, safeOptions) {
|
||||
return safe(context, node.value, safeOptions)
|
||||
}
|
||||
14
node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
generated
vendored
Normal file
14
node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = thematicBreak
|
||||
|
||||
var repeat = require('repeat-string')
|
||||
var checkRepeat = require('../util/check-rule-repeat')
|
||||
var checkRule = require('../util/check-rule')
|
||||
|
||||
function thematicBreak(node, parent, context) {
|
||||
var value = repeat(
|
||||
checkRule(context) + (context.options.ruleSpaces ? ' ' : ''),
|
||||
checkRepeat(context)
|
||||
)
|
||||
|
||||
return context.options.ruleSpaces ? value.slice(0, -1) : value
|
||||
}
|
||||
Reference in New Issue
Block a user