Coder Social home page Coder Social logo

Comments (4)

ibrahima avatar ibrahima commented on May 20, 2024

I think I came across a similar issue. The problem, I think, is that if you have some interpolated values that don't have any leading whitespace, that becomes the minimum whitespace. Then, stripIndent does also include the trim transformer, so the first line gets trimmed of the leading whitespace, but all other lines are untouched.

This is a little surprising to me, because I expected template tags to operate on the template literal before interpolation, rather than not after, but I haven't fully understood how this stuff all works yet.

from common-tags.

ibrahima avatar ibrahima commented on May 20, 2024

Aha! In this case, you're actually meant to use the html tag which does handle embedded newlines.

This tag is also aliased to source and codeBlock, which make more sense to me, since personally I'm not writing HTML here.

from common-tags.

fatfisz avatar fatfisz commented on May 20, 2024

Hi, I can confirm that the issue is there in v1.4.0. I can't check right now whether it was fixed in #114, but will do so later today. In any case, a version with a fix should be released in a matter of days - keep your fingers crossed 🤞

from common-tags.

fatfisz avatar fatfisz commented on May 20, 2024

@ibrahima is right - "fixing" stripIndent would turn it into source, so I guess the only thing that's not working here is the naming (one of the unsolved problems of computer science 😉). I'll be adding a note about this particular behavior to the docs.

from common-tags.

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.