remove search page and added search modal

This commit is contained in:
somrat sorkar
2023-12-11 15:00:43 +06:00
parent 4c3b181a46
commit 5da3079efb
12 changed files with 702 additions and 242 deletions
+11 -1
View File
@@ -16,14 +16,24 @@ export const humanize = (content: string) => {
return content
.replace(/^[\s_]+|[\s_]+$/g, "")
.replace(/[_\s]+/g, " ")
.replace(/[-\s]+/g, " ")
.replace(/^[a-z]/, function (m) {
return m.toUpperCase();
});
};
// titleify
export const titleify = (content: string) => {
const humanized = humanize(content);
return humanized
.split(" ")
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(" ");
};
// plainify
export const plainify = (content: string) => {
const parseMarkdown = marked.parse(content);
const parseMarkdown: any = marked.parse(content);
const filterBrackets = parseMarkdown.replace(/<\/?[^>]+(>|$)/gm, "");
const filterSpaces = filterBrackets.replace(/[\r\n]\s*[\r\n]/gm, "");
const stripHTML = htmlEntityDecoder(filterSpaces);