aboutsummaryrefslogtreecommitdiff
path: root/src/components/CodeBlock.tsx
diff options
context:
space:
mode:
authorV <vendicated@riseup.net>2023-09-05 21:37:39 +0200
committerV <vendicated@riseup.net>2023-09-05 21:37:39 +0200
commit4c805d08be9c2ec5dcd2cb1b7bb686f7e2636a9d (patch)
tree2f893fbc8eefc2e1598bdb2bcfe0128ca982f5b9 /src/components/CodeBlock.tsx
parent9b987d1e5688f3fbac5cd2aa8f90c3d646f450af (diff)
downloadVencord-4c805d08be9c2ec5dcd2cb1b7bb686f7e2636a9d.tar.gz
Vencord-4c805d08be9c2ec5dcd2cb1b7bb686f7e2636a9d.tar.bz2
Vencord-4c805d08be9c2ec5dcd2cb1b7bb686f7e2636a9d.zip
[skip ci] PatchHelper: Fix copy button style
Diffstat (limited to 'src/components/CodeBlock.tsx')
-rw-r--r--src/components/CodeBlock.tsx21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/components/CodeBlock.tsx b/src/components/CodeBlock.tsx
new file mode 100644
index 0000000..41c5ef0
--- /dev/null
+++ b/src/components/CodeBlock.tsx
@@ -0,0 +1,21 @@
+/*
+ * Vencord, a Discord client mod
+ * Copyright (c) 2023 Vendicated and contributors
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+import { findByPropsLazy } from "@webpack";
+import { Parser } from "@webpack/common";
+
+const CodeContainerClasses = findByPropsLazy("markup", "codeContainer");
+
+/**
+ * Renders code in a Discord codeblock
+ */
+export function CodeBlock(props: { content?: string, lang: string; }) {
+ return (
+ <div className={CodeContainerClasses.markup}>
+ {Parser.defaultRules.codeBlock.react(props, null, {})}
+ </div>
+ );
+}