[HN Gopher] Herb: Powerful and seamless HTML-aware ERB parsing a...
___________________________________________________________________
Herb: Powerful and seamless HTML-aware ERB parsing and tooling
Author : todsacerdoti
Score : 65 points
Date : 2025-04-16 12:52 UTC (4 hours ago)
(HTM) web link (herb-tools.dev)
(TXT) w3m dump (herb-tools.dev)
| banga wrote:
| Excellent, I was looking for a Educational Records Bureau parser.
|
| Oh, wait...
| Alifatisk wrote:
| > Parses input fast enough to update on every keystroke, ensuring
| real-time responsiveness...
|
| Wow!!! Cool to see ERB being embraced and enhanced in this way,
| I'll have to check it out
| Mystery-Machine wrote:
| It's great to see new developer tooling advances in Ruby
| ecosystem! Looking forward to the VS Code integration as well as
| linter integrations.
| jy14898 wrote:
| ERB: https://en.wikipedia.org/wiki/ERuby
| 9dev wrote:
| If you're not familiar with the Ruby ecosystem, the site does a
| very poor job of communicating what this is actually about. A
| single definition of ERB would have helped a lot.
| notpushkin wrote:
| I'm not sure it's targeted towards those not familiar with
| Ruby... though yeah, at least mentioning it's a templating
| engine would make it a lot easier to grasp.
|
| (ERB is, I think, "embedded Ruby", and it functions basically
| like old school PHP: you just insert pieces of Ruby code
| wrapped by <% .. %> or <%= .. %>:
| https://github.com/ruby/erb#recognized-tags)
| notpushkin wrote:
| If it is what I think it is, it's _extremely_ neat. Parsing both
| HTML and templating syntax at the same time is way more robust
| than doing just the templating and hoping for the best.
|
| I was thinking about something like this, but with some blend of
| Jinja2 / Twig / Nunjucks [1] syntax and Svelte/JSX-like use of
| variables in element attributes: {% for para in
| page.body %} <p class={{ para.class }} {{ **para.attrs
| }}> {{ para.text }} </p> {% endfor %}
|
| ---
|
| [1]: the irony is not lost on me that I'm mentioning Python, PHP
| and JS template engines in a Ruby discussion :-) Liquid is the
| closest equivalent I think, but there was some crucial piece
| missing last time I had to use it, though I can't remember what
| exactly.
| frainfreeze wrote:
| This is something you could do with tree-sitter https://tree-
| sitter.github.io/tree-sitter/
| evtothedev wrote:
| I hope this results in a vastly improved version of the VSCode
| extension vscode-erb-beautify.
| mrinterweb wrote:
| One thing that's not very clear from the documentation is what
| the application of this may be. I see that it parses ERB and or
| HTML into an AST. Is this intended to enable improved HTML and
| ERB linters and language servers? This seems like a tool that
| other development tools will benefit from.
|
| I realize this is new, but as tools start using herb, it would
| nice to link to those tools from the herb website and or github
| readme.
| hoipaloi wrote:
| Yes, I believe tooling, linters and language servers for HTML
| plus ERB is what Herb is for.
___________________________________________________________________
(page generated 2025-04-16 17:00 UTC)