HTML Typer is a lightweight TypeScript package that brings your HTML content to life with a smooth typewriter effect. It auto-sanitizes input using DOMPurify, supports nested elements.
- Typewriter Animation: Gradually renders text for a captivating effect.
- Auto-Sanitization: Uses DOMPurify to secure your content against XSS.
- Nested HTML Support: Processes complex HTML structures.
- TypeScript-Ready: Fully typed with generated declaration files.
Install HTML Typer and its dependencies (only TypeScript and DomPurify) using npm:
npm install @goodpie/html-typerFor React, install the following:
npm install @goodpie/html-typer-reactimport{animateHtmlRendering}from'html-typer';constcontainer=document.getElementById('myContainer');consthtmlContent=`<p>Hello, <strong>World!</strong></p>`;animateHtmlRendering(container,htmlContent,50).then(()=>{console.log('Animation complete!');});This project uses Jest. To run tests:
npm run testThis project is licensed under the Mozilla Public License 2.0