2017-03-21 11:24:11 +03:00
|
|
|
var should = require('should'), // jshint ignore:line
|
|
|
|
converter = require('../../../server/utils/mobiledoc-converter');
|
2017-03-14 21:07:33 +03:00
|
|
|
|
|
|
|
describe('Convert mobiledoc to HTML ', function () {
|
|
|
|
var mobiledoc = {
|
|
|
|
version: '0.3.1',
|
|
|
|
atoms: [],
|
|
|
|
cards: [
|
2017-03-24 13:03:33 +03:00
|
|
|
['card-markdown',
|
2017-03-14 21:07:33 +03:00
|
|
|
{
|
|
|
|
pos: 'top',
|
2017-03-24 13:03:33 +03:00
|
|
|
card_name: 'card-markdown',
|
2017-03-14 21:07:33 +03:00
|
|
|
markdown: '#heading\n\n- list one\n- list two\n- list three'
|
|
|
|
}
|
|
|
|
],
|
2017-03-24 13:03:33 +03:00
|
|
|
['card-html', {
|
|
|
|
pos: 'top',
|
|
|
|
card_name: 'card-html',
|
|
|
|
html: '<p>HTML CARD</p>'
|
2017-03-14 21:07:33 +03:00
|
|
|
}]
|
|
|
|
],
|
|
|
|
markups: [],
|
|
|
|
sections: [
|
|
|
|
[1, 'p', [
|
|
|
|
[0, [], 0, 'test']
|
|
|
|
]],
|
|
|
|
[10, 0],
|
|
|
|
[10, 1]
|
|
|
|
]
|
|
|
|
};
|
|
|
|
it('Converts a mobiledoc to HTML', function () {
|
replace custom showdown fork with markdown-it (#8451)
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
2017-05-15 19:48:14 +03:00
|
|
|
converter.render(mobiledoc).should.match('<p>test</p><div class="kg-card-markdown"><h1 id="heading">heading</h1>\n<ul>\n<li>list one</li>\n<li>list two</li>\n<li>list three</li>\n</ul>\n</div><div class="kg-card-html"><p>HTML CARD</p></div>');
|
2017-03-14 21:07:33 +03:00
|
|
|
});
|
|
|
|
});
|