diff --git a/assets/components/Website/Docs/CodeBlock.vue b/assets/components/Website/Docs/CodeBlock.vue index 5613a6a0..1af31dd9 100644 --- a/assets/components/Website/Docs/CodeBlock.vue +++ b/assets/components/Website/Docs/CodeBlock.vue @@ -10,12 +10,27 @@ import { highlightCode } from "../../../helpers/highlightCode"; import { TransitionRoot } from "@headlessui/vue"; import { ClipboardDocumentIcon } from "@heroicons/vue/24/solid"; -const language = ref("php"); const formattedCode = ref(""); const code = ref(slots.default()[0].children); +const props = defineProps({ + lang: { + type: String, + default: "php", + }, + noHighlight: { + type: Boolean, + default: false, + }, +}); + const highlight = () => { - formattedCode.value = highlightCode(code.value, language.value); + if (props.noHighlight === true) { + formattedCode.value = code.value; + return; + } + + formattedCode.value = highlightCode(code.value, props.lang); }; onMounted(() => { @@ -66,7 +81,7 @@ const clipboardAvailable = computed(() => { Copied!
+
Our problem file might look like the following.
-Write a program that accepts one or more numbers as command-line arguments and prints the mean average of those numbers to the console (stdout).