### Install Herb Language Server with bun Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/neovim.md Install the Herb Language Server globally using bun. This is a prerequisite for manual configuration and some other setup methods. ```bash bun add -g @herb-tools/language-server ``` -------------------------------- ### Quick Start Herb Language Server with NPX Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors.md Run the Herb Language Server without a global installation using npx. This is convenient for testing or temporary use. ```bash npx @herb-tools/language-server --stdio ``` -------------------------------- ### Install Herb Language Server with yarn Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/neovim.md Install the Herb Language Server globally using yarn. This is a prerequisite for manual configuration and some other setup methods. ```bash yarn global add @herb-tools/language-server ``` -------------------------------- ### Install Herb Language Server with npm Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/neovim.md Install the Herb Language Server globally using npm. This is a prerequisite for manual configuration and some other setup methods. ```bash npm install -g @herb-tools/language-server ``` -------------------------------- ### Install Herb Language Server with pnpm Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/neovim.md Install the Herb Language Server globally using pnpm. This is a prerequisite for manual configuration and some other setup methods. ```bash pnpm add -g @herb-tools/language-server ``` -------------------------------- ### Setup Herb LS with nvim-lspconfig (nvim 0.11+) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/neovim.md Configure the Herb Language Server using nvim-lspconfig for Neovim versions 0.11 and above. Ensure the server is installed globally first. ```lua require('lspconfig') vim.lsp.enable('herb_ls') ``` -------------------------------- ### Install npm Modules Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/vscode/CONTRIBUTING.md Run this command in the project directory to install all necessary npm modules for both the client and server. ```bash yarn install ``` -------------------------------- ### Install stimulus-lint with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/stimulus-lint/README.md Use this command to install stimulus-lint using bun. ```shell bun add stimulus-lint ``` -------------------------------- ### Example .herb.yml configuration Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/config/README.md This is an example of a `.herb.yml` file, which is used for project-specific configuration. It defines settings for the linter and formatter. ```yaml version: 0.10.1 linter: enabled: true rules: erb-no-extra-newline: enabled: false formatter: enabled: true indentWidth: 2 maxLineLength: 120 ``` -------------------------------- ### Setup Herb LS with nvim-lspconfig (nvim <= 0.10) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/neovim.md Configure the Herb Language Server using nvim-lspconfig for Neovim versions 0.10 and below. Ensure the server is installed globally first. ```lua require('lspconfig').herb_ls.setup() ``` -------------------------------- ### Example Herb Configuration File Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/language-server/README.md An example of a .herb.yml configuration file for the Herb tools, including settings for the linter and formatter. ```yaml # .herb.yml linter: enabled: true formatter: enabled: true indentWidth: 2 maxLineLength: 80 ``` -------------------------------- ### GitHub Actions Output Example (Simple) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md This example demonstrates the output when using the `--github` flag with the simple format. It provides minimal local output while still generating GitHub Actions annotations. ```text ::error file=template.html.erb,line=3,col=3,title=html-img-require-alt • @herb-tools/linter@0.10.1::Missing required `alt` attribute on `` tag [html-img-require-alt]%0A%0A%0Atemplate.html.erb:3:3%0A%0A 1 │
%0A 2 │ Test content%0A → 3 │ %0A │ ~~~%0A 4 │
%0A template.html.erb: 3:3 ✗ Missing required `alt` attribute on `` tag [html-img-require-alt] ``` -------------------------------- ### Check Java Installation Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/java/index.md Verify that Java is installed on your system by checking its version. ```shell java -version ``` -------------------------------- ### Start Herb Dev Server Source: https://github.com/marcoroth/herb/blob/main/docs/docs/projects/dev-server.md Use this command to start the Herb development server. Specify a directory to watch and an optional port. ```bash herb dev [directory] [--port 8592] ``` -------------------------------- ### Install @herb-tools/browser with bun Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the Herb browser package using bun. This is required for browser environments. ```shell bun add @herb-tools/browser ``` -------------------------------- ### Install @herb-tools/tailwind-class-sorter Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/tailwind-class-sorter/README.md Install the package as a development dependency. ```sh npm install -D @herb-tools/tailwind-class-sorter ``` -------------------------------- ### Install stimulus-lint with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/stimulus-lint/README.md Use this command to install stimulus-lint using npm. ```shell npm install stimulus-lint ``` -------------------------------- ### Example of a Formatted File Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/formatter/README.md This is an example of a file that will be formatted by the Herb formatter. ```erb
This file will be formatted
``` -------------------------------- ### Install stimulus-lint with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/stimulus-lint/README.md Use this command to install stimulus-lint using pnpm. ```shell pnpm add stimulus-lint ``` -------------------------------- ### Install stimulus-lint with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/stimulus-lint/README.md Use this command to install stimulus-lint using yarn. ```shell yarn add stimulus-lint ``` -------------------------------- ### Manual Configuration for Herb LS in Neovim (Lua) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/neovim.md Manually configure and start the Herb Language Server for 'eruby' and 'erb' file types using Lua. This method requires the server to be installed globally and sets up capabilities for completion. ```lua vim.api.nvim_create_autocmd("FileType", { pattern = { "eruby", "erb" }, callback = function() vim.lsp.start({ name = "herb-language-server", cmd = { "herb-language-server", "--stdio" }, root_dir = vim.fs.dirname(vim.fs.find({ ".git", "Gemfile" }, { upward = true })[1]), capabilities = require('cmp_nvim_lsp').default_capabilities(), }) end, }) ``` -------------------------------- ### Install Herb Language Server Globally Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/helix.md Install the Herb Language Server globally using your preferred package manager. Ensure you have Node.js and npm, yarn, pnpm, or bun installed. ```bash npm install -g @herb-tools/language-server ``` ```bash yarn global add @herb-tools/language-server ``` ```bash pnpm add -g @herb-tools/language-server ``` ```bash bun add -g @herb-tools/language-server ``` -------------------------------- ### Build Herb Browser Library Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/browser/README.md Run this command to build the library. Ensure you have Nx installed in your project. ```bash nx build browser ``` -------------------------------- ### Install @herb-tools/node with bun Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the Herb Node.js package using bun. This is required for Node.js environments. ```shell bun add @herb-tools/node ``` -------------------------------- ### Install @herb-tools/highlighter with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/highlighter/README.md Use this command to add the highlighter package to your project using bun. ```shell bun add @herb-tools/highlighter ``` -------------------------------- ### Herb Linter Configuration File Example Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Example of configuring the linter's fail level in the .herb.yml configuration file. ```yaml linter: failLevel: warning ``` -------------------------------- ### GitHub Actions Output Example (Detailed) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md This example shows the output when using the `--github` flag with the detailed format. It includes GitHub Actions annotations with embedded code previews and full error context. ```text ::error file=template.html.erb,line=3,col=3,title=html-img-require-alt • @herb-tools/linter@0.10.1::Missing required `alt` attribute on `` tag [html-img-require-alt]%0A%0A%0Atemplate.html.erb:3:3%0A%0A 1 │
%0A 2 │ Test content%0A → 3 │ %0A │ ~~~%0A 4 │
%0A [error] Missing required `alt` attribute on `` tag [html-img-require-alt] template.html.erb:3:3 1 │
2 │ Test content → 3 │ │ ~~~ 4 │
``` -------------------------------- ### Install Herb Formatter Globally Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/formatter/README.md Install the Herb Formatter globally using npm, pnpm, yarn, or bun for command-line access. ```shell npm install -g @herb-tools/formatter ``` ```shell pnpm add -g @herb-tools/formatter ``` ```shell yarn global add @herb-tools/formatter ``` ```shell bun add -g @herb-tools/formatter ``` -------------------------------- ### Install Required Packages (Linux) Source: https://github.com/marcoroth/herb/blob/main/CONTRIBUTING.md Installs the necessary development packages for Herb on Linux using apt-get. ```bash xargs sudo apt-get install < Aptfile ``` ```bash sudo apt-get install check clang-21 clang-tidy-21 clang-format-21 emscripten doxygen ``` -------------------------------- ### Install Herb Linter Globally with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Install the Herb Linter globally using bun. This makes the command available system-wide. ```shell bun add -g @herb-tools/linter ``` -------------------------------- ### Install @herb-tools/browser with yarn Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the Herb browser package using yarn. This is required for browser environments. ```shell yarn add @herb-tools/browser ``` -------------------------------- ### Example Usage with Options Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/action_view/tag_test/test_0031_tag.div_with_dynamic_hash_data_attribute_value_5e302669a93e7316beeb935ed3dc1b53.txt This example shows how to pass options to the `tag.div` helper, specifically for the `data` attribute. The `options` local variable is used to define the nested hash structure. ```Ruby {source: "<%= tag.div data: { config: options } %>", locals: {options: {nested: true, count: 3}}, options: {action_view_helpers: true}} ``` -------------------------------- ### Good Examples of Tabindex Usage Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-no-positive-tab-index.md Demonstrates correct usage of `tabindex` for natural tab order, making elements focusable with `tabindex="0"`, and removing elements from the tab order with `tabindex="-1"`. No setup or imports are required. ```erb
Custom button
Focusable span ``` -------------------------------- ### Install @herb-tools/core from unreleased commit (bun) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the core Herb package from an unreleased commit using bun. Replace {commit} with the commit SHA or branch name. ```shell bun add https://pkg.pr.new/@herb-tools/core@{commit} ``` -------------------------------- ### Install @herb-tools/config with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/config/README.md Use this command to add the configuration package to your project using bun. ```shell bun add @herb-tools/config ``` -------------------------------- ### Install @herb-tools/core with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/core/README.md Use this command to add the core Herb package to your project using bun. ```shell bun add @herb-tools/core ``` -------------------------------- ### Install @herb-tools/browser with pnpm Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the Herb browser package using pnpm. This is required for browser environments. ```shell pnpm add @herb-tools/browser ``` -------------------------------- ### Install Herb Linter Globally with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Install the Herb Linter globally using yarn. This makes the command available system-wide. ```shell yarn global add @herb-tools/linter ``` -------------------------------- ### Install @herb-tools/node with npm Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the Herb Node.js package using npm. This is required for Node.js environments. ```shell npm add @herb-tools/node ``` -------------------------------- ### Install @herb-tools/node with pnpm Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the Herb Node.js package using pnpm. This is required for Node.js environments. ```shell pnpm add @herb-tools/node ``` -------------------------------- ### Install Dependencies (macOS) Source: https://github.com/marcoroth/herb/blob/main/CONTRIBUTING.md Installs the required dependencies for Herb on macOS using Homebrew. ```bash brew bundle ``` ```bash brew install check llvm@21 emscripten doxygen ``` -------------------------------- ### Herb Parse Example Source: https://github.com/marcoroth/herb/blob/main/CONTRIBUTING.md An example of parsing an HTML string using the Herb library within the interactive console. ```ruby Herb.parse("
") ``` -------------------------------- ### Install @herb-tools/node with yarn Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the Herb Node.js package using yarn. This is required for Node.js environments. ```shell yarn add @herb-tools/node ``` -------------------------------- ### Install @herb-tools/highlighter with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/highlighter/README.md Use this command to add the highlighter package to your project using npm. ```shell npm add @herb-tools/highlighter ``` -------------------------------- ### Install @herb-tools/printer with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/printer/README.md Use bun to add the @herb-tools/printer package to your project dependencies. ```shell bun add @herb-tools/printer ``` -------------------------------- ### Install @herb-tools/browser with npm Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the Herb browser package using npm. This is required for browser environments. ```shell npm add @herb-tools/browser ``` -------------------------------- ### Install @herb-tools/highlighter with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/highlighter/README.md Use this command to add the highlighter package to your project using yarn. ```shell yarn add @herb-tools/highlighter ``` -------------------------------- ### Install @herb-tools/core from unreleased commit (pnpm) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the core Herb package from an unreleased commit using pnpm. Replace {commit} with the commit SHA or branch name. ```shell pnpm add https://pkg.pr.new/@herb-tools/core@{commit} ``` -------------------------------- ### Install Herb Linter Globally with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Install the Herb Linter globally using pnpm. This makes the command available system-wide. ```shell pnpm add -g @herb-tools/linter ``` -------------------------------- ### Install Herb Linter Globally with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Install the Herb Linter globally using npm. This makes the command available system-wide. ```shell npm install -g @herb-tools/linter ``` -------------------------------- ### Initialize Herb Linter Configuration with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Initialize the Herb Linter configuration file using bun. ```shell bunx herb-lint --init ``` -------------------------------- ### Install Herb Language Service Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/language-service/README.md Install the Herb Language Service package using your preferred package manager. ```shell npm add @herb-tools/language-service ``` ```shell pnpm add @herb-tools/language-service ``` ```shell yarn add @herb-tools/language-service ``` ```shell bun add @herb-tools/language-service ``` -------------------------------- ### Install Herb Minifier with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/minifier/README.md Use this command to add the Herb Minifier package to your project using bun. ```shell bun add @herb-tools/minifier ``` -------------------------------- ### Install @herb-tools/highlighter with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/highlighter/README.md Use this command to add the highlighter package to your project using pnpm. ```shell pnpm add @herb-tools/highlighter ``` -------------------------------- ### Install @herb-tools/core from unreleased commit (yarn) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the core Herb package from an unreleased commit using yarn. Replace {commit} with the commit SHA or branch name. ```shell yarn add https://pkg.pr.new/@herb-tools/core@{commit} ``` -------------------------------- ### Get Herb Version Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/ruby/reference.md Use `Herb.version` to retrieve the version information for the installed Herb gem and its underlying C native extension. ```ruby Herb.version # => "herb gem v0.0.1, libherb v0.0.1 (Ruby C native extension)" ``` -------------------------------- ### Example Output of General Herb Configuration Source: https://github.com/marcoroth/herb/blob/main/docs/docs/configuration.md Shows the typical output when running `bundle exec herb config .`, detailing project root, config file, include/exclude patterns, and a list of processed files. ```text Herb Configuration Project root: /path/to/project Config file: /path/to/project/.herb.yml Include patterns: + **/*.herb + **/*.html.erb + **/*.html + **/*.turbo_stream.erb Exclude patterns: - coverage/**/* - node_modules/**/* - vendor/**/* Files (42 included, 5 excluded): Included: ✓ app/views/home/index.html.erb ✓ app/views/layouts/application.html.erb Excluded: ✗ vendor/bundle/gem/template.html.erb (vendor/**/*)] Tip: Use --tool linter or --tool formatter to see tool-specific configuration ``` -------------------------------- ### Render Partial with Object and Collection (Error Example) Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/analyze/render_test/test_0029_render_with_object_and_collection_error_86dc04e0658c38f07b8d6cc7a0645e42-f8009707a6f8814717b65550c888710c.txt This example demonstrates an incorrect usage of the `render` method where both `object:` and `collection:` options are provided. This will result in a `RenderObjectAndCollectionError` because these options are mutually exclusive. ```ruby <%= render partial: "product", object: @product, collection: @products %> ``` -------------------------------- ### Custom ASTRewriter Example Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/rewriter/README.md Defines a custom `ASTRewriter` named 'my-ast-rewriter' that uses the Visitor pattern to traverse and potentially modify AST nodes. The `initialize` method can be used for setup. ```javascript import { ASTRewriter } from "@herb-tools/rewriter" import { Visitor } from "@herb-tools/core" export default class MyASTRewriter extends ASTRewriter { get name() { return "my-ast-rewriter" } get description() { return "Transforms the AST" } // Optional: Load configuration or setup async initialize(context) { // context.baseDir - project root directory // context.filePath - current file being processed (optional) } // Transform the AST node rewrite(node, context) { // Use the Visitor pattern to traverse and modify the AST const visitor = new MyVisitor() visitor.visit(node) // Return the modified node return node } } class MyVisitor extends Visitor { visitHTMLElementNode(node) { // Modify nodes as needed // node.someProperty = "new value" this.visitChildNodes(node) } } ``` -------------------------------- ### Initialize Herb Linter Configuration with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Initialize the Herb Linter configuration file using npm. ```shell npx herb-lint --init ``` -------------------------------- ### Install Herb from Git Branch Source: https://github.com/marcoroth/herb/blob/main/README.md Install Herb and its dependency Prism from specific Git branches for testing pre-release versions. Ensure both gems are added to your Gemfile. ```ruby gem "prism", github: "ruby/prism", tag: "v1.9.0" gem "herb", github: "fork/herb", branch: "my-branch" ``` -------------------------------- ### Bad `aria-label` formatting examples Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-aria-label-is-well-formatted.md Avoid starting `aria-label` with lowercase, using line breaks (including HTML entities), or formatting that resembles IDs like snake_case, kebab-case, or camelCase. ```erb ``` ```erb ``` ```erb ``` ```erb ``` ```erb ``` ```erb ``` -------------------------------- ### Example Output of Tool-Specific Herb Configuration Source: https://github.com/marcoroth/herb/blob/main/docs/docs/configuration.md Demonstrates the output of `bundle exec herb config --tool linter`, showing combined include/exclude patterns for the linter and the files it will process. ```text Herb Configuration for Linter Project root: /path/to/project Config file: /path/to/project/.herb.yml Include patterns (files + linter): + **/*.html.erb + **/*.custom.erb Exclude patterns (files + linter): - node_modules/**/* - vendor/**/* - legacy/**/* Files for linter (40 included, 7 excluded): Included: ✓ app/views/home/index.html.erb Excluded: ✗ legacy/old.html.erb (legacy/**/*) ``` -------------------------------- ### Install @herb-tools/core from unreleased commit (npm) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Install the core Herb package from an unreleased commit using npm. Replace {commit} with the commit SHA or branch name. ```shell npm i https://pkg.pr.new/@herb-tools/core@{commit} ``` -------------------------------- ### UTF-8 String Compilation in Ruby Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/examples_compilation_test/test_0029_utf8_compilation_45fa7aa654c0dc06d1a1b9504002dfba.txt Illustrates how Ruby compiles a string containing UTF-8 characters and embedded ERB-like syntax. This example shows the initial setup and the process of building the final string. ```ruby _buf = ::String.new; _buf << 'Sitename • Title '.freeze; @title = "Home" _buf << ' '.freeze; _buf << ([@title, "Sitename"].compact.join(" • ")).to_s; _buf << " ".freeze; _buf.to_s ``` -------------------------------- ### Create .herb.yml Configuration Source: https://github.com/marcoroth/herb/blob/main/docs/docs/configuration.md Initialize a .herb.yml configuration file with default settings using the linter or formatter CLI. ```bash herb-lint --init ``` ```bash herb-format --init ``` -------------------------------- ### Install @herb-tools/printer with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/printer/README.md Use yarn to add the @herb-tools/printer package to your project dependencies. ```shell yarn add @herb-tools/printer ``` -------------------------------- ### Install @herb-tools/config with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/config/README.md Use this command to add the configuration package to your project using npm. ```shell npm add @herb-tools/config ``` -------------------------------- ### Valid HTML5 Tags (Good Examples) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-no-self-closing.md These examples demonstrate the correct, non-self-closing syntax for both void and non-void HTML elements. Ensure your HTML adheres to these patterns for valid HTML5. ```html
Logo

``` -------------------------------- ### Initialize Herb Linter Configuration with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Initialize the Herb Linter configuration file using pnpm. ```shell pnpm herb-lint --init ``` -------------------------------- ### Install @herb-tools/config with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/config/README.md Use this command to add the configuration package to your project using yarn. ```shell yarn add @herb-tools/config ``` -------------------------------- ### Install @herb-tools/rewriter with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/rewriter/README.md Use bun to add the @herb-tools/rewriter package to your project dependencies. ```shell bun add @herb-tools/rewriter ``` -------------------------------- ### Install @herb-tools/printer with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/printer/README.md Use pnpm to add the @herb-tools/printer package to your project dependencies. ```shell pnpm add @herb-tools/printer ``` -------------------------------- ### Initialize Herb Linter Configuration with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Initialize the Herb Linter configuration file using yarn. ```shell yarn herb-lint --init ``` -------------------------------- ### Install @herb-tools/printer with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/printer/README.md Use npm to add the @herb-tools/printer package to your project dependencies. ```shell npm add @herb-tools/printer ``` -------------------------------- ### Basic Usage Example Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/tailwind-class-sorter/README.md Demonstrates the basic asynchronous sorting of a Tailwind CSS class string using `sortTailwindClasses`. ```js import { sortTailwindClasses } from '@herb-tools/tailwind-class-sorter' const sorted = await sortTailwindClasses('px-4 bg-blue-500 text-white rounded py-2') // Result: 'rounded bg-blue-500 px-4 py-2 text-white' ``` -------------------------------- ### Install @herb-tools/config with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/config/README.md Use this command to add the configuration package to your project using pnpm. ```shell pnpm add @herb-tools/config ``` -------------------------------- ### Build Herb Java/JNI Bindings Source: https://github.com/marcoroth/herb/blob/main/java/README.md Navigate to the java directory and execute make commands to build the templates, JNI library, and Java bindings. ```bash cd java make templates make jni make java ``` -------------------------------- ### Install @herb-tools/core with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/core/README.md Use this command to add the core Herb package to your project using yarn. ```shell yarn add @herb-tools/core ``` -------------------------------- ### Configuration Merging Example in .herb.yml Source: https://github.com/marcoroth/herb/blob/main/docs/docs/configuration.md Illustrates how top-level file patterns and tool-specific patterns are merged. Include patterns are additive, and patterns are applied in a specific order. ```yaml files: include: - '**/*.xml.erb' # Applies to all tools exclude: - 'public/**/*' # Added to default excludes for all tools linter: include: - '**/*.custom.erb' # Only applies to linter exclude: - 'legacy/**/*' # Added to excludes for linter only ``` -------------------------------- ### Install Herb Linter as Dev Dependency with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Add the Herb Linter as a development dependency to your project using bun. ```shell bun add -D @herb-tools/linter ``` -------------------------------- ### Install @herb-tools/core with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/core/README.md Use this command to add the core Herb package to your project using npm. ```shell npm add @herb-tools/core ``` -------------------------------- ### Good ERB Template Example Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/erb-no-trailing-whitespace.md This is an example of ERB code that adheres to the no-trailing-whitespace rule. ```erb

Hello

``` ```erb <%= content %> ``` ```erb

Title

``` -------------------------------- ### Install @herb-tools/core with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/core/README.md Use this command to add the core Herb package to your project using pnpm. ```shell pnpm add @herb-tools/core ``` -------------------------------- ### Run Herb Language Server Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors.md Start the Herb Language Server using the stdio communication protocol. This is a common way to run language servers. ```bash herb-language-server --stdio ``` -------------------------------- ### Install Herb Minifier with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/minifier/README.md Use this command to add the Herb Minifier package to your project using yarn. ```shell yarn add @herb-tools/minifier ``` -------------------------------- ### Install Herb Minifier with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/minifier/README.md Use this command to add the Herb Minifier package to your project using pnpm. ```shell pnpm add @herb-tools/minifier ``` -------------------------------- ### Rendered Output Example Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/whitespace_trimming_test/test_0046_leading_whitespace_preserved_after_multiple_consecutive_trimmed_code-only_lines_b77b76e5d3abb62722fac4a695d61886.txt This is the expected output after the templating engine processes the input, showing preserved whitespace. ```html
inner output
``` -------------------------------- ### Install Herb Minifier with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/minifier/README.md Use this command to add the Herb Minifier package to your project using npm. ```shell npm add @herb-tools/minifier ``` -------------------------------- ### Initialize Herb Formatter Configuration Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/formatter/README.md Initialize the Herb Formatter configuration by creating a .herb.yml file in your project root. ```shell npx herb-format --init ``` ```shell pnpm herb-format --init ``` ```shell yarn herb-format --init ``` ```shell bunx herb-format --init ``` -------------------------------- ### Install Herb Gem Source: https://github.com/marcoroth/herb/blob/main/README.md Install the Herb gem using RubyGems. This is the primary method for Ruby integration. ```sh gem install herb ``` -------------------------------- ### Valid ARIA Attributes Example Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-aria-attribute-must-be-valid.md Examples of correctly used ARIA attributes that are recognized by assistive technologies. ```html
Toggle
Title ``` -------------------------------- ### Import and use Herb in browser (async/await) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Import the Herb object for browser usage and load it asynchronously. Then, parse content. ```javascript import { Herb } from "@herb-tools/browser" await Herb.load() Herb.parse("content") ``` -------------------------------- ### Install Herb Linter as Dev Dependency with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Add the Herb Linter as a development dependency to your project using pnpm. ```shell pnpm add -D @herb-tools/linter ``` -------------------------------- ### Build and Run C Tests Source: https://github.com/marcoroth/herb/blob/main/CONTRIBUTING.md Builds the C test suite and creates the run_herb_tests executable to run the C tests. ```bash make test && ./run_herb_tests ``` -------------------------------- ### Install Herb Linter as Dev Dependency with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Add the Herb Linter as a development dependency to your project using npm. ```shell npm add -D @herb-tools/linter ``` -------------------------------- ### Install @herb-tools/dev-tools with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/dev-tools/README.md Install the herb-tools/dev-tools package using yarn. This package is used for visual debugging in HTML+ERB templates. ```bash yarn add @herb-tools/dev-tools ``` -------------------------------- ### Install @herb-tools/dev-tools with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/dev-tools/README.md Install the herb-tools/dev-tools package using npm. This package is used for visual debugging in HTML+ERB templates. ```bash npm install @herb-tools/dev-tools ``` -------------------------------- ### Good `alt` text example Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/a11y-no-redundant-image-alt.md Provides an example of an `` tag with descriptive `alt` text that does not include redundant terms. ```erb A sunset over the ocean ``` -------------------------------- ### Herb Formatter Help and Version Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/formatter/README.md Display help information or the version of the Herb Formatter. ```bash # Show help herb-format --help # Show version information herb-format --version ``` -------------------------------- ### Herb Usage (Browser and Node.js) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/reference.md Demonstrates how to import and use the Herb library in both browser and Node.js environments. It shows the basic steps of loading the library and parsing content. ```APIDOC ## Herb Usage (Browser and Node.js) ### Description The `Herb` object can be imported from either `@herb-tools/browser` or `@herb-tools/node`. The API remains consistent across both packages. ### Request Example ```js // Browser import { Herb } from "@herb-tools/browser" await Herb.load() Herb.parse("content") // Node.js import { Herb } from "@herb-tools/node" await Herb.load() Heb.parse("content") ``` ### Further Information Learn more on [how to install and load the NPM packages](/bindings/javascript/#installation). ``` -------------------------------- ### Left Trim at Start of File Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/whitespace_trimming_test/test_0014_left_trim_at_start_of_file_688979d30ffb1ebd7ad117f92729aa2c.txt Demonstrates left trimming at the beginning of a template file. Ensure the template syntax is correctly applied for trimming to take effect. ```Ruby Engine::WhitespaceTrimmingTest#test_0014_left trim at start of file input: "{source: \"<%- if true %>\\nContent\\n<%- end %>\", locals: {}, options: {}}" ``` -------------------------------- ### Configure ALE for Herb (Generic LSP) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/vim.md Use ALE's generic LSP support for a simpler setup with the Herb language server. This involves registering the LSP server with ALE. ```vim let g:ale_linters = { \ 'eruby': ['ale_lsp'], \ 'erb': ['ale_lsp'], \ } augroup AleHerbLSP autocmd! autocmd User ALEWantResults call ale#lsp#RegisterLSP('eruby', { \ 'name': 'herb-language-server', \ 'executable': 'herb-language-server', \ 'command': '%e --stdio', \ 'project_root': {buffer -> ale#path#FindNearestDirectory(buffer, '.git')}, \ }) augroup END ``` -------------------------------- ### Install Herb Formatter as a Dev Dependency Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/formatter/README.md Install the Herb Formatter as a development dependency in your project using npm, pnpm, yarn, or bun. ```shell npm add -D @herb-tools/formatter ``` ```shell pnpm add -D @herb-tools/formatter ``` ```shell yarn add -D @herb-tools/formatter ``` ```shell bun add -D @herb-tools/formatter ``` -------------------------------- ### Install Herb VS Code Extension Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/vscode.md Install the Herb extension from the VS Code Marketplace to enable code generation and analysis features. ```bash code --install-extension herb.herb-vscode ``` -------------------------------- ### Inspect General Configuration with `herb config` Source: https://github.com/marcoroth/herb/blob/main/docs/docs/configuration.md Use the `bundle exec herb config` command to view the overall resolved configuration, including project root, config file path, and all include/exclude patterns. ```bash bundle exec herb config ``` -------------------------------- ### Invalid ARIA Attributes Example Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-aria-attribute-must-be-valid.md Examples of incorrectly used ARIA attributes, including typos and unsupported attributes, which will be ignored by assistive technologies. ```html
Toggle
Title ``` -------------------------------- ### Build Herb Rust Bindings Source: https://github.com/marcoroth/herb/blob/main/rust/README.md Use these commands to build the debug or release binary, or to generate templates and build. ```bash make build # Build debug binary ``` ```bash make release # Build release binary ``` ```bash make all # Generate templates and build ``` -------------------------------- ### Ruby Heredoc Compilation Example Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/engine_test/test_0021_heredoc_with_dash_syntax_in_code_tag_compiles_to_valid_Ruby_61fc267bae73b15dae254d0d5f9fbe0e.txt Shows a Ruby heredoc syntax within a code tag that compiles to valid Ruby. This example is part of a test case for heredoc compilation. ```ruby {source: "<%\n text = <<-TEXT\n Hello, world!\n TEXT\n%>\n", options: {}} ``` -------------------------------- ### Run Language Server CLI tool from preview release Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Execute the Herb language server CLI tool directly from a preview release. Replace {commit} with the commit SHA or branch name. ```shell npx https://pkg.pr.new/@herb-tools/language-server@{commit} --stdio ``` -------------------------------- ### Run Formatter CLI tool from preview release Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Execute the Herb formatter CLI tool directly from a preview release. Replace {commit} with the commit SHA or branch name. ```shell npx https://pkg.pr.new/@herb-tools/formatter@{commit} template.html.erb ``` -------------------------------- ### Invalid Headings (Bad Examples) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-no-empty-headings.md Examples of headings that are empty or contain inaccessible text. These include empty h1-h6 tags, empty elements with the heading role, and headings with only inaccessible content. ```erb

``` ```erb

``` ```erb

``` ```erb

``` ```erb
``` ```erb
``` ```erb
``` ```erb

``` -------------------------------- ### Left Whitespace Trimming Example Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/whitespace_trimming_test/test_0004_left_trim_with_whitespace_on_previous_line_23e63662b4ba8bb3fb5a5a1bb1d53b9e.txt This example shows how the templating engine trims whitespace from the left side of the template content. It includes the source template string with embedded logic and the expected output. ```text source: "before\n <%- if true %>\nafter\n <%- end %>\nfinal", locals: {}, options: {} ``` -------------------------------- ### Unnecessary herb:disable comment detection (Bad Examples) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/herb-disable-comment-unnecessary.md These examples show instances where herb:disable comments are unnecessary because they do not suppress any active linter offenses on the line. These should be removed to clean up the codebase. ```erb
test
<%# herb:disable html-tag-name-lowercase %> ``` ```erb
content
<%# herb:disable html-tag-name-lowercase, html-attribute-double-quotes %> ``` ```erb
content
<%# herb:disable all %> ``` ```erb
content
<%# herb:disable html-tag-name-lowercase, html-attribute-double-quotes, html-no-empty-headings %> ``` ```erb
test
<%# herb:disableall %> ``` -------------------------------- ### Good Example: Descriptive Link Text for Action Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/a11y-avoid-generic-link-text.md When creating links for specific actions, ensure the text describes the action clearly. This improves usability for all users. ```erb Create a new repository ``` -------------------------------- ### Bad ERB Template Example with Trailing Whitespace Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/erb-no-trailing-whitespace.md These examples demonstrate ERB code with trailing whitespace, which violates the rule. '·' represents a trailing space, and '→' represents a trailing tab. ```erb
···

Hello

``` ```erb <%= content %>· ``` ```erb Hello→→ World··· ``` -------------------------------- ### Run Herb Commands Source: https://github.com/marcoroth/herb/blob/main/CONTRIBUTING.md Demonstrates the usage of the herb executable and its available commands for interacting with ERB files. ```bash ./herb lex examples/simple_erb.html.erb ``` -------------------------------- ### Build Herb Java Bindings from Source Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/java/index.md Clone the Herb repository and build the Java bindings using make commands. This process generates the native library required for JNI integration. ```shell git clone https://github.com/marcoroth/herb cd herb/java make templates make jni make java ``` -------------------------------- ### Import and use Herb in browser (Promise) Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/javascript/index.md Import the Herb object for browser usage and load it using Promises. Then, parse content. ```javascript import { Herb } from "@herb-tools/browser" Herb.load().then(() => { Herb.parse("content") }) ``` -------------------------------- ### Regexp with captures example Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/parser/text_content_test/test_0035_backslash-prefixed_text_-_issue_633_fd1ab6af93689cddc537bac4cbdaefde.txt This example shows a regular expression that must consume the entire string, including the use of \A and \z anchors and escaped characters like \?. It is presented within an HTML tag. ```regex \Ahttps?://github.com/+([^/]+).*\z ``` -------------------------------- ### Herb::Engine Usage with Options Source: https://github.com/marcoroth/herb/blob/main/docs/docs/projects/engine.md Initialize Herb::Engine with a source string and configuration options like filename and escape behavior. ```ruby engine = Herb::Engine.new(source, filename: "app/views/users/show.html.erb", escape: true, ) ``` -------------------------------- ### ERB Whitespace Trimming Example Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/whitespace_trimming_test/test_0025_output_tag_with_-%gt_followed_by_indented_control_tag_trims_whitespace_6e7bb5978f1744ca1f9e61ff9dabef21.txt This example shows how ERB trims whitespace after a tag ending with "-%>" and before an indented control tag. It processes a string with embedded ERB tags and demonstrates the resulting output. ```erb {source: "A<%= -%>\n <% if true %>\nB\n<% end %>", options: {}} ``` ```ruby _buf = ::String.new; _buf << 'A'.freeze; _buf << ().to_s; if true _buf << 'B\n'.freeze; end _buf.to_s ``` -------------------------------- ### Run stimulus-lint Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/stimulus-lint/README.md Execute stimulus-lint from the command line using npx. ```bash npx stimulus-lint ``` -------------------------------- ### Valid Headings (Good Examples) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-no-empty-headings.md Examples of headings with accessible text content. This includes standard headings with text, headings with nested elements containing text, and elements with ARIA roles that convey heading information. ```erb

Heading Content

``` ```erb

Text

``` ```erb
Heading Content
``` ```erb

Heading Content

``` ```erb

Heading Content

``` -------------------------------- ### Herb Language Server Usage Options Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/language-server/README.md Displays the available command-line options for running the Herb Language Server. ```text Usage: herb-language-server [options] Options: --stdio use stdio --node-ipc use node-ipc --socket= use socket ``` -------------------------------- ### Invalid HTML5 Tags (Bad Examples) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-no-self-closing.md These examples show the incorrect self-closing syntax for HTML elements, which is an XHTML artifact and should be avoided in HTML5. This syntax can lead to parse errors for non-void elements and is unnecessary for void elements. ```html
Logo

``` -------------------------------- ### Herb Language Server Options Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors.md Lists the available command-line options for the Herb Language Server. Use --stdio, --node-ipc, or --socket for communication. ```bash Usage: herb-language-server [options] Options: --stdio use stdio --node-ipc use node-ipc --socket= use socket ``` -------------------------------- ### Unnecessary herb:disable comment detection (Good Examples) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/herb-disable-comment-unnecessary.md These examples demonstrate correct usage of herb:disable comments where they are necessary to suppress specific linter offenses. Ensure comments align with actual rule violations. ```erb
test
<%# herb:disable html-tag-name-lowercase %> ``` ```erb
content
<%# herb:disable html-tag-name-lowercase, html-attribute-double-quotes %> ``` ```erb
content
<%# herb:disable all %> ``` -------------------------------- ### Use Herb Linter Preview Release Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Run the linter from a specific commit or branch using pkg.pr.new for preview releases. ```bash npx https://pkg.pr.new/@herb-tools/linter@{commit} template.html.erb ``` -------------------------------- ### Invalid `
` without `` (ERB) Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-details-has-summary.md Shows incorrect usage of `
` elements. The first example lacks a `` tag entirely. The second example nests the `` within a `
`, which is not a direct child and will not function as intended. ```erb
I don't have a summary tag!
``` ```erb
Expand me!
The summary tag needs to be a direct child of the details tag.
``` -------------------------------- ### Bad Examples of Tabindex Usage Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/html-no-positive-tab-index.md Illustrates incorrect usage of positive `tabindex` values, which can lead to confusing and unpredictable navigation for keyboard users. These examples should be refactored to use `tabindex="0"`, `tabindex="-1"`, or no `tabindex` attribute at all. ```erb ``` -------------------------------- ### Bad Example: Generic Link Text 'Read more' Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/docs/rules/a11y-avoid-generic-link-text.md The link text 'Read more' is too generic and lacks context when read by a screen reader. Prefer text that specifies what content will be revealed. ```erb Read more ``` -------------------------------- ### ERB Loop Validation Error Example Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/validation_deduplication_test/test_0001_validation_errors_in_ERB_loops_generate_single_template_per_location_527dd13a0a4ec520816dc6bb5f4c7279.txt This example shows an ERB template that uses a loop to generate HTML elements. A validation error occurs because an ERB output tag is used within an attribute, which is disallowed. The output includes a detailed template for the validation error itself. ```erb _buf = ::String.new; 10.times do |i| _buf << '
'.freeze; end; _buf << (' '.html_safe).to_s; _buf.to_s ``` -------------------------------- ### Manual Image Tag String Construction Source: https://github.com/marcoroth/herb/blob/main/test/snapshots/engine/action_view/image_tag_test/test_0003_image_tag_with_multiple_attributes_9f911faa304af1e0e96ddf8be815f191.txt This demonstrates the manual construction of an image tag string, including attribute handling. It shows how the image path is processed. ```ruby _buf = ::String.new; _buf << 'Photo'.freeze; _buf.to_s ``` -------------------------------- ### Install @herb-tools/rewriter with yarn Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/rewriter/README.md Use yarn to add the @herb-tools/rewriter package to your project dependencies. ```shell yarn add @herb-tools/rewriter ``` -------------------------------- ### Run Herb Lint Script with bun Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/linter/README.md Execute the configured Herb Linter script using bun. ```shell bun run herb:lint ``` -------------------------------- ### Install @herb-tools/rewriter with pnpm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/rewriter/README.md Use pnpm to add the @herb-tools/rewriter package to your project dependencies. ```shell pnpm add @herb-tools/rewriter ``` -------------------------------- ### Verify Herb Language Server in PATH Source: https://github.com/marcoroth/herb/blob/main/docs/docs/integrations/editors/vim.md Check if the 'herb-language-server' executable is available in your system's PATH. ```bash which herb-language-server ``` -------------------------------- ### Install @herb-tools/rewriter with npm Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/rewriter/README.md Use npm to add the @herb-tools/rewriter package to your project dependencies. ```shell npm add @herb-tools/rewriter ``` -------------------------------- ### Clean Build Artifacts Source: https://github.com/marcoroth/herb/blob/main/CONTRIBUTING.md Removes compiled executables, object files, and the prism installation. ```bash make clean ``` -------------------------------- ### Creating a StringRewriter Source: https://github.com/marcoroth/herb/blob/main/javascript/packages/rewriter/README.md Example of creating a custom StringRewriter that ensures a file ends with a newline. ```APIDOC ## Creating a StringRewriter StringRewriters receive and modify strings: ```javascript [.herb/rewriters/add-newline.mjs] import { StringRewriter } from "@herb-tools/rewriter" export default class AddTrailingNewline extends StringRewriter { get name() { return "add-trailing-newline" } get description() { return "Ensures file ends with a newline" } async initialize(context) { // Optional setup } rewrite(content, context) { return content.endsWith("\n") ? content : content + "\n" } } ``` ``` -------------------------------- ### Import Herb Crate Source: https://github.com/marcoroth/herb/blob/main/docs/docs/bindings/rust/index.md Import the necessary functions from the herb crate to start parsing. ```rust use herb::{parse, lex}; ```