# anchor-js

> A JavaScript utility for adding deep anchor links to online docs.

Latest version **5.0.0** (published 2023-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install anchor-js
pnpm add anchor-js
yarn add anchor-js
bun add anchor-js
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2023-01-18 |
| First published | 2015-01-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/anchor-js) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 25.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 892 |
| Author | Bryan Braun |
| Maintainers | bryanbraun |
| Keywords | anchor, links, urlify |

## Links

- npm: https://www.npmjs.com/package/anchor-js
- Repository: https://github.com/bryanbraun/anchorjs
- Homepage: https://www.bryanbraun.com/anchorjs/
- Issues: https://github.com/bryanbraun/anchorjs/issues
- npm.io page: https://npm.io/package/anchor-js

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 5.0.0 (latest) — 2023-01-18
- 4.3.1 — 2021-04-17
- 4.3.0 — 2020-10-22
- 4.2.2 — 2019-11-14
- 4.2.1 — 2019-11-12
- 4.2.0 — 2019-01-01
- 4.1.1 — 2018-07-02
- 4.1.0 — 2017-09-20
- 4.0.0 — 2017-06-02
- 3.2.2 — 2016-10-06
- 3.2.1 — 2016-07-18
- 3.2.0 — 2016-06-10
- 3.1.1 — 2016-04-30
- 3.1.0 — 2016-02-13
- 3.0.0 — 2016-01-24
- … 10 more at https://npm.io/package/anchor-js/versions

## README

# AnchorJS [![Build Status](https://github.com/bryanbraun/anchorjs/workflows/CI/badge.svg)](https://github.com/bryanbraun/anchorjs/actions?workflow=CI)

A JavaScript utility for adding deep anchor links ([like these](https://ux.stackexchange.com/q/36304/33248)) to existing page content. AnchorJS is lightweight, accessible, and has no dependencies.

**[See Live Examples in the Documentation](https://www.bryanbraun.com/anchorjs/#examples).**

![Anchoring links](docs/img/anchoring-links.png)

## Installation

Download AnchorJS using npm,

```bash
npm install anchor-js
```

...and then include it into your project:

```js
import AnchorJS from 'anchor-js';

const anchors = new AnchorJS();
anchors.add();
```

You could also include it in your webpage via a CDN like [CDNJS](https://cdnjs.com/libraries/anchor-js) or [jsDelivr](https://www.jsdelivr.com/package/npm/anchor-js).

```html
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
<script>
   anchors.add();
</script>
```

## Usage

See **[the Documentation](https://www.bryanbraun.com/anchorjs/#basic-usage)** for detailed instructions.

## Compatibility

Currently Supports: IE9+ and modern browsers

## Contributing [![devDependency Status](https://img.shields.io/david/dev/bryanbraun/anchorjs.svg?style=flat)](https://david-dm.org/bryanbraun/anchorjs?type=dev)

To contribute:

1. Fork/Clone the repo.
2. Make your changes.
3. Write tests as needed.
4. Run tests locally to confirm everything is working:
   - Install test modules: Run `npm ci`
   - Run all tests: `npm test`
5. Minify and prepare the code: `npm run build`
6. Submit a Pull Request.

## License

Licensed with the [MIT License](/LICENSE).

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