This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
outline/server/utils/truncate.js
2016-06-04 12:30:05 -07:00

18 lines
379 B
JavaScript

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,
};