MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / copyMarkdown

Function copyMarkdown

console/src/platform/shell/SqlSelectTable.tsx:163–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

161 };
162
163 const copyMarkdown = () => {
164 const formattedRows = formatRows(cols ?? [], rows ?? []);
165 const markdown = markdownTable([colNames, ...(formattedRows ?? [])], {
166 // We use stringWidth to account for each character's "visible" size. I.e. emojis have a large visible size than most characters.
167 stringLength: stringWidth,
168 });
169 // Clipboards can generally accept one of two formats: plaintext and HTML.
170 // Anything else will result in blank contents (and you having pulled out
171 // your hair). We can't use navigator.clipboard.writeText because it
172 // won't work in Safari for http domains.
173 copyToClipboard(markdown, { format: "text/plain" });
174 toast({ description: "Results copied to clipboard" });
175 };
176
177 const { colors } = useTheme<MaterializeTheme>();
178 isSubscribeManager = isSubscribeManager ?? false;

Callers

nothing calls this directly

Calls 1

formatRowsFunction · 0.85

Tested by

no test coverage detected