Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return callback(err);
}
// Check if we can update the main content metadata (displayName, description, ..)
opts = opts || {};
if (
opts.displayName &&
ctx.content.displayName === ctx.content.link &&
typeof opts.displayName === 'string'
) {
ctx.addContentMetadata('displayName', ent.decode(opts.displayName));
log().trace({ contentId: ctx.contentId }, 'Updating the content displayName.');
}
if (opts.description && !ctx.content.description && typeof opts.description === 'string') {
ctx.addContentMetadata('description', ent.decode(opts.description));
log().trace({ contentId: ctx.contentId }, 'Updating the content description.');
}
return callback();
});
};
const unescapeInlineHtml = (html) => {
let tmpHtml = html;
// find any inline HTML (as denoted by ```!inline-html [CODE] !inline-html```)
const regex = /<p><code>!inline-html\n[\s\S]*\n!inline-html<\/code><\/p>/;
const results = regex.exec(tmpHtml);
// we found inline HTML, unescape it and insert it into the parsed Markdown output
if (results && results.length > 0) {
const rawHtml = results[0].substring(21, results[0].length - 23);
const decodedHtml = ent.decode(rawHtml);
tmpHtml = tmpHtml.replace(regex, decodedHtml);
}
return tmpHtml;
};
</code></p>
self.htmlToPlaintext = function(html) {
// The awesomest HTML renderer ever (look out webkit):
// block element opening tags = newlines, closing tags and non-container tags just gone
html = html.replace(/<\/.*?\>/g, '');
html = html.replace(/<(h1|h2|h3|h4|h5|h6|p|br|blockquote).*?\>/gi, '\n');
html = html.replace(/<.*?\>/g, '');
return ent.decode(html);
};
convert: function (node, getVNodeKey) {
if (node.type === 'tag' || node.type === 'script' || node.type === 'style') {
return converter.convertTag(node, getVNodeKey);
} else if (node.type === 'text') {
return new VText(decode(node.data));
} else {
// converting an unsupported node, return an empty text node instead.
return new VText('');
}
},
convertTag: function (tag, getVNodeKey) {
renderer.br = function (text) {
var id = inlineIds++;
inlines[id] = React.createElement(options.br || 'br', {key: keys++}, ent.decode(text));
return '{$' + id + '$}';
};
this.response = errorBody.response;
try {
this.errors = JSON.parse(this.response.body).error.errors;
} catch (e) {}
var messages = [];
if (errorBody.message) {
messages.push(errorBody.message);
}
if (this.errors && this.errors.length === 1) {
messages.push(this.errors[0].message);
} else if (this.response && this.response.body) {
messages.push(ent.decode(errorBody.response.body.toString()));
} else if (!errorBody.message) {
messages.push('Error during request.');
}
this.message = uniq(messages).join(' - ');
});
app.helper('md', function(str, options) {
var md = new Remarkable();
var res = md.render(str, options);
return ent.decode(res);
});
public transform(input: string): string {
let output = ent.decode(input);
return output;
}
}
renderer.link = function (href, title, text) {
var id = inlineIds++;
inlines[id] = React.createElement('a', {
href: href,
title: title,
key: keys++,
target: 'new'
}, ent.decode(text));
return '{{' + id + '}}';
};