From f44f61c791dc1f7da9146dff59bb6cf90cfaacec Mon Sep 17 00:00:00 2001 From: sy-records <52o@qq52o.cn> Date: Fri, 21 Jul 2023 09:58:09 +0800 Subject: [PATCH] Support hyphens --- package.json | 2 +- src/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2d30c78..eaf0d49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sy-records/docsify-footnotes", - "version": "1.0.1", + "version": "1.0.2", "description": "A plugin that supports the use of footnotes in docsify.", "main": "src/index.js", "repository": { diff --git a/src/index.js b/src/index.js index 37310be..1f40c77 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,9 @@ const footnotes = function(hook) { hook.beforeEach(function (html) { - if (/\[\^([A-Za-z0-9]+)\][^:]/.test(html)) { + if (/\[\^([A-Za-z0-9\-]+)\][^:]/.test(html)) { html = html - .replace(/\[\^([A-Za-z0-9]+)\][^:]/gm, '[\[$1]\](#fnref-$1)') - .replace(/\[\^([A-Za-z0-9]+)\]\: /gm, '[\[$1\]](#fn-$1):leftwards_arrow_with_hook: '); + .replace(/\[\^([A-Za-z0-9\-]+)\][^:]/gm, '[\[$1]\](#fnref-$1)') + .replace(/\[\^([A-Za-z0-9\-]+)\]\: /gm, '[\[$1\]](#fn-$1):leftwards_arrow_with_hook: '); } return html; });