@hivegpt/hiveai-angular 0.0.59 → 0.0.61
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 +19 -14
- 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 +20 -15
- package/fesm2015/hivegpt-hiveai-angular.js +19 -14
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1269,28 +1269,33 @@
|
|
|
1269
1269
|
ChatDrawerComponent.prototype.simpleMarkdownParser = function (markdownContent) {
|
|
1270
1270
|
if (!markdownContent)
|
|
1271
1271
|
return '';
|
|
1272
|
-
var html = String(markdownContent); // Ensure it's treated as a string
|
|
1272
|
+
var html = String(markdownContent).trim(); // Ensure it's treated as a string and trim any extra spaces
|
|
1273
1273
|
// Convert headings
|
|
1274
|
-
html = html.replace(
|
|
1275
|
-
html = html.replace(
|
|
1276
|
-
html = html.replace(
|
|
1277
|
-
html = html.replace(
|
|
1278
|
-
html = html.replace(
|
|
1279
|
-
html = html.replace(
|
|
1274
|
+
html = html.replace(/^(###### (.*))$/gim, '<h6>$2</h6>');
|
|
1275
|
+
html = html.replace(/^(##### (.*))$/gim, '<h5>$2</h5>');
|
|
1276
|
+
html = html.replace(/^(#### (.*))$/gim, '<h4>$2</h4>');
|
|
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
1280
|
// Convert bold and italic
|
|
1281
1281
|
html = html.replace(/\*\*\*(.*?)\*\*\*/gim, '<em><strong>$1</strong></em>');
|
|
1282
1282
|
html = html.replace(/\*\*(.*?)\*\*/gim, '<strong>$1</strong>');
|
|
1283
1283
|
html = html.replace(/\*(.*?)\*/gim, '<em>$1</em>');
|
|
1284
1284
|
// Convert links
|
|
1285
|
-
html = html.replace(/\[(.*?)\]\((.*?)\)/gim, '<a href="$2">$1</a>');
|
|
1285
|
+
html = html.replace(/\[(.*?)\]\((.*?)\)/gim, '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>');
|
|
1286
1286
|
// Convert unordered lists
|
|
1287
|
-
html = html.replace(/^\* (.*)
|
|
1288
|
-
html = html.replace(/^\- (.*)
|
|
1289
|
-
html = html.replace(/^\+ (.*)
|
|
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
1290
|
// Convert ordered lists
|
|
1291
|
-
html = html.replace(/^\d+\. (.*)
|
|
1292
|
-
//
|
|
1293
|
-
html = html.replace(
|
|
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>";
|
|
1298
|
+
});
|
|
1294
1299
|
return html.trim();
|
|
1295
1300
|
};
|
|
1296
1301
|
// Convert Markdown to SafeHtml
|