@hivegpt/hiveai-angular 0.0.61 → 0.0.63
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 +16 -35
- 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 +17 -36
- package/fesm2015/hivegpt-hiveai-angular.js +16 -35
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +1 -2
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1265,43 +1265,24 @@
|
|
|
1265
1265
|
}));
|
|
1266
1266
|
};
|
|
1267
1267
|
// events/${eventId}/users-connections
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
if (!markdownContent)
|
|
1268
|
+
ChatDrawerComponent.prototype.handleMarkdown = function (markdown) {
|
|
1269
|
+
if (!markdown || !(markdown.length > 0)) {
|
|
1271
1270
|
return '';
|
|
1272
|
-
|
|
1273
|
-
// Convert
|
|
1274
|
-
html =
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
html = html.replace(/^(### (.*))$/gim, '<h3>$2</h3>');
|
|
1278
|
-
html = html.replace(/^(## (.*))$/gim, '<h2>$2</h2>');
|
|
1279
|
-
html = html.replace(/^(# (.*))$/gim, '<h1>$2</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" target="_blank" rel="noopener noreferrer">$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
|
-
// Combine multiple list items in one list element
|
|
1293
|
-
html = html.replace(/(<ul><li>.*<\/li><\/ul>)/gim, function (match) {
|
|
1294
|
-
return "<ul>" + match.replace(/<\/li><li>/gim, '</li><li>') + "</ul>";
|
|
1295
|
-
});
|
|
1296
|
-
html = html.replace(/(<ol><li>.*<\/li><\/ol>)/gim, function (match) {
|
|
1297
|
-
return "<ol>" + match.replace(/<\/li><li>/gim, '</li><li>') + "</ol>";
|
|
1271
|
+
}
|
|
1272
|
+
// Convert Markdown headers to HTML headers
|
|
1273
|
+
var html = markdown.replace(/^(#{1,6})\s+(.*)$/gm, function (match, hashes, text) {
|
|
1274
|
+
var level = hashes.length;
|
|
1275
|
+
return "<h" + level + ">" + text + "</h" + level + ">";
|
|
1298
1276
|
});
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1277
|
+
// Convert Markdown links to HTML links
|
|
1278
|
+
html = html.replace(/\[([^\]]+)]\(([^)]+)\)/g, '<a href="$2" target="_blank">$1</a>');
|
|
1279
|
+
// Convert Markdown bold to HTML strong
|
|
1280
|
+
html = html.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
|
|
1281
|
+
// Convert new lines to <br> tags
|
|
1282
|
+
html = html.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
|
1283
|
+
// Optional: Sanitize the HTML to prevent XSS
|
|
1284
|
+
var sanitizedHtml = this.sanitizeHtml(html);
|
|
1285
|
+
return sanitizedHtml;
|
|
1305
1286
|
};
|
|
1306
1287
|
return ChatDrawerComponent;
|
|
1307
1288
|
}());
|