tag-balancer
v1.0.1
Published
Balance tags of html string
Downloads
221
Maintainers
Readme
tag-balancer
Balance tags of html string.
To install:
# npm
npm install tag-balancer
# bun
bun add tag-balancer
# yarn
yarn add tag-balancer
# pnpm
pnpm add tag-balancer
Example
const htmlStr = `<div>
<br></div>
<img src="/idb/files?id=vEQibqclfEKwjhM&fk=Frq9gA68GK21saU" data-id="vEQibqclfEKwjhM" data-type="drawing"
width="300" data-fk="Frq9gA68GK21saU" style="background-color: rgb(255, 255, 255);">
<br>
</div>`;
// removes the extra closing div
const outputStr = tagBalancer(htmlStr); /* <div>
<br></div>
<img src="/idb/files?id=vEQibqclfEKwjhM&fk=Frq9gA68GK21saU" data-id="vEQibqclfEKwjhM" data-type="drawing"
width="300" data-fk="Frq9gA68GK21saU" style="background-color: rgb(255, 255, 255);">
<br>
*/