Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function listItem (h, node, parent) {
const children = node.children
const head = children[0]
const raw = all(h, node)
const loose = parent ? listLoose(parent) : listItemLoose(node)
const props = {}
let result
let container
let index
let length
let child
// Tight lists should not render `paragraph` nodes as `p` elements.
if (loose) {
result = raw
} else {
result = []
length = raw.length
index = -1
export default function list (h, node) {
const props = {}
const name = node.ordered ? 'ol' : 'ul'
let index = -1
if (typeof node.start === 'number' && node.start !== 1) {
props.start = node.start
}
const items = all(h, node)
const length = items.length
// Like GitHub, add a class for custom styling.
while (++index < length) {
if (
items[index].properties.className &&
items[index].properties.className.includes('task-list-item')
) {
props.className = ['contains-task-list']
break
}
}
return h(node, name, props, wrap(items, true))
}
export default function linkReference (h, node) {
const def = h.definition(node.identifier)
if (!def) {
return revert(h, node)
}
const props = { href: normalize(def.url || '') }
if (def.title !== null && def.title !== undefined) {
props.title = def.title
}
return h(node, 'a', props, all(h, node))
}
export default function strikethrough (h, node) {
return h(node, 'del', all(h, node))
}
export default function paragraph (h, node) {
return h(node, 'p', all(h, node))
}
const props = {}
if (node.title !== null && node.title !== undefined) {
props.title = node.title
}
if (url.startsWith('#') || url.match(/^https?:\/\//)) {
props.href = url
tagName = 'a'
} else {
props.to = url
tagName = 'nuxt-link'
props['data-press-link'] = 'true'
}
return h(node, tagName, props, all(h, node))
}
export default function strong (h, node) {
return h(node, 'strong', all(h, node))
}
export default function heading (h, node) {
let link
const _link = node.children.find(c => c.type === 'link')
if (_link && _link.url.startsWith('#')) {
link = _link.url
}
const text = extractText(node)
if (this.toc && text && link) {
this.toc.push([node.depth, text, link])
}
return h(node, `h${node.depth}`, all(h, node))
}
const result = []
let pos
let row
let out
let name
let cell
while (index--) {
row = rows[index].children
name = index === 0 ? 'th' : 'td'
pos = alignLength
out = []
while (pos--) {
cell = row[pos]
out[pos] = h(cell, name, { align: align[pos] }, cell ? all(h, cell) : [])
}
result[index] = h(rows[index], 'tr', wrap(out, true))
}
return h(
node,
'table',
wrap(
[
h(result[0].position, 'thead', wrap([result[0]], true)),
h(
{
start: position.start(result[1]),
end: position.end(result[result.length - 1])
},