Skip to content

Commit c4ab5f5

Browse files
authored
fix: Work around lazydocs inline code fence bug (#1952)
1 parent 9baa5cf commit c4ab5f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/reference-generation/weave/generate_python_sdk_docs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ def generate_module_docs(module, module_name: str, src_root_path: str, version:
262262
# These appear as standalone lines with just dashes (------) which break markdown parsing
263263
content = re.sub(r'\n\s*------+\s*\n', '\n\n', content)
264264

265+
# Fix lazydocs bug: inline code fences in Examples sections
266+
# lazydocs incorrectly wraps text after colons (like "Basic usage:") with inline backticks
267+
# Pattern: " text: ``` code```" should be "text:\n```python\ncode"
268+
# This happens when lazydocs misapplies _RE_ARGSTART in Examples sections
269+
content = re.sub(r'^ ([\w\s]+): ``` (.*?)```\n( >>> )', r' \1:\n\n```python\n\2\n\3', content, flags=re.MULTILINE)
270+
265271
# Fix parameter lists that have been broken by lazydocs
266272
# Strategy: Parse all parameters into a structured format, then reconstruct them properly
267273
def fix_parameter_lists(text):

0 commit comments

Comments
 (0)