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 preserving XHTML #22

Open
Saltallica opened this issue May 11, 2015 · 4 comments
Open

Not preserving XHTML #22

Saltallica opened this issue May 11, 2015 · 4 comments

Comments

@Saltallica
Copy link

I'm attempting to use this to inline styles in an XSL template. In order for the XSLT processor to operate correctly, it requires strict XHTML with proper closing tags. For example:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

Becomes

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Without the closing tag. This is not legal XML, therefore fails processing.

Is there a way to output as XHTML with closing tags everywhere?

@jonkemp
Copy link
Owner

jonkemp commented May 12, 2015

No, not currently. It would require significant changes to the codebase.

@yn5
Copy link

yn5 commented Sep 5, 2016

@jonkemp Could you point out roughly what would have to change to prevent this library from invalidates our XML so we can come up with a pull request?

@jonkemp
Copy link
Owner

jonkemp commented Sep 5, 2016

@yn5 well, this plugin doesn't actually handle transforming the output. It goes through another module called inline-css.

https://github.com/jonkemp/inline-css

inline-css uses cheerio to do the html parsing, and cheerio uses another module called htmlparser2. If the issue is the XML being mangled then I would look there. htmlparser2 says it can handle XML.

https://github.com/cheeriojs/cheerio
https://github.com/fb55/htmlparser2/

@BroFox86
Copy link

BroFox86 commented Jan 26, 2020

I use gulp-htmltidy for emails to convert HTML to XHTML again with this doctype option:

export function build() {
  return src("temp/*.html")
    .pipe(plugins.inlineCss())
    .pipe(plugins.htmltidy({
      doctype: "Transitional",
      hideComments: false,
      indent: false
    }))
    .pipe(plugins.htmlBeautify())
    .pipe(dest("dist/"));
}

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

No branches or pull requests

4 participants