# @adobe/htlengine

> Javascript Based HTL (Sightly) parser

Latest version **6.4.46** (published 2026-08-13) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @adobe/htlengine
pnpm add @adobe/htlengine
yarn add @adobe/htlengine
bun add @adobe/htlengine
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 6.4.46 |
| Published | 2026-08-13 |
| First published | 2018-06-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 14 |
| Unpacked size | 352.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 49 |
| Maintainers | marbec, tripod, garthdb, lazd, adobe-admin, patrickfulton, trieloff, krisnye, dcpfsdk, natebaldwin, devongovett, aspro83, symanovi, dpfister, stefan-guggisberg, rofe, kptdobe, adobehalls, fullcolorcoder, djaeggi, dylandepass, mhaack, amol-anand, stopp-adobe, namarora, doten, duh_schmidt, asthabh23, zdahbi, tuicu, fmeschbe, maxakuru, vhosu |

## Links

- npm: https://www.npmjs.com/package/@adobe/htlengine
- Repository: https://github.com/adobe/htlengine
- Homepage: https://github.com/adobe/htlengine#readme
- Issues: https://github.com/adobe/htlengine/issues
- npm.io page: https://npm.io/package/@adobe/htlengine

## Dependencies (14)

- [he](https://npm.io/package/he.md) 1.2.0
- [moo](https://npm.io/package/moo.md) 0.5.2
- [jsdom](https://npm.io/package/jsdom.md) 30.0.1
- [moment](https://npm.io/package/moment.md) 2.30.1
- [nearley](https://npm.io/package/nearley.md) 2.20.1
- [numeral](https://npm.io/package/numeral.md) 2.0.6
- [unified](https://npm.io/package/unified.md) 9.2.2
- [xregexp](https://npm.io/package/xregexp.md) 5.1.2
- [fs-extra](https://npm.io/package/fs-extra.md) 11.3.0
- [dompurify](https://npm.io/package/dompurify.md) 3.4.13
- [node-esapi](https://npm.io/package/node-esapi.md) 0.0.1
- [source-map](https://npm.io/package/source-map.md) 0.7.4
- [rehype-parse](https://npm.io/package/rehype-parse.md) 7.0.1
- [unist-util-inspect](https://npm.io/package/unist-util-inspect.md) 6.0.1

## Recent versions

- 6.4.46 (latest) — 2026-08-13
- 2.1.2-pre.2 (next) — 2019-04-02
- 6.4.45 — 2026-08-09
- 6.4.44 — 2026-07-25
- 6.4.43 — 2026-06-19
- 6.4.42 — 2026-06-17
- 6.4.41 — 2026-06-17
- 6.4.40 — 2026-05-22
- 6.4.39 — 2026-04-02
- 6.4.38 — 2026-03-06
- 6.4.37 — 2026-03-05
- 6.4.36 — 2026-03-05
- 6.4.35 — 2025-09-15
- 6.4.34 — 2025-05-24
- 6.4.33 — 2025-04-14
- … 215 more at https://npm.io/package/@adobe/htlengine/versions

## README

# HTL Engine for Javascript

This engine can parse [HTL](https://github.com/Adobe-Marketing-Cloud/htl-spec) scripts and builds a command stream. The command stream can either be intepreted or used to generate code. This project provides a Javascript (ES6) generator and runtime which allows to execute the scripts and use-classes.

## Status

[![codecov](https://img.shields.io/codecov/c/github/adobe/htlengine.svg)](https://codecov.io/gh/adobe/htlengine)
[![CircleCI](https://img.shields.io/circleci/project/github/adobe/htlengine.svg)](https://circleci.com/gh/adobe/htlengine)
[![GitHub license](https://img.shields.io/github/license/adobe/htlengine.svg)](https://github.com/adobe/htlengine/blob/main/LICENSE.txt)
[![GitHub issues](https://img.shields.io/github/issues/adobe/htlengine.svg)](https://github.com/adobe/htlengine/issues)

[![LGTM Code Quality Grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/htlengine.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/adobe/htlengine)

## Install

```bash
npm install @adobe/htlengine
```

## Build

```bash
npm install
```

## run

currently not very cool. just passes the given file into the HTML parser and outputs the tree again.

```bash
node src/cli.js test/simple2.html
```

## Webpack

Compile the HTL templates wth webpack using the [htl-loader](https://github.com/backflip/htl-loader)

## API

You can also use the API directly:

```javascript
const { Compiler } = require('@adobe/htlengine');

const compiler = new Compiler()
      .withDirectory('')
      .includeRuntime(true)
      .withRuntimeGlobalName('it');

const js = await compiler.compileToString(code);
// the result can be saved as a file or eval'd
```

## examples

- see [HAST Example](./examples/hast/index.js) that uses a [hast](https://github.com/syntax-tree/hast) tree as resource document.
- see [JSDOM Example](./examples/jsdom/index.js) that uses a [jsdom](https://github.com/jsdom/jsdom) document as resource.

## test

The tests are more comprehensive. They validate if the the HTL expressions are parsed and re-created using the generated parse tree.

```bash
npm test
```

## rebuild generated [nearley](https://nearley.js.org/) grammar

```bash
npm run build
```

---
_Source: https://npm.io/package/@adobe/htlengine · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
