diff --git a/config.toml b/config.toml index 2095a54..b858f1c 100644 --- a/config.toml +++ b/config.toml @@ -27,3 +27,6 @@ external_links_no_referrer = true paths = "off" taxonomies = "on" anchors = "off" + +[extra] +js_bundle_name = ["copy-code-button.js"] diff --git a/static/site/styles/site.css b/static/site/styles/site.css index 524e761..fde58ce 100644 --- a/static/site/styles/site.css +++ b/static/site/styles/site.css @@ -176,12 +176,14 @@ strong { } pre { + position: relative; color: rgb(57, 58, 52); background-color: var(--colors-code-background); margin: 0 1rem; padding: 1rem; border-radius: 0.5rem; overflow: auto; + padding-top: 2.5em; } code { @@ -206,6 +208,18 @@ code td { padding-left: 1rem; } +.copy-code-button { + position: absolute; + top: 5px; + right: 5px; + padding: 3px 8px; + font-size: 0.8em; + background-color: #f1f1f1; + border: 1px solid #ccc; + border-radius: 4px; + cursor: pointer; +} + hr { display: block; height: 1px; diff --git a/templates/base.html b/templates/base.html index bf531a1..40a3177 100644 --- a/templates/base.html +++ b/templates/base.html @@ -39,6 +39,7 @@ +