MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / generate_mdx_content

Function generate_mdx_content

examples/generate_documentation.py:118–150  ·  view source on GitHub ↗

Generate MDX content with either provided or generated frontmatter.

(notebook_path, processed_content, frontmatter=None)

Source from the content-addressed store, hash-verified

116
117
118def generate_mdx_content(notebook_path, processed_content, frontmatter=None):
119 """Generate MDX content with either provided or generated frontmatter."""
120 if not frontmatter:
121 # Generate new frontmatter
122 folder_name = Path(notebook_path).parent.name
123
124 # Check for title override, otherwise use default title case conversion
125 if folder_name in TITLE_OVERRIDES:
126 base_title = TITLE_OVERRIDES[folder_name]
127 else:
128 base_title = folder_name.replace("_", " ").title()
129
130 title = f"{base_title}"
131
132 # Extract description from first heading or use default
133 description = f"{title} example using AgentOps"
134 for line in processed_content.split("\n"):
135 if line.startswith("# ") and len(line) > 2:
136 description = line[2:].strip()
137 break
138
139 frontmatter = f"title: '{title}'\ndescription: '{description}'"
140
141 return f"""---
142{frontmatter}
143---
144{{/* SOURCE_FILE: {notebook_path} */}}
145
146_View Notebook on <a href={{'https://github.com/AgentOps-AI/agentops/blob/main/{notebook_path}'}} target={{'_blank'}}>Github</a>_
147
148{processed_content}
149
150{SCRIPT_TAGS}"""
151
152
153def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…