Fixed bundle.js size issues

This commit is contained in:
Jori Lallo
2016-06-04 12:30:05 -07:00
parent 1345f9629d
commit f367157fb7
5 changed files with 30 additions and 17 deletions

View File

@@ -1,5 +1,4 @@
import slug from 'slug';
import truncate from 'truncate-html';
import marked, { Renderer } from 'marked';
import highlight from 'highlight.js';
@@ -34,25 +33,11 @@ marked.setOptions({
smartypants: true,
});
// TODO: This is syncronous and can be costly,
// should be performed outside http request
// TODO: This is syncronous and can be costly
const convertToMarkdown = (text) => {
return marked(text);
};
truncate.defaultOptions = {
stripTags: false,
ellipsis: '...',
decodeEntities: false,
excludes: ['h1', 'pre', ],
};
const truncateMarkdown = (text, length) => {
const html = convertToMarkdown(text);
return truncate(html, length);
};
export {
convertToMarkdown,
truncateMarkdown,
};