Skip to content

Commit

Permalink
fix: 🐛 Replaces non breaking space with simple space (kolplattformen#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanObrink authored Feb 11, 2021
1 parent f9dc391 commit 58d5676
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parseHtml.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>')
Expand Down
1 change: 1 addition & 0 deletions lib/parseHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('>')
Expand Down

0 comments on commit 58d5676

Please sign in to comment.