From 428588a4af8abb89ae9a614dd231e83fcb8b9eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9B=90=EB=8D=94?= Date: Thu, 14 Jan 2021 22:42:30 +0900 Subject: [PATCH] feat: added showdow extensions --- utils/ShowdownExtensions.ts | 12 ++++++++++++ utils/Tools.ts | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 utils/ShowdownExtensions.ts diff --git a/utils/ShowdownExtensions.ts b/utils/ShowdownExtensions.ts new file mode 100644 index 0000000..4541144 --- /dev/null +++ b/utils/ShowdownExtensions.ts @@ -0,0 +1,12 @@ +export const anchorHeader = { + type: 'output', + regex: '(.*?)<\\/h(\\d)>', + replace: function (__match, id:string, title:string, level:number) { + + // github anchor style + const octicon_html = `` + + return `${octicon_html}${title}` + } +} + diff --git a/utils/Tools.ts b/utils/Tools.ts index fbfa9d8..b230431 100644 --- a/utils/Tools.ts +++ b/utils/Tools.ts @@ -47,4 +47,6 @@ export function checkBrowser(){ M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'] if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]) return M.join(' ') -} \ No newline at end of file +} + +export { anchorHeader } from './ShowdownExtensions' \ No newline at end of file