Skip to content

Commit

Permalink
Support hyphens
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records committed Jul 21, 2023
1 parent 1964eda commit f44f61c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -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, '<sup class="footnote-symbol" id="fn-$1">[\[$1]\](#fnref-$1)</sup>')
.replace(/\[\^([A-Za-z0-9]+)\]\: /gm, '<strong class="footnote-reference-symbol" id="fnref-$1">[\[$1\]](#fn-$1)</strong>:leftwards_arrow_with_hook: ');
.replace(/\[\^([A-Za-z0-9\-]+)\][^:]/gm, '<sup class="footnote-symbol" id="fn-$1">[\[$1]\](#fnref-$1)</sup>')
.replace(/\[\^([A-Za-z0-9\-]+)\]\: /gm, '<strong class="footnote-reference-symbol" id="fnref-$1">[\[$1\]](#fn-$1)</strong>:leftwards_arrow_with_hook: ');
}
return html;
});
Expand Down

0 comments on commit f44f61c

Please sign in to comment.