@hivegpt/hiveai-angular 0.0.51 → 0.0.52

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.
@@ -1265,38 +1265,35 @@
1265
1265
  }));
1266
1266
  };
1267
1267
  // events/${eventId}/users-connections
1268
- ChatDrawerComponent.prototype.simpleMarkdownParser = function (markdown) {
1268
+ ChatDrawerComponent.prototype.simpleMarkdownParser = function (markdownContent) {
1269
+ // Ensure markdownContent is a string
1270
+ var markdown = String(markdownContent);
1269
1271
  // Convert headings
1270
- markdown = markdown.replace(/^###### (.*$)/gim, '<h6>$1</h6>');
1271
- markdown = markdown.replace(/^##### (.*$)/gim, '<h5>$1</h5>');
1272
- markdown = markdown.replace(/^#### (.*$)/gim, '<h4>$1</h4>');
1273
- markdown = markdown.replace(/^### (.*$)/gim, '<h3>$1</h3>');
1274
- markdown = markdown.replace(/^## (.*$)/gim, '<h2>$1</h2>');
1275
- markdown = markdown.replace(/^# (.*$)/gim, '<h1>$1</h1>');
1272
+ var html = markdown.replace(/^###### (.*$)/gim, '<h6>$1</h6>');
1273
+ html = html.replace(/^##### (.*$)/gim, '<h5>$1</h5>');
1274
+ html = html.replace(/^#### (.*$)/gim, '<h4>$1</h4>');
1275
+ html = html.replace(/^### (.*$)/gim, '<h3>$1</h3>');
1276
+ html = html.replace(/^## (.*$)/gim, '<h2>$1</h2>');
1277
+ html = html.replace(/^# (.*$)/gim, '<h1>$1</h1>');
1276
1278
  // Convert bold and italic
1277
- markdown = markdown.replace(/\*\*\*(.*?)\*\*\*/gim, '<em><strong>$1</strong></em>');
1278
- markdown = markdown.replace(/\*\*(.*?)\*\*/gim, '<strong>$1</strong>');
1279
- markdown = markdown.replace(/\*(.*?)\*/gim, '<em>$1</em>');
1279
+ html = html.replace(/\*\*\*(.*?)\*\*\*/gim, '<em><strong>$1</strong></em>');
1280
+ html = html.replace(/\*\*(.*?)\*\*/gim, '<strong>$1</strong>');
1281
+ html = html.replace(/\*(.*?)\*/gim, '<em>$1</em>');
1280
1282
  // Convert links
1281
- markdown = markdown.replace(/\[(.*?)\]\((.*?)\)/gim, '<a href="$2">$1</a>');
1283
+ html = html.replace(/\[(.*?)\]\((.*?)\)/gim, '<a href="$2">$1</a>');
1282
1284
  // Convert unordered lists
1283
- markdown = markdown.replace(/^\* (.*)/gim, '<ul><li>$1</li></ul>');
1284
- markdown = markdown.replace(/^\- (.*)/gim, '<ul><li>$1</li></ul>');
1285
- markdown = markdown.replace(/^\+ (.*)/gim, '<ul><li>$1</li></ul>');
1285
+ html = html.replace(/^\* (.*)/gim, '<ul><li>$1</li></ul>');
1286
+ html = html.replace(/^\- (.*)/gim, '<ul><li>$1</li></ul>');
1287
+ html = html.replace(/^\+ (.*)/gim, '<ul><li>$1</li></ul>');
1286
1288
  // Convert ordered lists
1287
- markdown = markdown.replace(/^\d+\. (.*)/gim, '<ol><li>$1</li></ol>');
1289
+ html = html.replace(/^\d+\. (.*)/gim, '<ol><li>$1</li></ol>');
1288
1290
  // Convert line breaks
1289
- markdown = markdown.replace(/\n/gim, '<br/>');
1290
- return markdown.trim();
1291
+ html = html.replace(/\n/gim, '<br/>');
1292
+ return html.trim();
1291
1293
  };
1292
1294
  ChatDrawerComponent.prototype.handleMarkdown = function (markdownContent) {
1293
- if (markdownContent) {
1294
- var htmlContent = this.simpleMarkdownParser(markdownContent);
1295
- return this.sanitizer.bypassSecurityTrustHtml(htmlContent);
1296
- }
1297
- else {
1298
- return markdownContent;
1299
- }
1295
+ var htmlContent = this.simpleMarkdownParser(markdownContent);
1296
+ return this.sanitizer.bypassSecurityTrustHtml(htmlContent);
1300
1297
  };
1301
1298
  return ChatDrawerComponent;
1302
1299
  }());