Gathering detailed insights and metrics for @allegro/convert-description
Gathering detailed insights and metrics for @allegro/convert-description
Gathering detailed insights and metrics for @allegro/convert-description
Gathering detailed insights and metrics for @allegro/convert-description
A JavaScript library to convert HTML-rich offer & product descriptions into a format accepted by Allegro Rest API.
npm install @allegro/convert-description
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Build dedicated bundles
Updated on Jul 30, 2025
Use DomPurify to protect from XSS
Updated on Jul 29, 2025
Preserve the emoticons
Updated on Jul 28, 2025
Fix running bin through npx
Updated on Dec 17, 2024
Move sanitize-html to devDependencies
Updated on Dec 17, 2024
Provide CLI
Updated on Dec 16, 2024
JavaScript (88.13%)
TypeScript (9.87%)
SCSS (1.79%)
HTML (0.21%)
Total Downloads
1,759
Last Day
5
Last Week
40
Last Month
210
Last Year
1,390
Apache-2.0 License
5 Stars
38 Commits
1 Forks
1 Watchers
3 Branches
6 Contributors
Updated on Jul 30, 2025
Latest Version
0.5.7
Package Id
@allegro/convert-description@0.5.7
Unpacked Size
239.36 kB
Size
48.02 kB
File Count
8
NPM Version
10.9.2
Node Version
22.17.1
Published on
Jul 30, 2025
Cumulative downloads
Total Downloads
Last Day
-61.5%
5
Compared to previous day
Last Week
-20%
40
Compared to previous week
Last Month
-48.4%
210
Compared to previous month
Last Year
276.7%
1,390
Compared to previous year
2
51
A JavaScript library to convert HTML-rich offer & product descriptions into a format accepted by Allegro Rest API.
Provide means to ease the conversion of HTML-rich offer & product descriptions into a format accepted by Allegro Rest API. As such, the library covers basic functionality. Any client-specific behavior must be provided externally. The library can facilitate that through extensibility.
The library requires DOM API, which can be provided in two ways: either implicitly
as globals by the browser environment or explicitly as the parseToDOM
function in the Node.js environment (see
Usage section).
The following requirements apply to Node.js as a runtime or build environment.
1npm i @allegro/convert-description
For the Node.js runtime environment, include jsdom.
1npm i @allegro/convert-description jsdom
JavaScript code
1import { convertDescriptionToItems } from '@allegro/convert-description'; 2 3const description = ` 4 <div> 5 <div>test content</div> 6 <img src="/test_url" /> 7 </div> 8 `; 9 10const items = convertDescriptionToItems(description); 11 12console.log(JSON.stringify(items));
Code output
1[{"type":"TEXT","content":"<p>test content</p>"},{"type":"IMAGE","url":"/test_url"}]
For the Node.js runtime environment, pass the parseToDOM
function.
1import { convertDescriptionToItems } from '@allegro/convert-description'; 2import { JSDOM } from 'jsdom'; 3 4function parseToDOM(html) { 5 return new JSDOM(html); 6} 7 8const description = ` 9 <div> 10 <div>test content</div> 11 <img src="/test_url" /> 12 </div> 13 `; 14const items = convertDescriptionToItems(description, { parseToDOM }); 15 16console.log(JSON.stringify(items));
[!CAUTION] Any option to
convertDescriptionToItems
that is not mentioned in the documentation is subject to change. If you need anything more than the listed options, ask a question by opening an issue or contribute by creating a pull request.
1$ echo "<p>Hello World</p>" | npx @allegro/convert-description 2[{"type":"TEXT","content":"<p>Hello World</p>"}]
No vulnerabilities found.