Skip to content

Commit 32003da

Browse files
committed
rename JSON transformer to HTML, get rid of JSON references
1 parent 78c6069 commit 32003da

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Install the package via npm
2525

2626
![Module API](media/resolver-api-overview.png)
2727

28-
### Parsing rich text HTML to a JSON tree
28+
### Parsing rich text HTML to an array of simplified nodes
2929

30-
The tool provides environment-aware (browser or Node.js) `parseHtml` function to transform HTML into an array of simplified JSON trees. Any valid HTML is parsed, including all attributes. Together with built-in transformation methods, this tool is a suitable option for processing HTML and rich text from external sources, to make it compatible with Kontent.ai rich text format. See dedicated [JSON transformer docs](docs/index.md) for further information.
30+
The tool provides environment-aware (browser or Node.js) `parseHtml` function to transform HTML into an array of `DomNode` trees. Any valid HTML is parsed, including all attributes. Together with built-in transformation methods, this tool is a suitable option for processing HTML and rich text from external sources, to make it compatible with Kontent.ai rich text format. See dedicated [HTML transformer docs](docs/index.md) for further information.
3131

3232
### Portable text resolution
3333

@@ -291,8 +291,7 @@ Package exports a `traversePortableText` method, which accepts an array of `Port
291291
const richTextContent =
292292
`<p>Here is an <a data-item-id="12345"><strong>internal link</strong></a> in some text.</p>`;
293293

294-
const tree = parseHtml(richTextContent);
295-
const portableText = transformToPortableText(tree);
294+
const portableText = transformToPortableText(richTextContent);
296295

297296
// your logic to modify the portable text
298297

@@ -302,7 +301,7 @@ Package exports a `traversePortableText` method, which accepts an array of `Port
302301
> [!IMPORTANT]
303302
> MAPI transformation logic expects Portable Text that had been previously created from management API rich text and performs only minimal validation. It doesn't provide implicit transformation capabilities from other formats (such as delivery API).
304303
>
305-
> If you're interested in transforming external HTML or rich text to a MAPI compatible format, see [JSON transformer docs](docs/index.md) instead.
304+
> If you're interested in transforming external HTML or rich text to a MAPI compatible format, see [HTML transformer docs](docs/index.md) instead.
306305
307306
[last-commit]: https://img.shields.io/github/last-commit/kontent-ai/rich-text-resolver-js?style=for-the-badge
308307
[contributors-shield]: https://img.shields.io/github/contributors/kontent-ai/rich-text-resolver-js?style=for-the-badge

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# JSON Transformers
1+
# HTML Transformers
22

33
This module provides an environment-aware (browser or Node.js) `parseHtml` function to convert an HTML string into an array of nodes. The resulting array can subsequently be modified by one of the provided functions and transformed back to HTML.
44

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"import": "./dist/esnext/src/parser/index.js",
2424
"require": "./dist/cjs/src/parser/index.js"
2525
},
26-
"./transformers/json": {
27-
"import": "./dist/esnext/src/transformers/json-transformer/json-transformer.js",
28-
"require": "./dist/cjs/src/transformers/json-transformer/json-transformer.js"
26+
"./transformers/html": {
27+
"import": "./dist/esnext/src/transformers/html-transformer/html-transformer.js",
28+
"require": "./dist/cjs/src/transformers/html-transformer/html-transformer.js"
2929
},
3030
"./transformers/portable-text": {
3131
"import": "./dist/esnext/src/transformers/portable-text-transformer/portable-text-transformer.js",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./html-transformer.js";

src/transformers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from "./json-transformer/index.js";
1+
export * from "./html-transformer/index.js";
22
export * from "./portable-text-transformer/index.js";
33
export * from "./transformer-models.js";

src/transformers/json-transformer/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)