You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32
Original file line number
Diff line number
Diff line change
@@ -161,6 +161,7 @@ On the other hand, the `customTextWrapper` parser function provides the followin
161
161
-`child`: The HTML string that specifies the child element
162
162
-`value`: The value passed against the child element
163
163
164
+
164
165
You can use the following customized JSON RTE Serializer code to convert your JSON RTE field data into HTML format.
165
166
166
167
```javascript
@@ -356,12 +357,43 @@ The resulting JSON-formatted data will look as follows:
356
357
357
358
## Automatic Conversion
358
359
360
+
> **_Note_**: `src` url's provided for social-embeds and embed items will by default be <ahref="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI">uri encoded</a>.
361
+
359
362
By default, the JSON Rich Text Editor field supports limited HTML tags within the editor. Due to this, the JSON RTE Serializer tool is not able to recognize each and every standard HTML tag.
360
363
361
364
To help the JSON RTE Serializer recognize and process additional tags that are commonly used across HTML, you can use the automatic conversion option. When using this option, you need to pass the `allowNonStandardTags: true` parameter within the `jsonToHtml` or `htmlToJson` method to manipulate the working of the JSON RTE Serializer package as per your requirements. When you pass this parameter, it customizes your JSON RTE Serializer code to allow the support for all standard HTML-recognized tags or element types in the JSON Rich Text Editor field.
362
365
363
366
### Convert JSON to HTML
364
367
368
+
#### HTML Attribute Name and Value Sanitization
369
+
370
+
371
+
This project ensures that HTML attributes are properly validated and sanitized according to the W3C HTML specification. It validates attribute names based on the HTML standards and sanitizes attribute values to ensure correct rendering and security, particularly against cross-site scripting (XSS) vulnerabilities.
372
+
373
+
#### Attribute Name Guidelines
374
+
375
+
All HTML attribute names must conform to the [W3C HTML specification](https://www.w3.org/TR/2012/WD-html-markup-20120329/syntax.html#attribute-name). These guidelines specify the following rules:
376
+
377
+
-**Printable ASCII Characters:** Attribute names must consist only of printable ASCII characters.
378
+
-**Case-Insensitive:** Attribute names are case-insensitive, but lowercase is preferred for consistency.
379
+
-**No Special Characters:** Attribute names cannot contain spaces or special characters such as `=`, `>`, `<`, `"`, etc.
380
+
-**Allowed Attributes:** Attributes such as `xmlns`, `aria-*`, `data-*`, and others defined by HTML5 standards are allowed and must follow specific rules.
381
+
382
+
##### Important Note:
383
+
If an attribute name does not conform to these rules, the attribute will be **dropped** from the element.
384
+
385
+
#### Attribute Value Guidelines
386
+
387
+
The values of HTML attributes are sanitized to ensure proper rendering and to mitigate security risks, such as Cross-Site Scripting (XSS). This sanitization process involves replacing HTML entities (like `<`, `>`, `&`, etc.) with their corresponding characters and removing any invalid or unsafe characters.
388
+
389
+
Here are some common HTML entities and their replacements:
390
+
391
+
-`<` → `<`
392
+
-`>` → `>`
393
+
-`&` → `&`
394
+
395
+
396
+
<hr>
365
397
You can pass the `allowNonStandardTags: true` parameter within the `jsonToHtml` method to allow the JSON RTE Serializer tool to recognize standard HTML tags or element types and convert them into JSON format.
366
398
367
399
You can use the following customized JSON RTE Serializer code to convert your JSON RTE field data into HTML format.
0 commit comments