MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / _code_header_label

Function _code_header_label

scripts/docs/generate_rust_library_reference.py:335–360  ·  view source on GitHub ↗
(node: Tag)

Source from the content-addressed store, hash-verified

333
334
335def _code_header_label(node: Tag) -> str:
336 if node.name in {"h2", "h3"}:
337 text = re.sub(r"\s+", " ", _plain_code(node)).strip()
338 return _inline_code(text) if text else ""
339
340 for class_name in (
341 "fn",
342 "associatedtype",
343 "constant",
344 "struct",
345 "enum",
346 "trait",
347 "type",
348 "macro",
349 "derive",
350 "attribute",
351 ):
352 link = node.find("a", class_=class_name)
353 if link is None:
354 continue
355 text = _clean_text(link.get_text("", strip=True))
356 if text:
357 return _inline_code(text)
358
359 text = re.sub(r"\s+", " ", _plain_code(node)).strip()
360 return _inline_code(text) if text else ""
361
362
363def _code_header_markdown(node: Tag, page: Page, pages_by_html: dict[Path, Page]) -> str:

Callers 1

_code_header_markdownFunction · 0.85

Calls 4

_plain_codeFunction · 0.85
_inline_codeFunction · 0.85
_clean_textFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected