hexo-util
Utilities for Hexo.
Plain-English Explanation: hexo-util
This is a toolbox of helper functions for Hexo, which is a static blog generator. Think of it as a collection of small utilities that make it easier to process text, code, and URLs when building a blog—things you'd need to do over and over again.
The package provides about a dozen useful functions. Some handle text cleanup: escaping special characters so they display safely in HTML, removing HTML tags, or turning a messy phrase like "Hellô Wòrld" into a clean, URL-safe slug like "hello-world". Others handle code presentation, like syntax highlighting for code blocks with line numbers and captions. A few are specifically designed for blog permalinks—the fixed URLs that point to each post—allowing you to define a pattern like :year/:month/:day/:title and then parse URLs to extract the year, month, day, and title, or reverse the process to generate a URL from those pieces. There are also utilities for wrapping long lines of text, truncating text to a maximum length, and building HTML tags programmatically.
If you're building a blog with Hexo or creating a plugin for it, you'd use this library to avoid reinventing these common operations. For example, when a user writes a blog post title with accented characters or mixed case, you'd use the slugize function to turn it into a proper URL segment. When displaying code samples on a blog, you'd use the highlight function to add syntax coloring and line numbers. These are small tasks individually, but they add up quickly when you're processing dozens or hundreds of blog posts.
The library is intentionally focused and lightweight—it does one thing well by providing the small utility functions that a blog engine needs repeatedly, rather than trying to be a massive, all-purpose toolkit.