MCPcopy Create free account
hub / github.com/wavetermdev/waveterm / getLanguage

Function getLanguage

frontend/app/element/streamdown.tsx:129–135  ·  view source on GitHub ↗
(children: any)

Source from the content-addressed store, hash-verified

127const CodeBlock = ({ children, onClickExecute, codeBlockMaxWidthAtom }: CodeBlockProps) => {
128 const codeBlockMaxWidth = useAtomValueSafe(codeBlockMaxWidthAtom);
129 const getLanguage = (children: any): string => {
130 if (children?.props?.className) {
131 const match = children.props.className.match(/language-([\w+-]+)/i);
132 if (match) return match[1];
133 }
134 return "text";
135 };
136
137 const handleCopy = async (e: React.MouseEvent) => {
138 const textToCopy = extractText(children).replace(/\n$/, "");

Callers 1

CodeBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected