Fixed bundle.js size issues
This commit is contained in:
18
server/utils/truncate.js
Normal file
18
server/utils/truncate.js
Normal 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,
|
||||
};
|
Reference in New Issue
Block a user