{"id":13442336,"url":"https://github.com/weavejester/hiccup","last_synced_at":"2025-05-14T11:08:26.758Z","repository":{"id":711734,"uuid":"358513","full_name":"weavejester/hiccup","owner":"weavejester","description":"Fast library for rendering HTML in Clojure","archived":false,"fork":false,"pushed_at":"2025-03-21T17:51:39.000Z","size":466,"stargazers_count":2732,"open_issues_count":25,"forks_count":177,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-05-07T10:52:37.780Z","etag":null,"topics":["clojure","hiccup","html"],"latest_commit_sha":null,"homepage":"http://weavejester.github.io/hiccup","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"atomton/ATMHud","license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weavejester.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-11-02T21:08:16.000Z","updated_at":"2025-05-07T08:21:14.000Z","dependencies_parsed_at":"2024-01-08T18:03:36.742Z","dependency_job_id":"3725790d-1b8c-4b2b-9861-7dd9981b51e7","html_url":"https://github.com/weavejester/hiccup","commit_stats":{"total_commits":284,"total_committers":41,"mean_commits":6.926829268292683,"dds":"0.19718309859154926","last_synced_commit":"24d55d1c7c1fc3c249395d261eb723c381843bc0"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fhiccup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fhiccup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fhiccup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Fhiccup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weavejester","download_url":"https://codeload.github.com/weavejester/hiccup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973678,"owners_count":21834107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","hiccup","html"],"created_at":"2024-07-31T03:01:44.484Z","updated_at":"2025-05-14T11:08:26.705Z","avatar_url":"https://github.com/weavejester.png","language":"Clojure","readme":"# Hiccup [![Build Status](https://github.com/weavejester/hiccup/actions/workflows/test.yml/badge.svg)](https://github.com/weavejester/hiccup/actions/workflows/test.yml)\n\nHiccup is a library for representing HTML in Clojure. It uses vectors\nto represent elements, and maps to represent an element's attributes.\n\n## Install\n\nAdd the following dependency to your `deps.edn` file:\n\n    hiccup/hiccup {:mvn/version \"2.0.0-RC5\"}\n\nOr to your Leiningen `project.clj` file:\n\n    [hiccup \"2.0.0-RC5\"]\n\n## Documentation\n\n* [Wiki](https://github.com/weavejester/hiccup/wiki)\n* [API Docs](http://weavejester.github.io/hiccup)\n\n## Syntax\n\nHere is a basic example of Hiccup syntax:\n\n```clojure\nuser=\u003e (require '[hiccup2.core :as h])\nnil\nuser=\u003e (str (h/html [:span {:class \"foo\"} \"bar\"]))\n\"\u003cspan class=\\\"foo\\\"\u003ebar\u003c/span\u003e\"\n```\n\nThe first element of the vector is used as the element name. The second\nattribute can optionally be a map, in which case it is used to supply\nthe element's attributes. Every other element is considered part of the\ntag's body.\n\nHiccup is intelligent enough to render different HTML elements in\ndifferent ways, in order to accommodate browser quirks:\n\n```clojure\nuser=\u003e (str (h/html [:script]))\n\"\u003cscript\u003e\u003c/script\u003e\"\nuser=\u003e (str (h/html [:p]))\n\"\u003cp /\u003e\"\n```\n\nAnd provides a CSS-like shortcut for denoting `id` and `class`\nattributes:\n\n```clojure\nuser=\u003e (str (h/html [:div#foo.bar.baz \"bang\"]))\n\"\u003cdiv id=\\\"foo\\\" class=\\\"bar baz\\\"\u003ebang\u003c/div\u003e\"\n```\n\nIf the body of the element is a seq, its contents will be expanded out\ninto the element body. This makes working with forms like `map` and\n`for` more convenient:\n\n```clojure\nuser=\u003e (str (h/html [:ul\n                     (for [x (range 1 4)]\n                       [:li x])]))\n\"\u003cul\u003e\u003cli\u003e1\u003c/li\u003e\u003cli\u003e2\u003c/li\u003e\u003cli\u003e3\u003c/li\u003e\u003c/ul\u003e\"\n```\n\nStrings are automatically escaped:\n\n```clojure\nuser=\u003e (str (h/html [:p \"Tags in HTML are written with \u003c\u003e\"]))\n\"\u003cp\u003eTags in HTML are written with \u0026lt;\u0026gt;\u003c/p\u003e\"\n```\n\nTo bypass this, use the `hiccup2.core/raw` function:\n\n```clojure\nuser=\u003e (str (h/html [:p (h/raw \"Hello \u003cem\u003eWorld\u003c/em\u003e\")]))\n\"\u003cp\u003eHello \u003cem\u003eWorld\u003c/em\u003e\u003c/p\u003e\"\n```\n\nThis can also be used for doctype declarations:\n\n```clojure\nuser=\u003e (str (h/html (h/raw \"\u003c!DOCTYPE html\u003e\") [:html {:lang \"en\"}]))\n\"\u003c!DOCTYPE html\u003e\u003chtml lang=\\\"en\\\"\u003e\u003c/html\u003e\"\n```\n\n## Differences between Hiccup 1 and 2\n\nIn brief: Hiccup 1 doesn't escape strings by default, while Hiccup 2\ndoes. They occupy different namespaces to ensure backward compatibility.\n\nIn Hiccup 1, you use the `h` function to escape a string - that is,\nensure that unsafe characters like `\u003c`, `\u003e` and `\u0026` are converted into\ntheir equivalent entity codes:\n\n```clojure\n(h1/html [:div \"Username: \" (h1/h username)])\n```\n\nIn Hiccup 2 strings are escaped automatically, but the return value from\nthe `html` macro is a `RawString`, rather than a `String`. This ensures\nthat the `html` macro can still be nested.\n\n```clojure\n(str (h2/html [:div \"Username: \" username]))\n```\n\nIt's recommended to use Hiccup 2 where possible, particularly if your\napp handles user data. Use of the non-core namespaces, such as\n`hiccup.page`, should be avoided with Hiccup 2.\n\n## License\n\nCopyright © 2023 James Reeves\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","funding_links":[],"categories":["Clojure","lang \u0026 extensions","Tools","Clojure Tools, Libraries, and Frameworks","HTML Manipulation","\u003ca name=\"Clojure\"\u003e\u003c/a\u003eClojure"],"sub_categories":["Mesh networks","JavaScript Libraries for Machine Learning"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweavejester%2Fhiccup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweavejester%2Fhiccup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweavejester%2Fhiccup/lists"}