(?s)(.*?)\<\/disable-copy\>` "###DISABLE_COPY###$1###DISABLE_COPY_END###" $inner }}
{{/* We need to set a default for the highlighting options here */}}
{{ $options := "" }}
{{ with .Get 0 }}
{{ $options = . }}
{{ end }}
{{ $highlighted := highlight $inner "text" $options }}
+{{ $highlighted := replaceRE `###DISABLE_COPY###(?s)(.*?)###DISABLE_COPY_END###` "$1" $highlighted | safeHTML}}
+{{ with .Get "wrapper" }}
+
+{{ end }}
{{/* Now we replace the custom prefixes with a span that contains the prefix, which is not selectable by users */}}
{{- replaceRE `###CUSTOM_PREFIX###((?:\$|#)\s)###CUSTOM_PREFIX_END###` "$1" $highlighted | safeHTML -}}
+{{ with .Get "wrapper" }}
+
+{{ end }}
diff --git a/static/js/global-script.js b/static/js/global-script.js
index 3ef12d9900..96e61e6d6f 100644
--- a/static/js/global-script.js
+++ b/static/js/global-script.js
@@ -8,6 +8,7 @@ function setupCodeBlockCopyButton() {
e.preventDefault();
const elem = $(this).closest('.code-container').find('code').clone();
elem.find('.command-prefix').remove(); // removing prefix
+ elem.find('.disable-copy').remove(); // removing text which shouldn't be copied
navigator.clipboard.writeText(elem.text());
$(this).find('span').text('Copied!');
setTimeout(() => {