MCPcopy
hub / github.com/codeaashu/claude-code / MarkdownBody

Function MarkdownBody

src/components/Markdown.tsx:123–171  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

121 return t1;
122}
123function MarkdownBody(t0) {
124 const $ = _c(7);
125 const {
126 children,
127 dimColor,
128 highlight
129 } = t0;
130 const [theme] = useTheme();
131 configureMarked();
132 let elements;
133 if ($[0] !== children || $[1] !== dimColor || $[2] !== highlight || $[3] !== theme) {
134 const tokens = cachedLexer(stripPromptXMLTags(children));
135 elements = [];
136 let nonTableContent = "";
137 const flushNonTableContent = function flushNonTableContent() {
138 if (nonTableContent) {
139 elements.push(<Ansi key={elements.length} dimColor={dimColor}>{nonTableContent.trim()}</Ansi>);
140 nonTableContent = "";
141 }
142 };
143 for (const token of tokens) {
144 if (token.type === "table") {
145 flushNonTableContent();
146 elements.push(<MarkdownTable key={elements.length} token={token as Tokens.Table} highlight={highlight} />);
147 } else {
148 nonTableContent = nonTableContent + formatToken(token, theme, 0, null, null, highlight);
149 nonTableContent;
150 }
151 }
152 flushNonTableContent();
153 $[0] = children;
154 $[1] = dimColor;
155 $[2] = highlight;
156 $[3] = theme;
157 $[4] = elements;
158 } else {
159 elements = $[4];
160 }
161 const elements_0 = elements;
162 let t1;
163 if ($[5] !== elements_0) {
164 t1 = <Box flexDirection="column" gap={1}>{elements_0}</Box>;
165 $[5] = elements_0;
166 $[6] = t1;
167 } else {
168 t1 = $[6];
169 }
170 return t1;
171}
172type StreamingProps = {
173 children: string;
174};

Callers

nothing calls this directly

Calls 7

configureMarkedFunction · 0.85
cachedLexerFunction · 0.85
stripPromptXMLTagsFunction · 0.85
flushNonTableContentFunction · 0.85
formatTokenFunction · 0.85
useThemeFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected