From f606f5572883e84ffceaf2b67c763946cab868db Mon Sep 17 00:00:00 2001 From: "netop://ウィビ" Date: Sat, 30 May 2026 12:36:33 -0700 Subject: updates blog panel and modularizes about panel --- src/lib/utility/markdown.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/lib/utility/markdown.ts (limited to 'src/lib/utility/markdown.ts') diff --git a/src/lib/utility/markdown.ts b/src/lib/utility/markdown.ts new file mode 100644 index 0000000..3d086f0 --- /dev/null +++ b/src/lib/utility/markdown.ts @@ -0,0 +1,20 @@ + + + +/*** EXPORT ------------------------------------------- ***/ + +export default (input: string): string => { + return input + .replace(/(\*\*|__)(.*?)\1/g, `$2`) /*** bold ***/ + .replace(/(\*|_)(.*?)\1/g, "$2") /*** italic ***/ + .replace(/(\~~)(.*?)\1/g, "$2") /*** strikethrough ***/ + .replace(/'/g, "’") /*** fancy apostrophe ***/ + .replace(/(:nbhyp:)/g, "‑") /*** non‑breaking hyphen ***/ + .replace(/(:nbsp:)/g, " ") /*** non‑breaking space ***/ + .replace(/(\.\.\.)/g, "…") /*** ellipsis ***/ + // .replace(/---/g, "
") + .replace(/\[([^\]]+)\]\(([^)]+)\)/g, `$1`); /*** link ***/ + + // TODO + // : check if link is local and if not, add `target="_blank"` +} -- cgit v1.2.3