mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-17 21:41:49 +03:00
f61aa662c1
refs #7429 - ☢️ 👷🏻♀️ This PR removes the dependency on Ghost-Editor and replaces it with the Mobiledoc DOM renderer. It includes new DOM based default cards and atoms.
15 lines
561 B
JavaScript
15 lines
561 B
JavaScript
var SimpleDom = require('simple-dom'),
|
|
tokenizer = require('simple-html-tokenizer').tokenize,
|
|
Showdown = require('showdown-ghost'),
|
|
converter = new Showdown.converter({extensions: ['ghostgfm', 'footnotes', 'highlight']}),
|
|
parser;
|
|
|
|
module.exports = {
|
|
name: 'markdown-card',
|
|
type: 'dom',
|
|
render(opts) {
|
|
parser = new SimpleDom.HTMLParser(tokenizer, opts.env.dom, SimpleDom.voidMap);
|
|
return parser.parse('<div>' + converter.makeHtml(opts.payload.markdown || '') + '</div>');
|
|
}
|
|
};
|