trans-style-tags

[![NPM version][npm-image]][npm-url]

Usage no npm install needed!

<script type="module">
  import transStyleTags from 'https://cdn.skypack.dev/trans-style-tags';
</script>

README

trans-style-tags

NPM version

Transform inline-style of rich-text to tags, Provide for the use of AOS and IOS

Provide

  • .min.js
  • .cjs.min.js
  • .esm.min.js

Introduction

  • just support current need attrs

Prepare

...
{
    ...
    "dependencies": {
        ...
        "trans-style-tags",
        "html-to-vdom",
        ...
    }
    ...
}

Usage

import TransStyleTags from 'trans-style-tags';
const html = `
    <ul>
        <li style="font-weight: bold; font-style: italic; text-decoration: underline;">first</li>
        <li>second</li>
        <li>third</li>
    </ul>
`;
const tst = new TransStyleTags();
const newHtml = tst.parse(_html);
console.log(newHtml);
/**
<ul>
    <li><b><i><u>first</u></i></b></li>
    <li>second</li>
    <li>third</li>
</ul>
*/

Todo

  • support all style

Release

0.0.3

  • fix single-line html: forEach error

0.0.4

  • fix single-line html: forEach error
    • vTree is object