karaxnim/karax

bulma icon

mantielero opened this issue · 2 comments

I am trying to show an icon with bulma. That is done with:

<span class="icon">
  <i class="fas fa-home"></i>
</span>

With karax:

span(class="icon"):
  i(class="fas fa-home")

gives the error:

Error: undeclared identifier: 'i'

Is there anything that I could do about it?

ajusa commented

Some of the shorter tag names are different from their HTML counterparts, similar to tdiv. For <i> we use italic instead. See https://github.com/karaxnim/karax/blob/master/karax/vdom.nim#L34 for the mapping.

Your example should become

span(class="icon"):
  italic(class="fas fa-home")

I'll also recommend you check out https://github.com/nim-lang-cn/html2karax if you have to convert a bunch of HTML to Karax's syntax, it handles this case automatically.

Thanks a lot.