mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
New: Use Goodreads directly, allow multiple editions of a book (new DB required)
This commit is contained in:
13
frontend/src/Utilities/String/stripHtml.js
Normal file
13
frontend/src/Utilities/String/stripHtml.js
Normal file
@@ -0,0 +1,13 @@
|
||||
function stripHtml(html) {
|
||||
if (!html) {
|
||||
return html;
|
||||
}
|
||||
|
||||
const fiddled = html.replace(/<br\/>/g, ' ');
|
||||
|
||||
const doc = new DOMParser().parseFromString(fiddled, 'text/html');
|
||||
const text = doc.body.textContent || '';
|
||||
return text.replace(/([;,.])([^\s.])/g, '$1 $2').replace(/\s{2,}/g, ' ').replace(/s+…/g, '…');
|
||||
}
|
||||
|
||||
export default stripHtml;
|
||||
Reference in New Issue
Block a user