`;
+ return html;
+}
+
+
+const copyCodeBlockScript = ``;
+
+
+module.exports = {
+ getScripts: () => copyCodeBlockScript,
+ postRender: (content) => {
+ const $ = cheerio.load(content, { xmlMode: false });
+ const codeBlockSelector = 'pre';
+ const buttonHTML = getButtonHTML();
+ $(codeBlockSelector).each((i, codeBlock) => {
+ $(codeBlock).append(buttonHTML);
+ });
+ return $.html();
+ },
+};
diff --git a/test/functional/test_site/expected/markbind/css/markbind.css b/test/functional/test_site/expected/markbind/css/markbind.css
index d38eb2b900..01a4dc15dd 100644
--- a/test/functional/test_site/expected/markbind/css/markbind.css
+++ b/test/functional/test_site/expected/markbind/css/markbind.css
@@ -369,3 +369,45 @@ li.footnote-item:target {
transform: scale(1);
opacity: 1;
}
+
+/* "Copy" code block button */
+pre {
+ position: relative;
+}
+
+.copy-btn {
+ background-color: #b4b4b9;
+ border-radius: 0.25rem;
+ color: #f8f8ff;
+ display: inline-block;
+ font-size: 75%;
+ line-height: 1;
+ padding: 0.25em 0.4em;
+ position: absolute;
+ right: 0.5em;
+ text-align: center;
+ top: 0.4em;
+ white-space: nowrap;
+}
+
+.copy-btn:hover {
+ color: #555;
+}
+
+.copy-btn-body {
+ align-items: center;
+ display: flex;
+}
+
+.copy-btn svg {
+ fill: currentColor;
+ margin-right: 0.4em;
+}
+
+.copy-btn-label {
+ font-size: 11px;
+}
+
+.copy-btn:focus {
+ outline: none;
+}
diff --git a/test/functional/test_site_algolia_plugin/expected/markbind/css/markbind.css b/test/functional/test_site_algolia_plugin/expected/markbind/css/markbind.css
index d38eb2b900..01a4dc15dd 100644
--- a/test/functional/test_site_algolia_plugin/expected/markbind/css/markbind.css
+++ b/test/functional/test_site_algolia_plugin/expected/markbind/css/markbind.css
@@ -369,3 +369,45 @@ li.footnote-item:target {
transform: scale(1);
opacity: 1;
}
+
+/* "Copy" code block button */
+pre {
+ position: relative;
+}
+
+.copy-btn {
+ background-color: #b4b4b9;
+ border-radius: 0.25rem;
+ color: #f8f8ff;
+ display: inline-block;
+ font-size: 75%;
+ line-height: 1;
+ padding: 0.25em 0.4em;
+ position: absolute;
+ right: 0.5em;
+ text-align: center;
+ top: 0.4em;
+ white-space: nowrap;
+}
+
+.copy-btn:hover {
+ color: #555;
+}
+
+.copy-btn-body {
+ align-items: center;
+ display: flex;
+}
+
+.copy-btn svg {
+ fill: currentColor;
+ margin-right: 0.4em;
+}
+
+.copy-btn-label {
+ font-size: 11px;
+}
+
+.copy-btn:focus {
+ outline: none;
+}
diff --git a/test/functional/test_site_convert/expected/markbind/css/markbind.css b/test/functional/test_site_convert/expected/markbind/css/markbind.css
index d38eb2b900..01a4dc15dd 100644
--- a/test/functional/test_site_convert/expected/markbind/css/markbind.css
+++ b/test/functional/test_site_convert/expected/markbind/css/markbind.css
@@ -369,3 +369,45 @@ li.footnote-item:target {
transform: scale(1);
opacity: 1;
}
+
+/* "Copy" code block button */
+pre {
+ position: relative;
+}
+
+.copy-btn {
+ background-color: #b4b4b9;
+ border-radius: 0.25rem;
+ color: #f8f8ff;
+ display: inline-block;
+ font-size: 75%;
+ line-height: 1;
+ padding: 0.25em 0.4em;
+ position: absolute;
+ right: 0.5em;
+ text-align: center;
+ top: 0.4em;
+ white-space: nowrap;
+}
+
+.copy-btn:hover {
+ color: #555;
+}
+
+.copy-btn-body {
+ align-items: center;
+ display: flex;
+}
+
+.copy-btn svg {
+ fill: currentColor;
+ margin-right: 0.4em;
+}
+
+.copy-btn-label {
+ font-size: 11px;
+}
+
+.copy-btn:focus {
+ outline: none;
+}
diff --git a/test/functional/test_site_expressive_layout/expected/markbind/css/markbind.css b/test/functional/test_site_expressive_layout/expected/markbind/css/markbind.css
index d38eb2b900..01a4dc15dd 100644
--- a/test/functional/test_site_expressive_layout/expected/markbind/css/markbind.css
+++ b/test/functional/test_site_expressive_layout/expected/markbind/css/markbind.css
@@ -369,3 +369,45 @@ li.footnote-item:target {
transform: scale(1);
opacity: 1;
}
+
+/* "Copy" code block button */
+pre {
+ position: relative;
+}
+
+.copy-btn {
+ background-color: #b4b4b9;
+ border-radius: 0.25rem;
+ color: #f8f8ff;
+ display: inline-block;
+ font-size: 75%;
+ line-height: 1;
+ padding: 0.25em 0.4em;
+ position: absolute;
+ right: 0.5em;
+ text-align: center;
+ top: 0.4em;
+ white-space: nowrap;
+}
+
+.copy-btn:hover {
+ color: #555;
+}
+
+.copy-btn-body {
+ align-items: center;
+ display: flex;
+}
+
+.copy-btn svg {
+ fill: currentColor;
+ margin-right: 0.4em;
+}
+
+.copy-btn-label {
+ font-size: 11px;
+}
+
+.copy-btn:focus {
+ outline: none;
+}
diff --git a/test/functional/test_site_templates/test_default/expected/markbind/css/markbind.css b/test/functional/test_site_templates/test_default/expected/markbind/css/markbind.css
index d38eb2b900..01a4dc15dd 100644
--- a/test/functional/test_site_templates/test_default/expected/markbind/css/markbind.css
+++ b/test/functional/test_site_templates/test_default/expected/markbind/css/markbind.css
@@ -369,3 +369,45 @@ li.footnote-item:target {
transform: scale(1);
opacity: 1;
}
+
+/* "Copy" code block button */
+pre {
+ position: relative;
+}
+
+.copy-btn {
+ background-color: #b4b4b9;
+ border-radius: 0.25rem;
+ color: #f8f8ff;
+ display: inline-block;
+ font-size: 75%;
+ line-height: 1;
+ padding: 0.25em 0.4em;
+ position: absolute;
+ right: 0.5em;
+ text-align: center;
+ top: 0.4em;
+ white-space: nowrap;
+}
+
+.copy-btn:hover {
+ color: #555;
+}
+
+.copy-btn-body {
+ align-items: center;
+ display: flex;
+}
+
+.copy-btn svg {
+ fill: currentColor;
+ margin-right: 0.4em;
+}
+
+.copy-btn-label {
+ font-size: 11px;
+}
+
+.copy-btn:focus {
+ outline: none;
+}
diff --git a/test/functional/test_site_templates/test_minimal/expected/markbind/css/markbind.css b/test/functional/test_site_templates/test_minimal/expected/markbind/css/markbind.css
index d38eb2b900..01a4dc15dd 100644
--- a/test/functional/test_site_templates/test_minimal/expected/markbind/css/markbind.css
+++ b/test/functional/test_site_templates/test_minimal/expected/markbind/css/markbind.css
@@ -369,3 +369,45 @@ li.footnote-item:target {
transform: scale(1);
opacity: 1;
}
+
+/* "Copy" code block button */
+pre {
+ position: relative;
+}
+
+.copy-btn {
+ background-color: #b4b4b9;
+ border-radius: 0.25rem;
+ color: #f8f8ff;
+ display: inline-block;
+ font-size: 75%;
+ line-height: 1;
+ padding: 0.25em 0.4em;
+ position: absolute;
+ right: 0.5em;
+ text-align: center;
+ top: 0.4em;
+ white-space: nowrap;
+}
+
+.copy-btn:hover {
+ color: #555;
+}
+
+.copy-btn-body {
+ align-items: center;
+ display: flex;
+}
+
+.copy-btn svg {
+ fill: currentColor;
+ margin-right: 0.4em;
+}
+
+.copy-btn-label {
+ font-size: 11px;
+}
+
+.copy-btn:focus {
+ outline: none;
+}