Skip to content

Commit 8178a85

Browse files
committed
fix: list formatting issue
1 parent 6ac8d3c commit 8178a85

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/exporter.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,11 @@ def _format_repo(self, repo: Repository) -> str:
7878
desc = repo.description[:self.max_description_length]
7979
if len(repo.description) > self.max_description_length:
8080
desc += "..."
81-
parts.append(f"- {desc}")
81+
if not self.compact_mode:
82+
parts.append(f"- {desc}")
8283

83-
if self.compact_mode:
84-
return " ".join(parts)
85-
else:
86-
return f"- {' '.join(parts)}"
84+
# Always include "- " prefix for proper markdown list rendering
85+
return f"- {' '.join(parts)}"
8786

8887
def _format_category(self, category: Category) -> list[str]:
8988
"""Format a category and its repos."""
@@ -360,11 +359,16 @@ def update_readme(
360359
)
361360
return False
362361

363-
# Replace content between tags
364-
replacement = f"{START_TAG}\n\n{content}\n\n{END_TAG}"
362+
# Replace content between tags using string methods (avoids regex escaping issues)
365363
start_idx = readme_content.find(START_TAG)
366364
end_idx = readme_content.find(END_TAG) + len(END_TAG)
367-
new_content = readme_content[:start_idx] + replacement + readme_content[end_idx:]
365+
366+
if start_idx == -1 or end_idx == -1:
367+
logger.error("Could not find placeholder tags positions")
368+
return False
369+
370+
replacement = f"{START_TAG}\n\n{content}\n\n{END_TAG}"
371+
new_content = readme_content[:start_idx] + replacement + readme_content[end_idx:]
368372

369373
# Write updated README
370374
readme_path.write_text(new_content, encoding="utf-8")
@@ -412,4 +416,4 @@ def create_placeholder_readme(output_path: str | Path) -> Path:
412416
output_path.write_text(template, encoding="utf-8")
413417

414418
logger.info(f"Created template README at {output_path}")
415-
return output_path
419+
return output_path

0 commit comments

Comments
 (0)