MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / _render_blockquote

Function _render_blockquote

openkb/agent/_markdown.py:263–290  ·  view source on GitHub ↗
(node: Any)

Source from the content-addressed store, hash-verified

261
262
263def _render_blockquote(node: Any) -> Text:
264 inner_blocks: list[Text] = []
265 for child in node.children or []:
266 if child.type in ("fence", "code_block"):
267 inner_blocks.append(_render_code_as_text(child))
268 continue
269 rendered = _render_block(child)
270 if isinstance(rendered, Text):
271 inner_blocks.append(rendered)
272
273 combined = Text()
274 for i, block in enumerate(inner_blocks):
275 if i > 0:
276 combined.append("\n\n")
277 combined.append_text(block)
278 combined.stylize("italic")
279
280 lines = combined.split("\n", allow_blank=True)
281 out = Text()
282 for i, line in enumerate(lines):
283 if i > 0:
284 out.append("\n")
285 if line.plain.strip():
286 out.append(f"{BLOCKQUOTE_BAR} ", style="dim")
287 out.append_text(line)
288 else:
289 out.append_text(line)
290 return out
291
292
293def _render_table(node: Any) -> Text:

Callers 1

_render_blockFunction · 0.85

Calls 2

_render_code_as_textFunction · 0.85
_render_blockFunction · 0.85

Tested by

no test coverage detected