Code Monkey home page Code Monkey logo

Comments (4)

ezhlobo avatar ezhlobo commented on August 11, 2024 10

@brayhoward thank you for the answer. I was inspired by your suggestions and found this solution:

pug`
  p= 'Hello,\u00A0World'
`

But why   does not work in general? React supports it by default, but it's not available for us through react-pug...

PS. Why do you add spaces around the non-breaking space? I can't imagine a case for this...

from babel-plugin-transform-react-pug.

brayhoward avatar brayhoward commented on August 11, 2024 4

I think your no-break-space entity just needs spaces around it.

pug`
  p Hello,   World!
`

If not try passing it as a string w/ the unicode number

pug`
  p #{`Hello, ${String.fromCharCode(160)} World!`}
  // or 
  p ${"Hello, \u00A0 World!"}
`

And if all else fails

pug`
  p dangerouslySetInnerHTML={__html: 'First   Second'}
`

Be careful generating html like that though. You can read more about it here

from babel-plugin-transform-react-pug.

ezhlobo avatar ezhlobo commented on August 11, 2024 1

I investigated how it works internally (I mean this package and babel plugins) and realized, that it's definitely a problem in babel. They transform   to \u00A0 (actually to \xA0) during parsing phase if it's inside JSXText.

This message is just for your information. We still need to figure out the best way to do it for this plugin.

from babel-plugin-transform-react-pug.

ezhlobo avatar ezhlobo commented on August 11, 2024

It works from the 5th version.

from babel-plugin-transform-react-pug.

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.