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