https://github.com/waddie/html2hiccup
HTML->hiccup transformer, a la Calva, but as a babashka task.
https://github.com/waddie/html2hiccup
babashka clojure hiccup html
Last synced: 7 days ago
JSON representation
HTML->hiccup transformer, a la Calva, but as a babashka task.
- Host: GitHub
- URL: https://github.com/waddie/html2hiccup
- Owner: waddie
- License: mit
- Created: 2026-05-20T16:43:11.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-21T10:29:13.000Z (about 2 months ago)
- Last Synced: 2026-05-21T18:45:31.252Z (about 2 months ago)
- Topics: babashka, clojure, hiccup, html
- Language: Clojure
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# html2hiccup
HTML->hiccup transformer, a la Calva, but as a babashka task.
## Usage
`html2hiccup [options]`
`html2hiccup [options] file1.html file2.htm ...`
### No files
- Reads HTML from `stdin`
- Writes hiccup to `stdout`
### With files
- Reads supplied files
- Writes sibling `.edn` files
### Options
- **`--add-classes-to-tag-keyword`** `true`|`false` (default: `true`)
Controls how CSS classes are handled in the output:
- **`true`**: Classes that can be valid Clojure keywords are attached directly
to the tag using hiccup's dot notation (e.g., `
`
becomes `[:div.btn.primary]`)
- **`false`**: All classes remain in a `:class` attribute as a vector (e.g.,
`[:div {:class ["btn" "primary"]}]`)
Classes containing special characters (like hyphens, dots, or starting with
numbers) that can't be keywords are always placed in the `:class` attribute
regardless of this setting.
- **`--kebab-attrs`** `true`|`false` (default: `false`)
Controls the casing of HTML attribute names in the output:
- **`true`**: Attribute names are converted to kebab-case using the
`camel-snake-kebab` library (e.g., `dataFooBar` → `:data-foo-bar`, `innerHTML`
→ `:inner-html`)
- **`false`**: Attribute names are lowercased (e.g., `dataFooBar`
→ `:datafoob`)
Special cases like `baseprofile` → `:base-profile` and `viewbox` → `:view-box`
are always handled correctly regardless of this setting.
- **`--mapify-style`** `true`|`false` (default: `false`)
Controls how the CSS `style` attribute is represented:
- **`true`**: The style string is parsed and converted to a map with Clojure
keywords as keys (e.g., `style="color: red; font-size: 14px"` becomes `{:style
{:color "red" :font-size 14.0}}`). Numeric values are converted to numbers, and
alphabetic values become keywords.
- **`false`**: The style remains as a CSS string (e.g., `{:style "color: red;
font-size: 14px"}`)