@ecency/render-helper 2.2.9 → 2.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/consts/white-list.const.js +1 -0
- package/lib/consts/white-list.const.js.map +1 -1
- package/lib/methods/markdown-to-html.method.js +13 -8
- package/lib/methods/markdown-to-html.method.js.map +1 -1
- package/lib/render-helper.js +1 -1
- package/package.json +1 -1
- package/src/consts/white-list.const.ts +1 -0
- package/src/methods/markdown-to-html.method.ts +14 -8
package/package.json
CHANGED
|
@@ -49,16 +49,22 @@ export function markdownToHTML(input: string, forApp: boolean, webp: boolean): s
|
|
|
49
49
|
//encrypt entities
|
|
50
50
|
const entities = input.match(/&(.*?);/g);
|
|
51
51
|
const encEntities:string[] = [];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
|
|
53
|
+
try{
|
|
54
|
+
if(entities && forApp){
|
|
55
|
+
entities.forEach((entity)=>{
|
|
56
|
+
const CryptoJS = require("react-native-crypto-js");
|
|
57
|
+
const encData = CryptoJS.AES.encrypt(entity, 'key').toString();
|
|
58
|
+
const encyptedEntity = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encData));
|
|
59
|
+
encEntities.push(encyptedEntity);
|
|
60
|
+
input = input.replace(entity, encyptedEntity);
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
} catch (err){
|
|
64
|
+
console.log("failed to encrypt entities, ignore if not using mobile");
|
|
60
65
|
}
|
|
61
66
|
|
|
67
|
+
|
|
62
68
|
try {
|
|
63
69
|
output = md.render(input)
|
|
64
70
|
const doc = DOMParser.parseFromString(`<body id="root">${output}</body>`, 'text/html')
|