diff --git a/scripts/copy-button.js b/scripts/copy-button.js index 0a709ca..bbf6f66 100644 --- a/scripts/copy-button.js +++ b/scripts/copy-button.js @@ -6,11 +6,11 @@ */ hexo.extend.filter.register('after_render:html', (data) => { - // Avoid duplicate button - if (data.includes('')) return; - const copyBtn = '' // Regex is based on https://github.com/hexojs/hexo/pull/3697 - return data.replace(/(?!<\/td>).+?<\/td>/, (str) => str.replace('', copyBtn + '')) + return data.replace(/(?!<\/td>).+?<\/td>/ig, (str) => { + if (!str.includes(copyBtn)) return str.replace('', copyBtn + '') + return str + }) })