Coder Social home page Coder Social logo

Support for cheerio options about inky HOT 7 CLOSED

dherges avatar dherges commented on July 30, 2024 1
Support for cheerio options

from inky.

Comments (7)

ibarral avatar ibarral commented on July 30, 2024

Hello,

Do you have an example to pass cherio options to the inky() function? I can't make it work.

Thanks!

from inky.

dherges avatar dherges commented on July 30, 2024

Yes, use it like this with gulp/vinyl (inky from the master branch):

vfs.src('somefile.html')
  .pipe(inky({cheerio: {decodeEntities: false}}))
  .pipe(vfs.dest('output'))

somefile.html:

"mytext"

output:

"mytext"

So, the options are actually passed to cheerio.load(input, opts), but entities (") go missing in the final output (after releaseTheKraken().html() ... guess that happens in componentFactory.js

from inky.

dherges avatar dherges commented on July 30, 2024

I was able to drill down the issue

this input results in decoded entities for the text "broken" .. output &quot;broken&quot;" despite passing {decodeEntities: false}. "works" is outputted as "works" (since its outside the <center> tag ?).

<table class="body">
  <tr>
    <td class="center" align="center" valign="top">
      <center>
"broken"
      </center>
"works"
    </td>
  </tr>
</table>

putting an attribute data-parsed on the <center> tag works for both texts. inside and outside the center tag, output is "works"

<table class="body">
  <tr>
    <td class="center" align="center" valign="top">
      <center data-parsed>
"works"
      </center>
"works"
    </td>
  </tr>
</table>

from inky.

ibarral avatar ibarral commented on July 30, 2024

Thanks for the update!

But I have a doub't: I have installed Inky using NPM (https://www.npmjs.com/package/inky).

I'm using Gulp to compile the files, and if I pass the cheerio options to Inky, for example:

.pipe(inky({cheerio: {decodeEntities: false}}))

It won't work.

This feature works ok from the NPM version?

Thanks!

from inky.

dherges avatar dherges commented on July 30, 2024

No, the feature was introduced here 9fda83e#diff-168726dbe96b3ce427e7fedce31bb0bc and is included in the master branch ...

try npm install github:zurb/inky#master to get it

from inky.

ibarral avatar ibarral commented on July 30, 2024

Ok, thanks for your help! :)

from inky.

rafibomb avatar rafibomb commented on July 30, 2024

@dherges @ibarral Just published the Foundation for Emails 2.1 release blog post and the release went out this morning! We also started a discussion on the future of Inky and what amazing integrations can be made. I'm sure you have some comments, questions, or ideas: http://foundation.zurb.com/forum/posts/39717-architecting-the-future-of-foundation-for-emails

from inky.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.