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

Function frontmatter

scripts/docs/reference_common.py:42–63  ·  view source on GitHub ↗
(
    title: str,
    description: str,
    position: int,
    *,
    sidebar_title: str | None = None,
    slug: str | None = None,
    normalize: TextNormalizer = identity,
)

Source from the content-addressed store, hash-verified

40
41
42def frontmatter(
43 title: str,
44 description: str,
45 position: int,
46 *,
47 sidebar_title: str | None = None,
48 slug: str | None = None,
49 normalize: TextNormalizer = identity,
50) -> str:
51 lines = ["---", f"title: {quote_yaml_string(title, normalize=normalize)}"]
52 if sidebar_title is not None:
53 lines.append(f"sidebar-title: {quote_yaml_string(sidebar_title, normalize=normalize)}")
54 if slug is not None:
55 lines.append(f"slug: {quote_yaml_string(slug, normalize=normalize)}")
56 lines.extend(
57 [
58 f"description: {quote_yaml_string(description, normalize=normalize)}",
59 f"position: {position}",
60 "---",
61 ]
62 )
63 return "\n".join(lines) + "\n" + MDX_SPDX_COMMENT + "\n"
64
65
66def display_path(path: Path, *, cwd: Path | None = None, resolve: bool = False) -> str:

Callers 6

_write_indexFunction · 0.90
_write_moduleFunction · 0.90
_write_indexFunction · 0.90
_write_moduleFunction · 0.90
_render_pageFunction · 0.90
_write_indexFunction · 0.90

Calls 2

quote_yaml_stringFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected