@majapisoftwares/ui 4.3.7 → 4.3.9

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.
@@ -1 +1 @@
1
- export default function stripMarkdown(markdown?: string): string | undefined;
1
+ export default function stripMarkdown<T extends string | undefined>(markdown: T): T;
@@ -2,27 +2,27 @@ export default function stripMarkdown(markdown) {
2
2
  if (!markdown)
3
3
  return markdown;
4
4
  // Remove headers
5
- markdown = markdown.replace(/(^|\n)#+\s?/g, "");
5
+ let result = markdown.replace(/(^|\n)#+\s?/g, "");
6
6
  // Remove bold and italic (e.g., **text**, __text__, *text*, _text_)
7
- markdown = markdown.replace(/(\*\*|__)(.*?)\1/g, "$2");
8
- markdown = markdown.replace(/([*_])(.*?)\1/g, "$2");
7
+ result = result.replace(/(\*\*|__)(.*?)\1/g, "$2");
8
+ result = result.replace(/([*_])(.*?)\1/g, "$2");
9
9
  // Remove strikethrough (e.g., ~~text~~)
10
- markdown = markdown.replace(/~~(.*?)~~/g, "$1");
10
+ result = result.replace(/~~(.*?)~~/g, "$1");
11
11
  // Remove inline code (e.g., `code`)
12
- markdown = markdown.replace(/`([^`]+)`/g, "$1");
12
+ result = result.replace(/`([^`]+)`/g, "$1");
13
13
  // Remove blockquotes (e.g., > text)
14
- markdown = markdown.replace(/(^|\n)>+/g, "");
14
+ result = result.replace(/(^|\n)>+/g, "");
15
15
  // Remove images and links (e.g., ![alt](url) and [text](url))
16
- markdown = markdown.replace(/!\[.*?]\(.*?\)/g, "");
17
- markdown = markdown.replace(/\[(.*?)]\(.*?\)/g, "$1");
16
+ result = result.replace(/!\[.*?]\(.*?\)/g, "");
17
+ result = result.replace(/\[(.*?)]\(.*?\)/g, "$1");
18
18
  // Remove unordered lists (e.g., - text, * text)
19
- markdown = markdown.replace(/(^|\n)[*-]\s+/g, "");
19
+ result = result.replace(/(^|\n)[*-]\s+/g, "");
20
20
  // Remove ordered lists (e.g., 1. text)
21
- markdown = markdown.replace(/(^|\n)\d+\.\s+/g, "");
21
+ result = result.replace(/(^|\n)\d+\.\s+/g, "");
22
22
  // Remove horizontal rules (e.g., --- or ***)
23
- markdown = markdown.replace(/(^|\n)(---|\*\*\*)/g, "");
23
+ result = result.replace(/(^|\n)(---|\*\*\*)/g, "");
24
24
  // Remove extra newlines
25
- markdown = markdown.replace(/\n{2,}/g, "\n");
25
+ result = result.replace(/\n{2,}/g, "\n");
26
26
  // Trim leading and trailing spaces
27
- return markdown.trim();
27
+ return result.trim();
28
28
  }