@atjson/renderer-commonmark
Advanced tools
Comparing version 0.6.5 to 0.7.1
@@ -22,12 +22,48 @@ "use strict"; | ||
exports.split = split; | ||
function escapePunctuation(text) { | ||
return text.replace(/([#$%'"!()*+,=?@\\\[\]\^_`{|}~-])/g, '\\$1') | ||
.replace(/(\d+)\./g, '$1\\.') | ||
.replace(/&/g, '&') | ||
.replace(/</g, '<') | ||
.replace(/>/g, '>'); | ||
} | ||
function escapeAttribute(text) { | ||
return text.replace(/\(/g, '\\(') | ||
.replace(/\)/g, '\\)'); | ||
} | ||
function getNumberOfRequiredBackticks(text) { | ||
let index = 0; | ||
let counts = [0]; | ||
for (let i = 0, len = text.length; i < len; i++) { | ||
if (text[i] === '`') { | ||
counts[index] = counts[index] + 1; | ||
} | ||
else if (counts[index] !== 0) { | ||
counts.push(0); | ||
index++; | ||
} | ||
} | ||
return counts.sort().reduce((result, count) => { | ||
if (count === result) { | ||
return result + 1; | ||
} | ||
return result; | ||
}, 1); | ||
} | ||
class CommonmarkRenderer extends renderer_hir_1.default { | ||
renderText(text, state) { | ||
if (state.get('isPreformatted')) { | ||
return text; | ||
} | ||
return escapePunctuation(text).replace(/\u00A0/gu, ' '); | ||
} | ||
*'root'() { | ||
let document = yield; | ||
return document.join('').trimRight(); | ||
return document.join(''); | ||
} | ||
*'bold'() { | ||
let [before, text, after] = yield* split(); | ||
return `${before}__${text}__${after}`; | ||
return `${before}**${text}**${after}`; | ||
} | ||
*'blockquote'() { | ||
*'blockquote'(_, state) { | ||
let text = yield; | ||
@@ -37,25 +73,43 @@ let lines = text.join('').split('\n'); | ||
let startOfQuote = 0; | ||
while (lines[startOfQuote].match(/^(\s)*$/)) | ||
while (startOfQuote < endOfQuote - 1 && lines[startOfQuote].match(/^\s*$/)) | ||
startOfQuote++; | ||
while (lines[endOfQuote - 1].match(/^(\s)*$/)) | ||
while (endOfQuote > startOfQuote + 1 && lines[endOfQuote - 1].match(/^\s*$/)) | ||
endOfQuote--; | ||
return [ | ||
...lines.slice(startOfQuote, endOfQuote).map(line => `> ${line}`), | ||
'\n' | ||
].join('\n'); | ||
let quote = lines.slice(startOfQuote, endOfQuote).map(line => `> ${line}`).join('\n') + '\n'; | ||
if (!state.get('tight')) { | ||
quote += '\n'; | ||
} | ||
return quote; | ||
} | ||
*'heading'(props) { | ||
let heading = yield; | ||
let text = yield; | ||
let level = new Array(props.level + 1).join('#'); | ||
return `${level} ${heading.join('')}\n\n`; | ||
let heading = text.join(''); | ||
if (heading.indexOf('\n') !== -1) { | ||
if (props.level === 1) { | ||
return `${heading}\n====\n`; | ||
} | ||
else if (props.level === 2) { | ||
return `${heading}\n----\n`; | ||
} | ||
} | ||
return `${level} ${heading}\n`; | ||
} | ||
*'horizontal-rule'() { | ||
return '---\n\n'; | ||
return '***\n'; | ||
} | ||
*'image'(props) { | ||
if (props.title) { | ||
let title = props.title.replace(/"/g, '\\"'); | ||
return `![${props.alt}](${props.url} "${title}")`; | ||
} | ||
return `![${props.alt}](${props.url})`; | ||
} | ||
*'italic'() { | ||
*'italic'(_, state) { | ||
let isItalicized = state.get('isItalicized'); | ||
state.set('isItalicized', true); | ||
let [before, text, after] = yield* split(); | ||
return `${before}*${text}*${after}`; | ||
state.set('isItalicized', isItalicized); | ||
let markup = isItalicized ? '_' : '*'; | ||
return `${before}${markup}${text}${markup}${after}`; | ||
} | ||
@@ -67,75 +121,143 @@ *'line-break'() { | ||
let [before, text, after] = yield* split(); | ||
return `${before}[${text}](${props.href})${after}`; | ||
let href = escapeAttribute(props.href); | ||
if (props.title) { | ||
let title = props.title.replace(/"/g, '\\"'); | ||
return `${before}[${text}](${href} "${title}")${after}`; | ||
} | ||
return `${before}[${text}](${href})${after}`; | ||
} | ||
*'code'(props, state) { | ||
state.push({ isPreformatted: true, htmlSafe: false }); | ||
let text = yield; | ||
state.pop(); | ||
let code = text.join(''); | ||
if (props.style === 'fence') { | ||
code = '\n' + code; | ||
let info = props.info || ''; | ||
let newlines = '\n'; | ||
if (state.get('isList') && state.get('nextAnnotation')) { | ||
newlines += '\n'; | ||
} | ||
if (code.indexOf('```') !== -1) { | ||
return `~~~${info}${code}~~~${newlines}`; | ||
} | ||
else { | ||
return `\`\`\`${info}${code}\`\`\`${newlines}`; | ||
} | ||
} | ||
else if (props.style === 'block') { | ||
return code.split('\n').map(line => ` ${line}`).join('\n') + '\n'; | ||
} | ||
else { | ||
if (code.length === 0) { | ||
return '` `'; | ||
} | ||
else { | ||
let backticks = '`'.repeat(getNumberOfRequiredBackticks(code)); | ||
return `${backticks}${code}${backticks}`; | ||
} | ||
} | ||
} | ||
*'html'(props, state) { | ||
state.push({ isPreformatted: true, htmlSafe: true }); | ||
let text = yield; | ||
state.pop(); | ||
let html = text.join(''); | ||
if (props.type === 'block') { | ||
return html + '\n'; | ||
} | ||
return html; | ||
} | ||
*'list-item'(_, state) { | ||
let indent = ' '.repeat(state.get('indent')); | ||
let rawItem = yield; | ||
let index = state.get('index'); | ||
let item = rawItem.join('').split('\n').map(line => indent + line).join('\n').trim(); | ||
if (state.get('type') === 'ordered-list') { | ||
item = `${indent}${index}. ${item}`; | ||
state.set('index', index + 1); | ||
let digit = state.get('digit'); | ||
let delimiter = state.get('delimiter'); | ||
let marker = delimiter; | ||
if (state.get('type') === 'numbered') { | ||
marker = `${digit}${delimiter}`; | ||
state.set('digit', digit + 1); | ||
} | ||
else if (state.get('type') === 'unordered-list') { | ||
item = `${indent}- ${item}`; | ||
let indent = ' '.repeat(marker.length + 1); | ||
let text = yield; | ||
let item = text.join(''); | ||
let firstCharacter = 0; | ||
while (item[firstCharacter] === ' ') | ||
firstCharacter++; | ||
let lines = item.split('\n'); | ||
lines.push(lines.pop().replace(/[ ]+$/, '')); | ||
lines.unshift(lines.shift().replace(/^[ ]+/, '')); | ||
let [first, ...rest] = lines; | ||
item = ' '.repeat(firstCharacter) + first + '\n' + rest.map(line => indent + line).join('\n').replace(/[ ]+$/, ''); | ||
if (state.get('hasCodeBlockFollowing')) { | ||
return ` ${marker} ${item}`; | ||
} | ||
return item; | ||
return `${marker} ${item}`; | ||
} | ||
*'ordered-list'(_, state) { | ||
let indent = state.get('indent'); | ||
if (indent == null) { | ||
indent = -1; | ||
*'ordered-list'(props, state) { | ||
let start = 1; | ||
if (props && props.start != null) { | ||
start = props.start; | ||
} | ||
let delimiter = '.'; | ||
if (state.get('previous.type') === 'numbered' && state.get('previous.delimiter') === '.') { | ||
delimiter = ')'; | ||
} | ||
let hasCodeBlockFollowing = state.get('nextAnnotation.type') === 'code' && | ||
state.get('nextAnnotation.attributes.style') === 'block'; | ||
state.push({ | ||
type: 'ordered-list', | ||
indent: indent + 1, | ||
index: 1 | ||
isList: true, | ||
type: 'numbered', | ||
digit: start, | ||
previous: state.get('previous'), | ||
delimiter, | ||
hasCodeBlockFollowing, | ||
tight: props && props.tight | ||
}); | ||
let list = yield; | ||
state.pop(); | ||
let markdown = `${list.join('\n')}\n\n`; | ||
if (state.get('type') === 'ordered-list' || | ||
state.get('type') === 'unordered-list') { | ||
return `\n${markdown}`; | ||
if (props && props.tight) { | ||
list = list.map(item => item.replace(/([ \n])+$/, '\n')); | ||
} | ||
return markdown; | ||
state.set('previous', { | ||
isList: true, | ||
type: 'numbered', | ||
delimiter | ||
}); | ||
return list.join('') + '\n'; | ||
} | ||
*'unordered-list'(_, state) { | ||
let indent = state.get('indent'); | ||
if (indent == null) { | ||
indent = -1; | ||
*'unordered-list'(props, state) { | ||
let delimiter = '-'; | ||
if (state.get('previous.type') === 'bulleted' && state.get('previous.delimiter') === '-') { | ||
delimiter = '+'; | ||
} | ||
let hasCodeBlockFollowing = state.get('nextAnnotation.type') === 'code' && | ||
state.get('nextAnnotation.attributes.style') === 'block'; | ||
state.push({ | ||
type: 'unordered-list', | ||
indent: indent + 1, | ||
isList: true, | ||
type: 'bulleted', | ||
previous: state.get('previous'), | ||
delimiter, | ||
tight: props && props.tight, | ||
hasCodeBlockFollowing | ||
}); | ||
let list = yield; | ||
state.pop(); | ||
let markdown = `${list.join('\n')}\n\n`; | ||
if (state.get('type') === 'ordered-list' || | ||
state.get('type') === 'unordered-list') { | ||
return `\n${markdown}`; | ||
state.set('previous', { | ||
isList: true, | ||
type: 'bulleted', | ||
delimiter | ||
}); | ||
if (props && props.tight) { | ||
list = list.map(item => item.replace(/([ \n])+$/, '\n')); | ||
} | ||
return markdown; | ||
return list.join('') + '\n'; | ||
} | ||
*'paragraph'() { | ||
let rawText = yield; | ||
let text = rawText.join(''); | ||
if (text.lastIndexOf('\n\n') === Math.max(text.length - 2, 0)) { | ||
return text; | ||
*'paragraph'(_, state) { | ||
let text = yield; | ||
if (state.get('tight')) { | ||
return text.join('') + '\n'; | ||
} | ||
return `${text}\n\n`; | ||
return text.join('') + '\n\n'; | ||
} | ||
*renderAnnotation(annotation, state) { | ||
let rule = this[annotation.type]; | ||
if (rule) { | ||
return yield* this[annotation.type](annotation.attributes, state); | ||
} | ||
else { | ||
let text = yield; | ||
return text.join(''); | ||
} | ||
} | ||
} | ||
exports.default = CommonmarkRenderer; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSx1REFBdUQ7QUFFdkQsUUFBZSxDQUFDO0lBQ2QsSUFBSSxPQUFPLEdBQUcsS0FBSyxDQUFDO0lBQ3BCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUM7SUFDNUIsSUFBSSxLQUFLLEdBQUcsQ0FBQyxDQUFDO0lBQ2QsSUFBSSxHQUFHLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQztJQUV0QixPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsS0FBSyxHQUFHLElBQUksS0FBSyxHQUFHLEdBQUcsRUFBRSxDQUFDO1FBQUMsS0FBSyxFQUFFLENB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
@@ -20,12 +20,48 @@ "use strict"; | ||
} | ||
function escapePunctuation(text) { | ||
return text.replace(/([#$%'"!()*+,=?@\\\[\]\^_`{|}~-])/g, '\\$1') | ||
.replace(/(\d+)\./g, '$1\\.') | ||
.replace(/&/g, '&') | ||
.replace(/</g, '<') | ||
.replace(/>/g, '>'); | ||
} | ||
function escapeAttribute(text) { | ||
return text.replace(/\(/g, '\\(') | ||
.replace(/\)/g, '\\)'); | ||
} | ||
function getNumberOfRequiredBackticks(text) { | ||
let index = 0; | ||
let counts = [0]; | ||
for (let i = 0, len = text.length; i < len; i++) { | ||
if (text[i] === '`') { | ||
counts[index] = counts[index] + 1; | ||
} | ||
else if (counts[index] !== 0) { | ||
counts.push(0); | ||
index++; | ||
} | ||
} | ||
return counts.sort().reduce((result, count) => { | ||
if (count === result) { | ||
return result + 1; | ||
} | ||
return result; | ||
}, 1); | ||
} | ||
export default class CommonmarkRenderer extends Renderer { | ||
renderText(text, state) { | ||
if (state.get('isPreformatted')) { | ||
return text; | ||
} | ||
return escapePunctuation(text).replace(/\u00A0/gu, ' '); | ||
} | ||
*'root'() { | ||
let document = yield; | ||
return document.join('').trimRight(); | ||
return document.join(''); | ||
} | ||
*'bold'() { | ||
let [before, text, after] = yield* split(); | ||
return `${before}__${text}__${after}`; | ||
return `${before}**${text}**${after}`; | ||
} | ||
*'blockquote'() { | ||
*'blockquote'(_, state) { | ||
let text = yield; | ||
@@ -35,25 +71,43 @@ let lines = text.join('').split('\n'); | ||
let startOfQuote = 0; | ||
while (lines[startOfQuote].match(/^(\s)*$/)) | ||
while (startOfQuote < endOfQuote - 1 && lines[startOfQuote].match(/^\s*$/)) | ||
startOfQuote++; | ||
while (lines[endOfQuote - 1].match(/^(\s)*$/)) | ||
while (endOfQuote > startOfQuote + 1 && lines[endOfQuote - 1].match(/^\s*$/)) | ||
endOfQuote--; | ||
return [ | ||
...lines.slice(startOfQuote, endOfQuote).map(line => `> ${line}`), | ||
'\n' | ||
].join('\n'); | ||
let quote = lines.slice(startOfQuote, endOfQuote).map(line => `> ${line}`).join('\n') + '\n'; | ||
if (!state.get('tight')) { | ||
quote += '\n'; | ||
} | ||
return quote; | ||
} | ||
*'heading'(props) { | ||
let heading = yield; | ||
let text = yield; | ||
let level = new Array(props.level + 1).join('#'); | ||
return `${level} ${heading.join('')}\n\n`; | ||
let heading = text.join(''); | ||
if (heading.indexOf('\n') !== -1) { | ||
if (props.level === 1) { | ||
return `${heading}\n====\n`; | ||
} | ||
else if (props.level === 2) { | ||
return `${heading}\n----\n`; | ||
} | ||
} | ||
return `${level} ${heading}\n`; | ||
} | ||
*'horizontal-rule'() { | ||
return '---\n\n'; | ||
return '***\n'; | ||
} | ||
*'image'(props) { | ||
if (props.title) { | ||
let title = props.title.replace(/"/g, '\\"'); | ||
return `![${props.alt}](${props.url} "${title}")`; | ||
} | ||
return `![${props.alt}](${props.url})`; | ||
} | ||
*'italic'() { | ||
*'italic'(_, state) { | ||
let isItalicized = state.get('isItalicized'); | ||
state.set('isItalicized', true); | ||
let [before, text, after] = yield* split(); | ||
return `${before}*${text}*${after}`; | ||
state.set('isItalicized', isItalicized); | ||
let markup = isItalicized ? '_' : '*'; | ||
return `${before}${markup}${text}${markup}${after}`; | ||
} | ||
@@ -65,74 +119,142 @@ *'line-break'() { | ||
let [before, text, after] = yield* split(); | ||
return `${before}[${text}](${props.href})${after}`; | ||
let href = escapeAttribute(props.href); | ||
if (props.title) { | ||
let title = props.title.replace(/"/g, '\\"'); | ||
return `${before}[${text}](${href} "${title}")${after}`; | ||
} | ||
return `${before}[${text}](${href})${after}`; | ||
} | ||
*'code'(props, state) { | ||
state.push({ isPreformatted: true, htmlSafe: false }); | ||
let text = yield; | ||
state.pop(); | ||
let code = text.join(''); | ||
if (props.style === 'fence') { | ||
code = '\n' + code; | ||
let info = props.info || ''; | ||
let newlines = '\n'; | ||
if (state.get('isList') && state.get('nextAnnotation')) { | ||
newlines += '\n'; | ||
} | ||
if (code.indexOf('```') !== -1) { | ||
return `~~~${info}${code}~~~${newlines}`; | ||
} | ||
else { | ||
return `\`\`\`${info}${code}\`\`\`${newlines}`; | ||
} | ||
} | ||
else if (props.style === 'block') { | ||
return code.split('\n').map(line => ` ${line}`).join('\n') + '\n'; | ||
} | ||
else { | ||
if (code.length === 0) { | ||
return '` `'; | ||
} | ||
else { | ||
let backticks = '`'.repeat(getNumberOfRequiredBackticks(code)); | ||
return `${backticks}${code}${backticks}`; | ||
} | ||
} | ||
} | ||
*'html'(props, state) { | ||
state.push({ isPreformatted: true, htmlSafe: true }); | ||
let text = yield; | ||
state.pop(); | ||
let html = text.join(''); | ||
if (props.type === 'block') { | ||
return html + '\n'; | ||
} | ||
return html; | ||
} | ||
*'list-item'(_, state) { | ||
let indent = ' '.repeat(state.get('indent')); | ||
let rawItem = yield; | ||
let index = state.get('index'); | ||
let item = rawItem.join('').split('\n').map(line => indent + line).join('\n').trim(); | ||
if (state.get('type') === 'ordered-list') { | ||
item = `${indent}${index}. ${item}`; | ||
state.set('index', index + 1); | ||
let digit = state.get('digit'); | ||
let delimiter = state.get('delimiter'); | ||
let marker = delimiter; | ||
if (state.get('type') === 'numbered') { | ||
marker = `${digit}${delimiter}`; | ||
state.set('digit', digit + 1); | ||
} | ||
else if (state.get('type') === 'unordered-list') { | ||
item = `${indent}- ${item}`; | ||
let indent = ' '.repeat(marker.length + 1); | ||
let text = yield; | ||
let item = text.join(''); | ||
let firstCharacter = 0; | ||
while (item[firstCharacter] === ' ') | ||
firstCharacter++; | ||
let lines = item.split('\n'); | ||
lines.push(lines.pop().replace(/[ ]+$/, '')); | ||
lines.unshift(lines.shift().replace(/^[ ]+/, '')); | ||
let [first, ...rest] = lines; | ||
item = ' '.repeat(firstCharacter) + first + '\n' + rest.map(line => indent + line).join('\n').replace(/[ ]+$/, ''); | ||
if (state.get('hasCodeBlockFollowing')) { | ||
return ` ${marker} ${item}`; | ||
} | ||
return item; | ||
return `${marker} ${item}`; | ||
} | ||
*'ordered-list'(_, state) { | ||
let indent = state.get('indent'); | ||
if (indent == null) { | ||
indent = -1; | ||
*'ordered-list'(props, state) { | ||
let start = 1; | ||
if (props && props.start != null) { | ||
start = props.start; | ||
} | ||
let delimiter = '.'; | ||
if (state.get('previous.type') === 'numbered' && state.get('previous.delimiter') === '.') { | ||
delimiter = ')'; | ||
} | ||
let hasCodeBlockFollowing = state.get('nextAnnotation.type') === 'code' && | ||
state.get('nextAnnotation.attributes.style') === 'block'; | ||
state.push({ | ||
type: 'ordered-list', | ||
indent: indent + 1, | ||
index: 1 | ||
isList: true, | ||
type: 'numbered', | ||
digit: start, | ||
previous: state.get('previous'), | ||
delimiter, | ||
hasCodeBlockFollowing, | ||
tight: props && props.tight | ||
}); | ||
let list = yield; | ||
state.pop(); | ||
let markdown = `${list.join('\n')}\n\n`; | ||
if (state.get('type') === 'ordered-list' || | ||
state.get('type') === 'unordered-list') { | ||
return `\n${markdown}`; | ||
if (props && props.tight) { | ||
list = list.map(item => item.replace(/([ \n])+$/, '\n')); | ||
} | ||
return markdown; | ||
state.set('previous', { | ||
isList: true, | ||
type: 'numbered', | ||
delimiter | ||
}); | ||
return list.join('') + '\n'; | ||
} | ||
*'unordered-list'(_, state) { | ||
let indent = state.get('indent'); | ||
if (indent == null) { | ||
indent = -1; | ||
*'unordered-list'(props, state) { | ||
let delimiter = '-'; | ||
if (state.get('previous.type') === 'bulleted' && state.get('previous.delimiter') === '-') { | ||
delimiter = '+'; | ||
} | ||
let hasCodeBlockFollowing = state.get('nextAnnotation.type') === 'code' && | ||
state.get('nextAnnotation.attributes.style') === 'block'; | ||
state.push({ | ||
type: 'unordered-list', | ||
indent: indent + 1, | ||
isList: true, | ||
type: 'bulleted', | ||
previous: state.get('previous'), | ||
delimiter, | ||
tight: props && props.tight, | ||
hasCodeBlockFollowing | ||
}); | ||
let list = yield; | ||
state.pop(); | ||
let markdown = `${list.join('\n')}\n\n`; | ||
if (state.get('type') === 'ordered-list' || | ||
state.get('type') === 'unordered-list') { | ||
return `\n${markdown}`; | ||
state.set('previous', { | ||
isList: true, | ||
type: 'bulleted', | ||
delimiter | ||
}); | ||
if (props && props.tight) { | ||
list = list.map(item => item.replace(/([ \n])+$/, '\n')); | ||
} | ||
return markdown; | ||
return list.join('') + '\n'; | ||
} | ||
*'paragraph'() { | ||
let rawText = yield; | ||
let text = rawText.join(''); | ||
if (text.lastIndexOf('\n\n') === Math.max(text.length - 2, 0)) { | ||
return text; | ||
*'paragraph'(_, state) { | ||
let text = yield; | ||
if (state.get('tight')) { | ||
return text.join('') + '\n'; | ||
} | ||
return `${text}\n\n`; | ||
return text.join('') + '\n\n'; | ||
} | ||
*renderAnnotation(annotation, state) { | ||
let rule = this[annotation.type]; | ||
if (rule) { | ||
return yield* this[annotation.type](annotation.attributes, state); | ||
} | ||
else { | ||
let text = yield; | ||
return text.join(''); | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLE9BQU8sUUFBbUIsTUFBTSxzQkFBc0IsQ0FBQztBQUV2RCxNQUFNLFNBQVMsQ0FBQztJQUNkLElBQUksT0FBTyxHQUFHLEtBQUssQ0FBQztJQUNwQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0lBQzVCLElBQUksS0FBSyxHQUFHLENBQUMsQ0FBQztJQUNkLElBQUksR0FBRyxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7SUFFdEIsT0FBTyxJQUFJLENBQUMsS0FBSyxDQUFDLEtBQUssR0FBRyxJQUFJLEtBQUssR0FBRyxHQUFHLEVBQUUsQ0FBQztRQUFDLEtBQUssRUFBRSxDQUFDO0lBQUMsQ0FBQztJQUN2RCxPQUFPLElBQUksQ0FBQyxHQUFH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commonmark", | ||
"version": "0.6.5", | ||
"version": "0.7.1", | ||
"description": "A brand new TypeScript library.", | ||
@@ -18,10 +18,12 @@ "main": "dist/commonjs/index.js", | ||
"devDependencies": { | ||
"@atjson/core": "^0.5.12", | ||
"@atjson/hir": "^0.5.17", | ||
"tslint": "^5.7.0", | ||
"typescript": "^2.4.2" | ||
"@atjson/document": "^0.7.0", | ||
"@atjson/hir": "^0.7.0", | ||
"@atjson/source-commonmark": "^0.7.1", | ||
"commonmark-spec": "^0.28.0", | ||
"tslint": "^5.9.1", | ||
"typescript": "^2.6.2" | ||
}, | ||
"dependencies": { | ||
"@atjson/renderer-hir": "^0.5.20" | ||
"@atjson/renderer-hir": "^0.7.0" | ||
} | ||
} |
315
src/index.ts
@@ -20,4 +20,47 @@ import { HIRNode } from '@atjson/hir'; | ||
type CodeStyle = 'block' | 'inline' | 'fence'; | ||
// http://spec.commonmark.org/0.28/#backslash-escapes | ||
function escapePunctuation(text: string) { | ||
return text.replace(/([#$%'"!()*+,=?@\\\[\]\^_`{|}~-])/g, '\\$1') | ||
.replace(/(\d+)\./g, '$1\\.') | ||
.replace(/&/g, '&') | ||
.replace(/</g, '<') | ||
.replace(/>/g, '>'); | ||
} | ||
function escapeAttribute(text: string) { | ||
return text.replace(/\(/g, '\\(') | ||
.replace(/\)/g, '\\)'); | ||
} | ||
function getNumberOfRequiredBackticks(text: string) { | ||
let index = 0; | ||
let counts = [0]; | ||
for (let i = 0, len = text.length; i < len; i++) { | ||
if (text[i] === '`') { | ||
counts[index] = counts[index] + 1; | ||
} else if (counts[index] !== 0) { | ||
counts.push(0); | ||
index++; | ||
} | ||
} | ||
return counts.sort().reduce((result, count) => { | ||
if (count === result) { | ||
return result + 1; | ||
} | ||
return result; | ||
}, 1); | ||
} | ||
export default class CommonmarkRenderer extends Renderer { | ||
renderText(text: string, state: State) { | ||
if (state.get('isPreformatted')) { | ||
return text; | ||
} | ||
return escapePunctuation(text).replace(/\u00A0/gu, ' '); | ||
} | ||
/** | ||
@@ -30,11 +73,14 @@ * The root allows us to normalize the document | ||
let document = yield; | ||
return document.join('').trimRight(); | ||
return document.join(''); | ||
} | ||
/** | ||
* Bold text looks like __this__ in Markdown. | ||
* Bold text looks like **this** in Markdown. | ||
* | ||
* Asterisks are used here because they can split | ||
* words; underscores cannot split words. | ||
*/ | ||
*'bold'(): IterableIterator<string> { | ||
let [before, text, after] = yield* split(); | ||
return `${before}__${text}__${after}`; | ||
return `${before}**${text}**${after}`; | ||
} | ||
@@ -48,3 +94,3 @@ | ||
*/ | ||
*'blockquote'(): IterableIterator<string> { | ||
*'blockquote'(_, state: State): IterableIterator<string> { | ||
let text: string[] = yield; | ||
@@ -55,9 +101,11 @@ let lines: string[] = text.join('').split('\n'); | ||
while (lines[startOfQuote].match(/^(\s)*$/)) startOfQuote++; | ||
while (lines[endOfQuote - 1].match(/^(\s)*$/)) endOfQuote--; | ||
while (startOfQuote < endOfQuote - 1 && lines[startOfQuote].match(/^\s*$/)) startOfQuote++; | ||
while (endOfQuote > startOfQuote + 1 && lines[endOfQuote - 1].match(/^\s*$/)) endOfQuote--; | ||
return [ | ||
...lines.slice(startOfQuote, endOfQuote).map(line => `> ${line}`), | ||
'\n' | ||
].join('\n'); | ||
let quote = lines.slice(startOfQuote, endOfQuote).map(line => `> ${line}`).join('\n') + '\n'; | ||
if (!state.get('tight')) { | ||
quote += '\n'; | ||
} | ||
return quote; | ||
} | ||
@@ -69,7 +117,21 @@ | ||
* ###### and six `#` being the least important | ||
* | ||
* If the heading spans multiple lines, then we will use the underline | ||
* style, using a series of `=` or `-` markers. This only works for | ||
* headings of level 1 or 2, so any other level will be broken. | ||
*/ | ||
*'heading'(props: { level: number }): IterableIterator<string> { | ||
let heading = yield; | ||
let text = yield; | ||
let level = new Array(props.level + 1).join('#'); | ||
return `${level} ${heading.join('')}\n\n`; | ||
let heading = text.join(''); | ||
// Multiline headings are supported for level 1 and 2 | ||
if (heading.indexOf('\n') !== -1) { | ||
if (props.level === 1) { | ||
return `${heading}\n====\n`; | ||
} else if (props.level === 2) { | ||
return `${heading}\n----\n`; | ||
} | ||
} | ||
return `${level} ${heading}\n`; | ||
} | ||
@@ -79,7 +141,7 @@ | ||
* A horizontal rule separates sections of a story | ||
* --- | ||
* *** | ||
* Into multiple sections. | ||
*/ | ||
*'horizontal-rule'(): IterableIterator<string> { | ||
return '---\n\n'; | ||
return '***\n'; | ||
} | ||
@@ -91,3 +153,7 @@ | ||
*/ | ||
*'image'(props: { alt: string, url: string }): IterableIterator<string> { | ||
*'image'(props: { alt: string, title?: string, url: string }): IterableIterator<string> { | ||
if (props.title) { | ||
let title = props.title.replace(/"/g, '\\"'); | ||
return `![${props.alt}](${props.url} "${title}")`; | ||
} | ||
return `![${props.alt}](${props.url})`; | ||
@@ -99,5 +165,11 @@ } | ||
*/ | ||
*'italic'(): IterableIterator<string> { | ||
*'italic'(_, state: State): IterableIterator<string> { | ||
// This adds support for strong emphasis (per Commonmark) | ||
// Strong emphasis includes _*two*_ emphasis markers around text. | ||
let isItalicized = state.get('isItalicized'); | ||
state.set('isItalicized', true); | ||
let [before, text, after] = yield* split(); | ||
return `${before}*${text}*${after}`; | ||
state.set('isItalicized', isItalicized); | ||
let markup = isItalicized ? '_' : '*'; | ||
return `${before}${markup}${text}${markup}${after}`; | ||
} | ||
@@ -116,24 +188,98 @@ | ||
*/ | ||
*'link'(props: { href: string }): IterableIterator<string> { | ||
*'link'(props: { href: string, title?: string }): IterableIterator<string> { | ||
let [before, text, after] = yield* split(); | ||
return `${before}[${text}](${props.href})${after}`; | ||
let href = escapeAttribute(props.href); | ||
if (props.title) { | ||
let title = props.title.replace(/"/g, '\\"'); | ||
return `${before}[${text}](${href} "${title}")${after}`; | ||
} | ||
return `${before}[${text}](${href})${after}`; | ||
} | ||
/** | ||
* A `code` span can be inline or as a block: | ||
* | ||
* ```js | ||
* function () {} | ||
* ``` | ||
*/ | ||
*'code'(props: { style: CodeStyle, info?: string }, state: State): IterableIterator<string> { | ||
state.push({ isPreformatted: true, htmlSafe: false }); | ||
let text = yield; | ||
state.pop(); | ||
let code = text.join(''); | ||
if (props.style === 'fence') { | ||
code = '\n' + code; | ||
let info = props.info || ''; | ||
let newlines = '\n'; | ||
if (state.get('isList') && state.get('nextAnnotation')) { | ||
newlines += '\n'; | ||
} | ||
if (code.indexOf('```') !== -1) { | ||
return `~~~${info}${code}~~~${newlines}`; | ||
} else { | ||
return `\`\`\`${info}${code}\`\`\`${newlines}`; | ||
} | ||
} else if (props.style === 'block') { | ||
return code.split('\n').map(line => ` ${line}`).join('\n') + '\n'; | ||
} else { | ||
// MarkdownIt strips all leading and trailing whitespace from code blocks, | ||
// which means that we get an empty string for a single whitespace (` `). | ||
if (code.length === 0) { | ||
return '` `'; | ||
// We need to properly escape backticks inside of code blocks | ||
// by using variable numbers of backticks. | ||
} else { | ||
let backticks = '`'.repeat(getNumberOfRequiredBackticks(code)); | ||
return `${backticks}${code}${backticks}`; | ||
} | ||
} | ||
} | ||
*'html'(props: { type: string }, state: State): IterableIterator<string> { | ||
state.push({ isPreformatted: true, htmlSafe: true }); | ||
let text = yield; | ||
state.pop(); | ||
let html = text.join(''); | ||
if (props.type === 'block') { | ||
return html + '\n'; | ||
} | ||
return html; | ||
} | ||
/** | ||
* A list item is part of an ordered list or an unordered list. | ||
*/ | ||
*'list-item'(_, state: State): IterableIterator<string> { | ||
let indent: string = ' '.repeat(state.get('indent')); | ||
let rawItem: string[] = yield; | ||
let index: number = state.get('index'); | ||
let item: string = rawItem.join('').split('\n').map(line => indent + line).join('\n').trim(); | ||
let digit: number = state.get('digit'); | ||
let delimiter = state.get('delimiter'); | ||
let marker: string = delimiter; | ||
if (state.get('type') === 'numbered') { | ||
marker = `${digit}${delimiter}`; | ||
state.set('digit', digit + 1); | ||
} | ||
let indent = ' '.repeat(marker.length + 1); | ||
let text: string[] = yield; | ||
let item: string = text.join(''); | ||
let firstCharacter = 0; | ||
while (item[firstCharacter] === ' ') firstCharacter++; | ||
let lines = item.split('\n'); | ||
lines.push(lines.pop().replace(/[ ]+$/, '')); | ||
lines.unshift(lines.shift().replace(/^[ ]+/, '')); | ||
let [first, ...rest] = lines; | ||
if (state.get('type') === 'ordered-list') { | ||
item = `${indent}${index}. ${item}`; | ||
state.set('index', index + 1); | ||
} else if (state.get('type') === 'unordered-list') { | ||
item = `${indent}- ${item}`; | ||
item = ' '.repeat(firstCharacter) + first + '\n' + rest.map(line => indent + line).join('\n').replace(/[ ]+$/, ''); | ||
// Code blocks using spaces can follow lists, | ||
// however, they will be included in the list | ||
// if we don't adjust spacing on the list item | ||
// to force the code block outside of the list | ||
// See http://spec.commonmark.org/dingus/?text=%20-%20%20%20hello%0A%0A%20%20%20%20I%27m%20a%20code%20block%20_outside_%20the%20list%0A | ||
if (state.get('hasCodeBlockFollowing')) { | ||
return ` ${marker} ${item}`; | ||
} | ||
return item; | ||
return `${marker} ${item}`; | ||
} | ||
@@ -146,11 +292,26 @@ | ||
*/ | ||
*'ordered-list'(_, state: State): IterableIterator<string> { | ||
let indent = state.get('indent'); | ||
if (indent == null) { | ||
indent = -1; | ||
*'ordered-list'(props: { start?: number, tight: boolean }, state: State): IterableIterator<string> { | ||
let start = 1; | ||
if (props && props.start != null) { | ||
start = props.start; | ||
} | ||
let delimiter = '.'; | ||
if (state.get('previous.type') === 'numbered' && state.get('previous.delimiter') === '.') { | ||
delimiter = ')'; | ||
} | ||
// Handle indendation for code blocks that immediately follow | ||
// a list. | ||
let hasCodeBlockFollowing = state.get('nextAnnotation.type') === 'code' && | ||
state.get('nextAnnotation.attributes.style') === 'block'); | ||
state.push({ | ||
type: 'ordered-list', | ||
indent: indent + 1, | ||
index: 1 | ||
isList: true, | ||
type: 'numbered', | ||
digit: start, | ||
previous: state.get('previous'), | ||
delimiter, | ||
hasCodeBlockFollowing, | ||
tight: props && props.tight | ||
}); | ||
@@ -160,60 +321,66 @@ let list = yield; | ||
let markdown = `${list.join('\n')}\n\n`; | ||
if (state.get('type') === 'ordered-list' || | ||
state.get('type') === 'unordered-list') { | ||
return `\n${markdown}`; | ||
if (props && props.tight) { | ||
list = list.map(item => item.replace(/([ \n])+$/, '\n'); | ||
} | ||
return markdown; | ||
state.set('previous', { | ||
isList: true, | ||
type: 'numbered', | ||
delimiter | ||
}); | ||
return list.join('') + '\n'; | ||
} | ||
/** | ||
* - An ordered list contains | ||
* - An unordered list contains | ||
* - A number | ||
* - Of things with dashes preceding them | ||
*/ | ||
*'unordered-list'(_, state: State): IterableIterator<string> { | ||
let indent = state.get('indent'); | ||
if (indent == null) { | ||
indent = -1; | ||
*'unordered-list'(props: { tight: boolean }, state: State): IterableIterator<string> { | ||
let delimiter = '-'; | ||
if (state.get('previous.type') === 'bulleted' && state.get('previous.delimiter') === '-') { | ||
delimiter = '+'; | ||
} | ||
// Handle indendation for code blocks that immediately follow | ||
// a list. | ||
let hasCodeBlockFollowing = state.get('nextAnnotation.type') === 'code' && | ||
state.get('nextAnnotation.attributes.style') === 'block'); | ||
state.push({ | ||
type: 'unordered-list', | ||
indent: indent + 1, | ||
isList: true, | ||
type: 'bulleted', | ||
previous: state.get('previous'), | ||
delimiter, | ||
tight: props && props.tight, | ||
hasCodeBlockFollowing | ||
}); | ||
let list = yield; | ||
state.pop(); | ||
let markdown = `${list.join('\n')}\n\n`; | ||
if (state.get('type') === 'ordered-list' || | ||
state.get('type') === 'unordered-list') { | ||
return `\n${markdown}`; | ||
state.set('previous', { | ||
isList: true, | ||
type: 'bulleted', | ||
delimiter | ||
}); | ||
if (props && props.tight) { | ||
list = list.map(item => item.replace(/([ \n])+$/, '\n'); | ||
} | ||
return markdown; | ||
return list.join('') + '\n'; | ||
} | ||
/** | ||
* A paragraph is the base unit of text. | ||
* | ||
* They are created by adding two newlines between | ||
* text. | ||
* Paragraphs are delimited by two or more newlines in markdown. | ||
*/ | ||
*'paragraph'(): IterableIterator<string> { | ||
let rawText = yield; | ||
let text = rawText.join(''); | ||
if (text.lastIndexOf('\n\n') === Math.max(text.length - 2, 0)) { | ||
return text; | ||
*'paragraph'(_, state: State): IterableIterator<string> { | ||
let text = yield; | ||
if (state.get('tight')) { | ||
return text.join('') + '\n'; | ||
} | ||
return `${text}\n\n`; | ||
return text.join('') + '\n\n'; | ||
} | ||
*renderAnnotation(annotation: HIRNode, state: State) { | ||
let rule = this[annotation.type]; | ||
if (rule) { | ||
return yield* this[annotation.type](annotation.attributes, state); | ||
} else { | ||
let text = yield; | ||
return text.join(''); | ||
} | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
56262
844
6
6
2
+ Added@atjson/document@0.7.16(transitive)
+ Added@atjson/hir@0.7.16(transitive)
+ Added@atjson/renderer-hir@0.7.16(transitive)
- Removed@atjson/core@0.5.12(transitive)
- Removed@atjson/hir@0.5.17(transitive)
- Removed@atjson/renderer-hir@0.5.20(transitive)
- Removed@types/entities@1.1.1(transitive)
- Removedentities@1.1.2(transitive)
Updated@atjson/renderer-hir@^0.7.0