html-variable-converter
v1.0.1
Published
Convert HTML text, image, link, and SVG elements into variable placeholders with a mapping.
Downloads
26
Maintainers
Readme
🧩 html-variable-converter
Convert HTML text, image, link, and SVG elements into variable placeholders with mapping.
🚀 Features
- Replaces text nodes with
$Text#variables - Converts
<img src>→$Image# - Converts
<a href>→$Link# - Converts full
<svg>blocks →$SVG# - Works recursively for text before/after tags
- Built with TypeScript and ESM
📦 Install
npm install html-variable-converter🧠 Usage
import { convertHtmlToVariableTemplate } from 'html-variable-converter';
const html = '<p>Visit <a href="https://example.com">Example</a> now!</p>';
const result = convertHtmlToVariableTemplate(html);
console.log(result.htmlWithVariables);
console.log(result.variableMap);👨💻 Author
Thelaprolu Sri Harinadh Babu
📧 [email protected]
💼 Uniquode Application Specialists LLP
🌐 https://uniquode.in
