mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-17 13:31:39 +03:00
5d868d14ad
refs https://github.com/TryGhost/Ghost-Admin/pull/690, closes #1501, closes #2093, closes #4592, closes #4627, closes #4659, closes #5039, closes #5237, closes #5587, closes #5625, closes #5632, closes #5822, closes #5939, closes #6840, closes #7183, closes #7536 - replace custom showdown fork with markdown-it - swaps showdown for markdown-it when rendering markdown - match existing header ID behaviour - allow headers without a space after the #s - add duplicate header ID handling - remove legacy markdown spec - move markdown-it setup into markdown-converter util - update mobiledoc specs to match markdown-it newline behaviour - update data-generator HTML to match markdown-it newline behaviour - fix Post "converts html to plaintext" test - update rss spec to match markdown-it newline behaviour - close almost all related showdown bugs
18 lines
588 B
JavaScript
18 lines
588 B
JavaScript
var SimpleDom = require('simple-dom'),
|
|
tokenizer = require('simple-html-tokenizer').tokenize,
|
|
markdownConverter = require('../../../utils/markdown-converter'),
|
|
parser;
|
|
|
|
module.exports = {
|
|
name: 'card-markdown',
|
|
type: 'dom',
|
|
render(opts) {
|
|
parser = new SimpleDom.HTMLParser(tokenizer, opts.env.dom, SimpleDom.voidMap);
|
|
return parser.parse(''
|
|
+ '<div class="kg-card-markdown">'
|
|
+ markdownConverter.render(opts.payload.markdown || '')
|
|
+ '</div>'
|
|
);
|
|
}
|
|
};
|