diff --git a/scripts/tags/copy.js b/scripts/tags/copy.js index 2f49273..2be21dd 100644 --- a/scripts/tags/copy.js +++ b/scripts/tags/copy.js @@ -9,6 +9,8 @@ 'use strict'; +var copy_index = 0; + hexo.extend.tag.register('copy', function(args) { args = hexo.args.map(args, ['width', 'git'], ['text']); if (args == undefined || args.text == undefined) { @@ -27,9 +29,8 @@ hexo.extend.tag.register('copy', function(args) { text = 'https://github.com/' + text + '.git'; } } - function generate_id(text) { - return 'copy-' + text.replace(/[^a-z|0-9|.:]/gi, '') - } + + const copy_id = 'copy-' + ++copy_index + '-' + text.replace(/[^a-z|0-9|.:]/gi, ''); var el = ''; el += '
'; - el += '';