Co-authored-by: prism <69634294+imjustprism@users.noreply.github.com> Co-authored-by: sadan4 <117494111+sadan4@users.noreply.github.com> Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Co-authored-by: V <vendicated@riseup.net> Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com> Co-authored-by: prism <snawalt420@proton.me> Co-authored-by: wearrrrr <contact@wearr.dev> Co-authored-by: Elvyra <88881326+EepyElvyra@users.noreply.github.com>
32 lines
847 B
TypeScript
32 lines
847 B
TypeScript
/*
|
|
* Vencord, a Discord client mod
|
|
* Copyright (c) 2023 Vendicated and contributors
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
import { findCssClassesLazy } from "@webpack";
|
|
import { Parser } from "@webpack/common";
|
|
|
|
const CodeContainerClasses = findCssClassesLazy("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>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Renders inline code like `this`
|
|
*/
|
|
export function InlineCode({ children }: { children: React.ReactNode; }) {
|
|
return (
|
|
<span className={CodeContainerClasses.markup}>
|
|
<code className="inline">{children}</code>
|
|
</span>
|
|
);
|
|
}
|