From e028652e1bfa3234b49865871a65d13c0cd05b55 Mon Sep 17 00:00:00 2001 From: fechin Date: Mon, 6 Mar 2023 15:38:22 +0800 Subject: [PATCH] Add copy code button to code blocks --- themes/coo/layout/_partial/scripts.ejs | 42 ++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/themes/coo/layout/_partial/scripts.ejs b/themes/coo/layout/_partial/scripts.ejs index 4d91ef8..c441a4d 100644 --- a/themes/coo/layout/_partial/scripts.ejs +++ b/themes/coo/layout/_partial/scripts.ejs @@ -25,7 +25,7 @@ // Do stuff if text starts with `latex` const renderedKatex = katex.renderToString( text.replace('KaTeX:', ''), - { throwOnError: false } + {throwOnError: false} ); // Populate katex and additional markup for formatting el.outerHTML = `${renderedKatex}`; @@ -33,4 +33,42 @@ }) -<% } %> \ No newline at end of file +<% } %> + + +<% if (is_post() && page.plugins != undefined && page.plugins.includes("copyCode") ){ %> + +<% } %>