Hiccup style syntax for generating HTMLλ︎
Rather that write HTML code, you can use Clojure to write it for you. This provides a simpler to type syntax based on the vector in Clojure.
Instead of angle bracket < >
and tags like p
. you can define section using vectors [ ]
and :keywords
.
Examplesλ︎
(require '[reagent.core :as r])
So for a header you would write
A simple piece of HTML (for web pages)
[:div
[:h1 "This is HTML code generated by Clojure"]
[:p "Hiccup is a simple way to write HTML in Clojure, without all those angle brackets"]
[:a {:href "https://github.com/weavejester/hiccup"}
"Read more about Hiccup at its Github repository"]]
We can also create HTML for displaying images