mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-16 20:43:01 +03:00
47322e4239
closes #8757 - update the markdown card render method to use SimpleDOM's `createRawHtmlSection`. This avoids SimpleDOM parsing and tokenization of broken or unsupported free-form HTML that markdown allows - replace markdown extraction/render with mobiledoc's renderer in the `Post` model - removes `jsdom` as it's no longer necessary
20 lines
704 B
JavaScript
20 lines
704 B
JavaScript
module.exports = {
|
|
name: 'card-markdown',
|
|
type: 'dom',
|
|
render: function (opts) {
|
|
var markdownConverter = require('../../../utils/markdown-converter'),
|
|
html, element;
|
|
|
|
// convert markdown to HTML ready for insertion into dom
|
|
html = '<div class="kg-card-markdown">'
|
|
+ markdownConverter.render(opts.payload.markdown || '')
|
|
+ '</div>';
|
|
|
|
// use the SimpleDOM document to create a raw HTML section.
|
|
// avoids parsing/rendering of potentially broken or unsupported HTML
|
|
element = opts.env.dom.createRawHTMLSection(html);
|
|
|
|
return element;
|
|
}
|
|
};
|