'use strict' /* global hexo */ /* * Add "Copy" button to code snippet */ hexo.extend.filter.register('after_render:html', (data) => { const copyBtn = '' // Regex is based on https://github.com/hexojs/hexo/pull/3697 return data.replace(/
(?!<\/pre>).+?<\/pre>/gs, (str) => { if (!str.includes(copyBtn)) return str.replace('', copyBtn + '') return str }) })