Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* isn’t compiled using a tab.
*/
if (
parent &&
parent.type === 'listItem' &&
options.listItemIndent !== LIST_ITEM_TAB &&
options.pedantic
) {
throw new Error(ERROR_LIST_ITEM_INDENT + node.position)
}
return pad(value, 1)
}
let fence = longestStreak(value, marker) + 1
/*
* Fix GFM / RedCarpet bug, where fence-like characters
* inside fenced code can exit a code-block.
* Yes, even when the outer fence uses different
* characters, or is longer.
* Thus, we can only pad the code to make it work.
*/
if (FENCE.test(value)) {
value = pad(value, 1)
}
const fenceMarkdown = marker.repeat(Math.max(fence, MINIMUM_CODE_FENCE_LENGTH))
return `${fenceMarkdown + language}\n${value}\n${fenceMarkdown}`
const visitor: Visitor = (compiler, node) => {
const ticks = '`'.repeat(longestStreak(node.value, '`') + 1)
let start = ticks
let end = ticks
if (node.value.charAt(0) === '`') {
start += ' '
}
if (node.value.charAt(node.value.length - 1) === '`') {
end = ` ${end}`
}
return start + node.value + end
}