For AI agents: the complete documentation index is available at /annealer/llms.txt, the full documentation bundle is available at /annealer/llms-full.txt, and this page is available as Markdown at /annealer/guide/start/getting-started.md.
  • English
  • Getting started

    annealer has three entry points that share the same Rust core:

    • anyl: the command-line tool.
    • annealer (npm): a JavaScript API backed by WebAssembly.
    • annealer (Rust crate): the pure format() function.

    CLI

    Build the CLI from the repository (the npm package and crate are not published yet):

    cargo install --path crates/annealer

    Then format files:

    anyl src/App.vue                 # print the result
    anyl --write src/**/*.vue        # format in place
    anyl --check index.html          # exit 1 if a file would change
    anyl --profile my-profile.yaml page.html

    Supported inputs: .html, .htm, .vue, .css, .scss, .sass, .less. The language is detected from the extension, and each language uses its matching built-in profile unless --profile is given. See CLI for all options.

    JavaScript

    import { format } from 'annealer';
    
    format('<a title="Home" href="/" id="home">Home</a>');
    // => '<a id="home" title="Home" href="/">Home</a>'
    
    format(source, { language: 'vue' });
    format(source, { language: 'html', profile: yamlText });

    format() is synchronous. The WebAssembly binary is embedded in the package, so no loader or bundler setup is needed. See JavaScript API.

    Example

    Input:

    <nav aria-label="Main" class="nav" id="nav">
      <a href="/docs" class="nav__link" aria-current="page">Docs</a>
    </nav>
    <input
      required
      placeholder="[email protected]"
      name="email"
      type="email"
      id="email"
      class="form__input"
      aria-describedby="email-help"
    />

    Output with the html profile:

    <nav id="nav" class="nav" aria-label="Main">
      <a class="nav__link" href="/docs" aria-current="page">Docs</a>
    </nav>
    <input
      id="email"
      class="form__input"
      placeholder="[email protected]"
      type="email"
      name="email"
      required
      aria-describedby="email-help"
    />
    • id and class come first, then supplementary (placeholder), semantic (type), key-value (name) and state (required) attributes, then ARIA.
    • The multiline tag gets one attribute per line, and the closing bracket goes on its own line.
    • The void element <input> becomes <input />.

    Profiles

    Two profiles are built in:

    ProfileUsed forSummary
    html.html, .css, .scss, .sass, .lessSemantic order for plain HTML.
    vue.vuevue/attributes-order tiers plus annealer's sub-ordering.

    To customize, start from a built-in profile (builtinProfile('vue') in JavaScript, or crates/annealer/profiles/*.yaml) and pass your YAML with --profile or the profile option. See Profile reference.