import * as riot from 'riot';
//const emojinize = require('emojinize');
import CONFIG from './config';
const escape = text =>
text
.replace(/>/g, '>')
.replace(/ {
if (shouldBreak == null) {
shouldBreak = true;
}
const me = riot.mixin('i').me;
let text = tokens.map(token => {
switch (token.type) {
case 'text':
return escape(token.content)
.replace(/(\r\n|\n|\r)/g, shouldBreak ? '
' : ' ');
case 'bold':
return `${escape(token.bold)}`;
case 'url':
return `
${token.html}
`;
case 'inline-code':
return `${token.html}
`;
case 'emoji':
return `${token.content}`;
//return emojinize.encode(token.content)
}
}).join('');
// Remove needless whitespaces
text = text
.replace(/ /g, '').replace(/<\/code> /g, '
')
.replace(/
/g, '').replace(/<\/code><\/pre>
/g, '
');
return text;
};