mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-13 19:56:18 +09:00
remove search page and added search modal
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user