diff --git a/assets/sass/_zen.scss b/assets/sass/_zen.scss index abe5fb5..04268a3 100644 --- a/assets/sass/_zen.scss +++ b/assets/sass/_zen.scss @@ -133,3 +133,47 @@ article { .search-text { font-size: var(--fs-l); } + +// Copy code + +[data-codeblock] { + position: relative; + + & > pre { + padding-block-start: 1lh; + } +} + +.codebutton { + position: absolute; + inset-inline-end: .2rem; + background: unset; + border: unset; + text-shadow: unset; + font-size: var(--fs-l); + color: var(--color-border); + rotate: 90deg; + cursor: pointer; + + & > span { + pointer-events: none; + } + + &:hover, + &:focus-visible, + &:active { + scale: 1.15; + } +} + +.flash-item { + animation: flash 500ms ease-in-out 1; +} + +@keyframes flash { + 50% { + border-color: var(--color-warning); + background-color: var(--color-warning-bg); + } +} + diff --git a/i18n/ar.toml b/i18n/ar.toml index e6c2e57..479e7c1 100644 --- a/i18n/ar.toml +++ b/i18n/ar.toml @@ -117,3 +117,6 @@ other = "Decline tracking" [privacy_policy] other = "Privacy policy" + +[copy_code] +other = "Copy code" diff --git a/i18n/da.toml b/i18n/da.toml index 17f8508..eb41719 100644 --- a/i18n/da.toml +++ b/i18n/da.toml @@ -114,3 +114,6 @@ other = "Afvis tracking" [privacy_policy] other = "Privat politik" + +[copy_code] +other = "Copy code" diff --git a/i18n/de.toml b/i18n/de.toml index e3cfc66..e1c04bd 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -114,3 +114,6 @@ other = "Tracking ablehnen" [privacy_policy] other = "Datenschutzrichtlinie" + +[copy_code] +other = "Copy code" diff --git a/i18n/en.toml b/i18n/en.toml index 28ce2a2..32cecc4 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -114,3 +114,6 @@ other = "Only necessary" [privacy_policy] other = "Privacy policy" + +[copy_code] +other = "Copy code" diff --git a/i18n/es.toml b/i18n/es.toml index 4a381b1..7c899e3 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -115,3 +115,6 @@ other = "Solo las necesarias" [privacy_policy] other = "Política de privacidad" + +[copy_code] +other = "Copy code" diff --git a/i18n/fi.toml b/i18n/fi.toml index f05f159..9165a1b 100644 --- a/i18n/fi.toml +++ b/i18n/fi.toml @@ -114,3 +114,6 @@ other = "Hylkää seuranta" [privacy_policy] other = "Yksityisyyskäytäntö" + +[copy_code] +other = "Copy code" diff --git a/i18n/fr.toml b/i18n/fr.toml index 04fcd5e..83a3916 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -114,3 +114,6 @@ other = "Decline tracking" [privacy_policy] other = "Privacy policy" + +[copy_code] +other = "Copy code" diff --git a/i18n/he.toml b/i18n/he.toml index fd80fe7..6a31d10 100644 --- a/i18n/he.toml +++ b/i18n/he.toml @@ -115,3 +115,5 @@ other = "Decline tracking" [privacy_policy] other = "Privacy policy" +[copy_code] +other = "Copy code" diff --git a/i18n/id.toml b/i18n/id.toml index e33f899..3f4ccbc 100644 --- a/i18n/id.toml +++ b/i18n/id.toml @@ -114,3 +114,6 @@ other = "Decline tracking" [privacy_policy] other = "Privacy policy" + +[copy_code] +other = "Copy code" diff --git a/i18n/nb.toml b/i18n/nb.toml index c7d4000..e2236e3 100644 --- a/i18n/nb.toml +++ b/i18n/nb.toml @@ -114,3 +114,6 @@ other = "Decline tracking" [privacy_policy] other = "Privacy policy" + +[copy_code] +other = "Copy code" diff --git a/i18n/pt.toml b/i18n/pt.toml index 5d8a19a..70f7745 100644 --- a/i18n/pt.toml +++ b/i18n/pt.toml @@ -115,3 +115,6 @@ other = "Decline tracking" [privacy_policy] other = "Privacy policy" + +[copy_code] +other = "Copy code" diff --git a/i18n/sr.toml b/i18n/sr.toml index 2eea05d..70450ae 100644 --- a/i18n/sr.toml +++ b/i18n/sr.toml @@ -114,3 +114,6 @@ other = "Само неопходне" [privacy_policy] other = "Правила о приватности" + +[copy_code] +other = "Copy code" diff --git a/i18n/sv.toml b/i18n/sv.toml index 985c601..3cf42ee 100644 --- a/i18n/sv.toml +++ b/i18n/sv.toml @@ -114,3 +114,6 @@ other = "Bara nödvändiga" [privacy_policy] other = "Personuppgiftsbehandling" + +[copy_code] +other = "Kopiera kod" diff --git a/i18n/sw.toml b/i18n/sw.toml index 4849a75..d31a987 100644 --- a/i18n/sw.toml +++ b/i18n/sw.toml @@ -114,3 +114,6 @@ other = "Ni muhimu tu" [privacy_policy] other = "Sera ya faragha" + +[copy_code] +other = "Copy code" diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml index aee2aab..d246b33 100644 --- a/i18n/zh-cn.toml +++ b/i18n/zh-cn.toml @@ -114,3 +114,6 @@ other = "只允许必要的" [privacy_policy] other = "隐私政策" + +[copy_code] +other = "Copy code" diff --git a/layouts/_markup/example-render-codeblock.html b/layouts/_markup/example-render-codeblock.html new file mode 100644 index 0000000..1278c84 --- /dev/null +++ b/layouts/_markup/example-render-codeblock.html @@ -0,0 +1,14 @@ +{{ $result := transform.HighlightCodeBlock . -}} +
+{{ $result.Inner }}
+
+{{ else -}}
+{{ $result.Wrapped }}
+{{ end -}}
+