From ffa9c8c5beb4ba2c8b435e42c5d4cf91643d6f53 Mon Sep 17 00:00:00 2001 From: curben <2809763-curben@users.noreply.gitlab.com> Date: Sat, 19 Oct 2019 04:12:15 +0100 Subject: [PATCH] fix(copy_button): enable dotAll/'s' flag -
 could span multiple lines
---
 themes/chameleon/scripts/copy-button.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/themes/chameleon/scripts/copy-button.js b/themes/chameleon/scripts/copy-button.js
index 24484d4..e2e48bc 100644
--- a/themes/chameleon/scripts/copy-button.js
+++ b/themes/chameleon/scripts/copy-button.js
@@ -9,7 +9,7 @@ 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>/ig, (str) => {
+  return data.replace(/
(?!<\/pre>).+?<\/pre>/gs, (str) => {
     if (!str.includes(copyBtn)) return str.replace('
', copyBtn + '
') return str })