# Herb

> A modern templating language for the HTML+ERB you already have.

Source: https://talira.ai/catalog/herb-q1h23fgr
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool, Library
- Categories: [developer tools / linting](https://talira.ai/categories/developer-tools/linting), [languages / ruby](https://talira.ai/categories/languages/ruby), [frameworks / rails](https://talira.ai/categories/frameworks/rails)
- Platforms: linux, macos, windows, cli, web
- Licence: MIT
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes
- Creator: Marco Roth (marcoroth)

Herb reads the HTML and the Ruby in .html.erb templates as one document, using a fast HTML-aware ERB parser written in C (with Prism for the Ruby) and bindings for Ruby, JavaScript, Java, Rust and WebAssembly. On top of it sit a linter for HTML, ERB, accessibility and Action View conventions, an experimental formatter, a language server for VS Code, [Zed](https://talira.ai/catalog/zed-61vzw5qc.md), [Neovim](https://talira.ai/catalog/neovim-f2kytbe3.md), [RubyMine](https://talira.ai/catalog/rubymine-9x5wmsqg.md) and other editors, a dev server and browser dev tools. Herb::Engine renders templates the way Erubi does, escaping each value for where it sits in the HTML; the README says the Rails 8.2 framework defaults render HTML templates with it.

## Links

- Website: https://herb-tools.dev
- GitHub: https://github.com/marcoroth/herb
- Docs: https://herb-tools.dev/overview

## Problems it solves

- lint my Rails ERB views for unclosed tags and mismatched elements before they reach production
- a missing %> in a view only shows up as a confusing error when the page renders
- format .html.erb files consistently across the team
- get diagnostics and formatting for ERB templates in VS Code or Neovim
- catch accessibility mistakes like missing alt text in server-rendered Rails templates
- parse ERB templates into a syntax tree so I can build my own tooling or codemods
- check ERB views in CI without adding a dependency to the project
- render ERB templates with HTML-context-aware escaping instead of plain Erubi
- see the page update in the browser as soon as I save a Rails view
- enforce Action View helper conventions in templates
- erb_lint is slow and doesn't really understand the HTML structure

## Features

- HTML-aware ERB parser in C with Prism
- bindings for Ruby, JavaScript, Java, Rust and WebAssembly
- linter (HTML, ERB, accessibility, Action View rules)
- formatter (experimental)
- language server for VS Code, Zed, Neovim, RubyMine, Helix, Sublime Text and others
- Herb::Engine, Erubi-compatible rendering with context-aware escaping
- dev server (experimental)
- in-browser dev tools
- browser playground
- gem exec herb analyze with no install

## Capabilities

- Has a command line tool: plan not known
- Has official SDKs: plan not known

## Trust

Overall: 0.65 out of 1.
Signals: maintenance 1.00, adoption 0.62, momentum 0.50, community 0.79, backing 0.20, extensibility 0.20.

- last commit 9 days ago
- 488 commits in the last 90 days
- latest release v0.11.2 18 days ago
- 1.3k GitHub stars
- 91 contributors
- accepts sponsorship (Github)
- created by Marco Roth (marcoroth)
