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

18
server/utils/truncate.js Normal file
View File

@ -0,0 +1,18 @@
import truncate from 'truncate-html';
import { convertToMarkdown } from '../../src/utils/markdown';
truncate.defaultOptions = {
stripTags: false,
ellipsis: '...',
decodeEntities: false,
excludes: ['h1', 'pre', ],
};
const truncateMarkdown = (text, length) => {
const html = convertToMarkdown(text);
return truncate(html, length);
};
export {
truncateMarkdown,
};