MCPcopy Create free account
hub / github.com/block/buzz / classifyChildren

Function classifyChildren

desktop/src/shared/ui/markdownUtils.ts:36–48  ·  view source on GitHub ↗
(childArray: React.ReactNode[])

Source from the content-addressed store, hash-verified

34 * and `<br>` elements (injected by remarkBreaks between images).
35 */
36export function classifyChildren(childArray: React.ReactNode[]): {
37 imageChildren: React.ReactNode[];
38 nonImageChildren: React.ReactNode[];
39} {
40 const imageChildren = childArray.filter(isBlockMedia);
41 const nonImageChildren = childArray.filter(
42 (child) =>
43 !isBlockMedia(child) &&
44 !(typeof child === "string" && child.trim() === "") &&
45 !(React.isValidElement(child) && child.type === "br"),
46 );
47 return { imageChildren, nonImageChildren };
48}
49
50/** Returns true when a paragraph contains 2+ images and no other content. */
51export function isImageOnlyParagraph(childArray: React.ReactNode[]): boolean {

Callers 3

createMarkdownComponentsFunction · 0.90
isImageOnlyParagraphFunction · 0.70
hasBlockMediaFunction · 0.70

Calls 1

isBlockMediaFunction · 0.70

Tested by

no test coverage detected