fix: 🐛 Replaces non breaking space with simple space (#57)

This commit is contained in:
Johan Öbrink 2021-02-11 13:19:26 +01:00 committed by GitHub
parent f9dc39128e
commit 58d56764d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -6,7 +6,7 @@ describe('parseHtml', () => {
const html = `<div>
<b>Hello </b>
<i> World</i>
<u> ! </u>
<u>&#160;!&#160;</u>
</div>`
expect(trim(html)).toEqual('<div><b>Hello</b><i>World</i><u>!</u></div>')

View File

@ -2,6 +2,7 @@ import * as h2m from 'h2m'
import { htmlDecode } from 'js-htmlencode'
export const trim = (html: string): string => html
.replace(/&#160;/g, ' ')
.split('>')
.map((token) => token.trim())
.join('>')