UNPKG

epubinator

Version:

NPM package to generate epub files out of url

24 lines (21 loc) 436 B
/** * stripNbsp * * @param {string} html * @returns {string} */ function stripNbsp(html: string): string { const nbspRegex = /&nbsp;/gi return html.replace(nbspRegex, ' ') } /** * stripSpan * * @param {string} html * @returns {string} */ function stripHtmlAttributes(html: string): string { const spanRegex = /<\s*[^>]*>|<\/\s*[^>]*>/gi return html.replace(spanRegex, '') } export { stripNbsp, stripHtmlAttributes }