@hivegpt/hiveai-angular 0.0.56 → 0.0.58
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/bundles/hivegpt-hiveai-angular.umd.js +29 -38
- package/bundles/hivegpt-hiveai-angular.umd.js.map +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js.map +1 -1
- package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +31 -34
- package/fesm2015/hivegpt-hiveai-angular.js +30 -32
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +2 -2
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1265,47 +1265,38 @@
|
|
|
1265
1265
|
}));
|
|
1266
1266
|
};
|
|
1267
1267
|
// events/${eventId}/users-connections
|
|
1268
|
+
// Simple Markdown to HTML parser
|
|
1268
1269
|
ChatDrawerComponent.prototype.simpleMarkdownParser = function (markdownContent) {
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
});
|
|
1295
|
-
});
|
|
1270
|
+
if (!markdownContent)
|
|
1271
|
+
return '';
|
|
1272
|
+
var html = markdownContent;
|
|
1273
|
+
// Convert headings
|
|
1274
|
+
html = html.replace(/^###### (.*$)/gim, '<h6>$1</h6>');
|
|
1275
|
+
html = html.replace(/^##### (.*$)/gim, '<h5>$1</h5>');
|
|
1276
|
+
html = html.replace(/^#### (.*$)/gim, '<h4>$1</h4>');
|
|
1277
|
+
html = html.replace(/^### (.*$)/gim, '<h3>$1</h3>');
|
|
1278
|
+
html = html.replace(/^## (.*$)/gim, '<h2>$1</h2>');
|
|
1279
|
+
html = html.replace(/^# (.*$)/gim, '<h1>$1</h1>');
|
|
1280
|
+
// Convert bold and italic
|
|
1281
|
+
html = html.replace(/\*\*\*(.*?)\*\*\*/gim, '<em><strong>$1</strong></em>');
|
|
1282
|
+
html = html.replace(/\*\*(.*?)\*\*/gim, '<strong>$1</strong>');
|
|
1283
|
+
html = html.replace(/\*(.*?)\*/gim, '<em>$1</em>');
|
|
1284
|
+
// Convert links
|
|
1285
|
+
html = html.replace(/\[(.*?)\]\((.*?)\)/gim, '<a href="$2">$1</a>');
|
|
1286
|
+
// Convert unordered lists
|
|
1287
|
+
html = html.replace(/^\* (.*)/gim, '<ul><li>$1</li></ul>');
|
|
1288
|
+
html = html.replace(/^\- (.*)/gim, '<ul><li>$1</li></ul>');
|
|
1289
|
+
html = html.replace(/^\+ (.*)/gim, '<ul><li>$1</li></ul>');
|
|
1290
|
+
// Convert ordered lists
|
|
1291
|
+
html = html.replace(/^\d+\. (.*)/gim, '<ol><li>$1</li></ol>');
|
|
1292
|
+
// Convert line breaks
|
|
1293
|
+
html = html.replace(/\n/gim, '<br/>');
|
|
1294
|
+
return html.trim();
|
|
1296
1295
|
};
|
|
1296
|
+
// Convert Markdown to SafeHtml
|
|
1297
1297
|
ChatDrawerComponent.prototype.handleMarkdown = function (markdownContent) {
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
return __generator(this, function (_e) {
|
|
1301
|
-
switch (_e.label) {
|
|
1302
|
-
case 0: return [4 /*yield*/, this.simpleMarkdownParser(markdownContent)];
|
|
1303
|
-
case 1:
|
|
1304
|
-
htmlContent = _e.sent();
|
|
1305
|
-
return [2 /*return*/, htmlContent];
|
|
1306
|
-
}
|
|
1307
|
-
});
|
|
1308
|
-
});
|
|
1298
|
+
var htmlContent = this.simpleMarkdownParser(markdownContent);
|
|
1299
|
+
return this.sanitizer.bypassSecurityTrustHtml(htmlContent);
|
|
1309
1300
|
};
|
|
1310
1301
|
return ChatDrawerComponent;
|
|
1311
1302
|
}());
|