Hacker News new | ask | show | jobs
by Pitarou 3297 days ago
Is there an easy way to do represent something like this in Cell:

    <p>I will say this <em>emphatically</em></p>
As far as I can tell, Cell doesn’t permit this. If you have multiple child nodes ($components), none of them can be text nodes, so you have to work around it like this:

    <p><span>I will say this </span><em>emphatically</em></p>
Why not do away with the $text keyword entirely, and treat any strings in the $components list as text nodes? So instead of this:

    $text: "Buy now!!".
you have this:

    $components: ["Buy now!!"],
and instead of this:

    $components: [
      {$type: "span", $text: "Buy "},
      {$type: "em", $text: "now!!},
    ],
you have this:

    $components: [
      "Buy ",
      {$type: "em", $text: "now!!},
    ],
1 comments

You'll see how to do this at the end of this section https://github.com/intercellular/tutorial#a-creating-a-simpl...

Hope this helps!