Git Product home page Git Product logo

Comments (6)

ccampbell avatar ccampbell commented on September 23, 2024

I think it's cause you have to use html entities for the tags.

var html = "<html><h2>Hi World!</h2></html>";

from rainbow.

matthewmueller avatar matthewmueller commented on September 23, 2024

This seems like a bug, I wouldn't have expected this behavior. What do you think?

from rainbow.

ccampbell avatar ccampbell commented on September 23, 2024

I'm not sure. At least in the context of the page itself if you do:

<pre>
    <p>paragraph</p>
</pre>

The browser treats this as a paragraph tag and renders it as a paragraph so you have to do:

<pre>
    &lt;p&gt;paragraph&lt;/p&gt;
</pre>

And this makes sense here because I think your code should look correct inside the <pre> without javascript enabled.

I agree in the context of passing a string directly in it is not intuitive that you should have to convert the html entities.

from rainbow.

ccampbell avatar ccampbell commented on September 23, 2024

I will look into adding support for a stripped down version of this:
http://phpjs.org/functions/htmlspecialchars:426

from rainbow.

matthewmueller avatar matthewmueller commented on September 23, 2024

That's interesting, I didn't realize <pre> tags actually converted it like that - guess it makes sense though.

Thanks man, I'm glad to see this got taken care of so quickly - I'm really digging this library.

from rainbow.

ccampbell avatar ccampbell commented on September 23, 2024

No problem, Thank you!

from rainbow.

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.