Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

  not rendering as expected in newer versions of this library? #464

Open
unicornsoftwareinc opened this issue Aug 11, 2024 · 5 comments
Labels

Comments

@unicornsoftwareinc
Copy link

unicornsoftwareinc commented Aug 11, 2024

Node.js version:
20.0.0

OS version:
macOS 14.3.1

Description:
&nbsp ; doesn't appear to be rendering "correctly" as a space character with pug templates. Instead it renders as "&nbsp ;". This appears to work as I would expect in version 6.0.0 of this library but upon updating recently to 12.0.0, it is no longer working as it used to.

Please note: I have inserted an extra space before the semi-colon of the "&nbsp ;" inside this ticket because GitHub actually renders it as the non breaking space character.

Actual behavior:
&nbsp ; renders as as "&nbsp ;" when using it inside pug templates. For example, if you have the following inside a pug template: "p(style='font-size: 12px;') &nbsp ;", in the actual rendered email you will see "&nbsp ;" instead of a space character.

Expected behavior:
&nbsp ; renders as as non-breaking space character.

Code to reproduce:
On version 12.0.0 (and perhaps other earlier versions outside of 6.0.0), render a pug template with the following: "p(style='font-size: 12px;') &nbsp ;" and send a test email. In the received email, you will see "&nbsp ;" instead of a space character in the rendered paragraph.

Thanks

@IhorShmidt
Copy link

Same with version 11.1.1

@IhorShmidt
Copy link

UPD here - issue is related to dependency cheerio. A few weeks ago author published version 1.0.0 after previous 1.0.0-rc.12 and now because dependency is written like

"cheerio": "^1.0.0-rc.12" 

The new version is being installed. If you want to have a quick fix - install version 1.0.0-rc.12 next to the email-templates package in root package.json , or you also can play with "overrides" or "resolutions" in package.json depending on what you are using - yarn or npm

@MrsSima
Copy link

MrsSima commented Aug 25, 2024

Have a problem that seems to be related, previously working link with & started to appear in templates like &
Putting the following line to package.json solved the problem
"cheerio": "1.0.0-rc.12" thanks to @IhorShmidt

@Chocobozzz
Copy link

Chocobozzz commented Sep 6, 2024

Another workaround is to disable juice (set juice: false to email templates options) if you don't use an external stylesheet in your email code

@aogilvie
Copy link

@titanism is it possible Cheerio can be added as a dep and republish on NPM please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants