weavejester / hiccup

Fast library for rendering HTML in Clojure
http://weavejester.github.io/hiccup
Eclipse Public License 1.0
2.68k stars 174 forks source link

:foo/bar renders as bar #135

Open greg-at-droit opened 8 years ago

greg-at-droit commented 8 years ago

Thank you for hiccup!

I'm curious what's the thinking behind taking only the name of keywords here?

(extend-protocol ToString
  clojure.lang.Keyword
  (to-str [k] (name k))
  ....

As a result:

user> (hiccup.util/as-str :foo/bar)
"bar"

user> (hiccup.core/html [:p :foo/bar])
"<p>bar</p>"

Now that I understand what's happening, a work-around is to force keywords to str. But it was confusing me for longer than I'd like to admit, so I wanted to ask.