anchor-js
v5.0.0
Published
A JavaScript utility for adding deep anchor links to online docs.
Downloads
21,289
Readme
AnchorJS
A JavaScript utility for adding deep anchor links (like these) to existing page content. AnchorJS is lightweight, accessible, and has no dependencies.
See Live Examples in the Documentation.
Installation
Download AnchorJS using npm,
npm install anchor-js
...and then include it into your project:
import AnchorJS from 'anchor-js';
const anchors = new AnchorJS();
anchors.add();
You could also include it in your webpage via a CDN like CDNJS or jsDelivr.
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
<script>
anchors.add();
</script>
Usage
See the Documentation for detailed instructions.
Compatibility
Currently Supports: IE9+ and modern browsers
Contributing
To contribute:
- Fork/Clone the repo.
- Make your changes.
- Write tests as needed.
- Run tests locally to confirm everything is working:
- Install test modules: Run
npm ci
- Run all tests:
npm test
- Install test modules: Run
- Minify and prepare the code:
npm run build
- Submit a Pull Request.
License
Licensed with the MIT License.