Skip to content

Example does not render as html? #141

Open

Description

@daslicht

Is it normal that html tags are not rendered but output as string ?

http://leonidas.github.io/transparency/
?

Activity

  1. rikukissa commented on Aug 7, 2015

    @rikukissa
    Contributor

    By looking at the code it surely seems that it's intentional 😕. @pyykkis has it always been like that and is it intentional? Maybe it should be replaced with some other example either way

  2. rikukissa commented on Aug 8, 2015

    @rikukissa
    Contributor

    The "Goodbye!" is also not rendered so I'm guessing thats not intentional..

  3. daslicht commented on Aug 8, 2015

    @daslicht
    Author

    if you add _class= "span"_ to the span _Goodbye!_ is rendered :)

  4. rmx90210 commented on Mar 17, 2016

    @rmx90210

    I love this project but I'm running into the same issue -- HTML is being rendered as plain text.

    +1

  5. kristoff-it commented on Mar 17, 2016

    @kristoff-it

    @rbrtmrtn

    Maybe I didn't properly understand the question, but when I want to render a property as HTML, I use the relative directive:

    myobj = { description: "<i>banana</i>" }
    mydirective = {description: {html: function (params) {return this.description}}}
    $("<div class='mainbody'>\n\
            <div class='description'></div>\n\
    </div>").render(myobj, mydirective)

    Result:

    <div class='mainbody'>
        <div class='description'><i>banana</i></div>
    </div>
  6. rmx90210 commented on Mar 18, 2016

    @rmx90210

    @kristoff-it I wasn't aware of the relative directive, perhaps that would solve it. (Though it seems like a lot of overhead to include arbitrary HTML in a template). I was mainly confused as to why the demo itself doesn't seem to be rendering properly:

    http://leonidas.github.io/transparency/

    In the Result pane, shouldn't that text be italicized?

  7. kristoff-it commented on Mar 18, 2016

    @kristoff-it

    Uhm yeah that's weird, I suppose it's something that has been left behind from the earlier days of this project.

    I've only used transparency for one project as of now, so I'm not a super expert, but:

    Though it seems like a lot of overhead to include arbitrary HTML in a template

    If the HTML in question is generated by you in the browser, I suggest you try to change how your app is structured to make, for example, transparency handle also that rendering.

    If the HTML is recieved as-is, then you don't have much choice I guess, but it's not that bad, in my project I have to render some RSS feeds like this and, while the syntax is not the most concise, it still works flawlessly. I still prefere this over weird naming conventions a la Ruby.

    Alternatively you could $.html(function) all the html contents afterwards: http://api.jquery.com/html/#html2 (if you pass a function you can have a form of iteration over your data structure).

  8. rmx90210 commented on Mar 18, 2016

    @rmx90210

    Those seem like good workarounds, thanks @kristoff-it ! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions