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,6 +390,14 @@ def generate_index_docs(
|
|||
# Add YAML frontmatter for index
|
||||
md_lines.append("---")
|
||||
if api_docstring:
|
||||
# Handle multi-line descriptions in YAML
|
||||
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}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue