Hickory

screenshot of Hickory

HTML as data

Overview

Hickory is a powerful tool for parsing HTML into Clojure data structures, allowing for efficient analysis, transformation, and regeneration of HTML. By providing seamless conversion to Hiccup vectors and a DOM-like format, Hickory opens up a world of possibilities for developers working with both Clojure and ClojureScript. With its ability to handle HTML documents and fragments, Hickory caters to the varying needs of modern web development, allowing for robust manipulation and management of HTML content.

The library not only simplifies the task of parsing HTML but also boasts features that allow developers to traverse and manipulate the resulting data structures easily. With built-in zippers and CSS-style selectors, Hickory makes it a breeze to navigate and edit complex HTML trees, enhancing the overall developer experience.

Features

  • Flexible Parsing Options: Use parse for entire HTML documents or parse-fragment for smaller segments, returning well-structured parsed objects.

  • Hiccup and Hickory Formats: Convert parsed HTML to Hiccup vector trees or Hickory DOM maps using as-hiccup and as-hickory functions for versatile data handling.

  • Zipper Functionality: The hickory.zip namespace provides zippers for easy traversal, modification, and retrieval of the transformed data structures.

  • Powerful CSS-Style Selectors: Access and manipulate Hickory data using robust selectors in the hickory.select namespace, designed for enhanced functionality beyond standard CSS.

  • Cross-Platform Support: Works seamlessly in both Clojure and ClojureScript environments, making it a flexible choice for all types of web development.

  • Well-Structured Output: Converting modified tree structures back into HTML format is simple with the hickory-to-html function, ensuring a smooth workflow from parsing to output.

  • Easy Fragment Handling: Effortlessly manage and process smaller pieces of HTML without the need for entire document context, making it efficient for dynamic web applications.

This combination of features position Hickory as a go-to library for developers looking to efficiently parse and manipulate HTML in their Clojure projects.