diff --git a/lib/parse/__tests__/news.test.ts b/lib/parse/__tests__/news.test.ts index df7d76411..a74cf56de 100644 --- a/lib/parse/__tests__/news.test.ts +++ b/lib/parse/__tests__/news.test.ts @@ -199,7 +199,7 @@ describe('newsItem', () => { BannerImageGuid: '7a8142d9d9d54cf090e8457e4c629227', BannerImageListId: 'a88c22e8-7094-4a71-b4fd-8792c62a7b4a', Body: - 'italic bold emphasis
strong', + 'italic bold emphasis
strongnbsp ', BodyNoHtml: null, AuthorDisplayName: 'Tieto Evry', altText: null, @@ -238,5 +238,6 @@ describe('newsItem', () => { expect(item.body).toContain('**bold**') expect(item.body).toContain('*emphasis*') expect(item.body).toContain('**strong**') + expect(item.body).toContain('**nbsp**') }) }) \ No newline at end of file diff --git a/lib/parseHtml.ts b/lib/parseHtml.ts index 1303e9e08..a2a76d303 100644 --- a/lib/parseHtml.ts +++ b/lib/parseHtml.ts @@ -45,6 +45,8 @@ const rearrangeWhitespace = (html: string = ''): string => { trimNodes.forEach((trimNode) => { content = content.split(`<${trimNode}> `).join(` <${trimNode}>`) content = content.split(` `).join(` `) + content = content.split(`<${trimNode}>&nbsp;`).join(`&nbsp;<${trimNode}>`) + content = content.split(`&nbsp;`).join(`&nbsp;`) }) return content }