0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-10 23:39:31 -05:00
verdaccio/packages/core/readme/src/index.ts
Behrang Yarahmadi 13310814da
#2606 add prettier plugin sort imports (#2607)
* #2606 add prettier plugin sort imprts

* #2606 update pnpm-lock.yaml

* #2606 update eslint rules

* #2606 fixes website directory formatting

Co-authored-by: Ayush Sharma <ayush.sharma@trivago.com>
2021-10-29 17:33:05 +02:00

17 lines
364 B
TypeScript

import createDOMPurify from 'dompurify';
import { JSDOM } from 'jsdom';
import marked from 'marked';
const DOMPurify = createDOMPurify(new JSDOM('').window);
export default function parseReadme(readme: string): string | void {
if (readme) {
return DOMPurify.sanitize(
marked(readme, {
sanitize: false,
}).trim()
);
}
return;
}