jonkemp / inline-css

Inline css into an html file.
MIT License
429 stars 85 forks source link

DOCTYPE statement with external identifier getting trimmed to `<DOCTYPE html>` #130

Open talenthub-js opened 4 months ago

talenthub-js commented 4 months ago

It seems that inline-css is truncating the "external identifier" part of DOCTYPE.

Consider this example

const inlineCss = require('inline-css')
inlineCss(
  '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html></html>',
  { url:'file://test.html' }
).then(console.debug)
// <!DOCTYPE html><html><head></head><body></body></html>

Versions:

Node: v20.12.0
inline-css: 4.0.2

While browsers ignore most parts of DOCTYPE, this may be relevant for emails. I suspect this comes from Cheerio, but since inline-css puts more focus on emails, figured it may be more relevant to ask here. Is this the expected behavior?

GravityTwoG commented 4 weeks ago

I am having the same issue.