mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 01:48:05 +00:00
Support multi-line YAML formatting in index docs
Signed-off-by: thepetk <thepetk@gmail.com>
This commit is contained in:
parent
a1ff4984e6
commit
5f02620a97
1 changed files with 10 additions and 2 deletions
|
|
@ -390,8 +390,16 @@ def generate_index_docs(
|
||||||
# Add YAML frontmatter for index
|
# Add YAML frontmatter for index
|
||||||
md_lines.append("---")
|
md_lines.append("---")
|
||||||
if api_docstring:
|
if api_docstring:
|
||||||
clean_desc = api_docstring.strip().replace('"', '\\"')
|
# Handle multi-line descriptions in YAML
|
||||||
md_lines.append(f'description: "{clean_desc}"')
|
if "\n" in api_docstring.strip():
|
||||||
|
md_lines.append("description: |")
|
||||||
|
for line in api_docstring.strip().split("\n"):
|
||||||
|
# Avoid trailing whitespace by only adding spaces to non-empty lines
|
||||||
|
md_lines.append(f" {line}" if line.strip() else "")
|
||||||
|
else:
|
||||||
|
# For single line descriptions, format properly for YAML
|
||||||
|
clean_desc = api_docstring.strip().replace('"', '\\"')
|
||||||
|
md_lines.append(f'description: "{clean_desc}"')
|
||||||
md_lines.append(f"sidebar_label: {sidebar_label}")
|
md_lines.append(f"sidebar_label: {sidebar_label}")
|
||||||
md_lines.append(f"title: {api_name.title()}")
|
md_lines.append(f"title: {api_name.title()}")
|
||||||
md_lines.append("---")
|
md_lines.append("---")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue