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

What's the public API to get html5? #116

Closed lvh closed 8 years ago

lvh commented 8 years ago

There's the html5 macro, but the public API seems to be html, which does take some opts. Whichever the official thing I should be using is, I'd be happy to submit a PR documenting that, as well as how to produce html5, xhtml, html4... for the README.

lvh commented 8 years ago

(Also, I feel like html5 should probably be the default.)

weavejester commented 8 years ago

The hiccup.page/html5 macro is for producing complete HTML pages, so it'll add a doctype and html tags. The hiccup.core/html macro just produces a segment of HTML.

(hiccup.page/html5 [:span "foo"])
=> "<!DOCTYPE html>\n<html><span>foo</span></html>"

(hiccup.core/html [:span "foo"])
=> "<span>foo</span>"

The API docs do say that the html5 function creates "a HTML5 document", but perhaps the meaning of this could be clearer. I'll accept clarifications to the docstrings.

lvh commented 8 years ago

Thanks! I think the docstring is plenty clear; I just had no idea that was an API I was supposed to use. I've submitted #117 to mention that API in the README.

weavejester commented 8 years ago

I don't think this requires an update to the README. All the namespaces in the API docs are APIs you can use. If they weren't, they wouldn't be in the API docs. If the API docs are clear about the purpose of the functions, then we don't need additional documentation.

lvh commented 8 years ago

Okay. I guess I'll kill that PR then; thanks again.