MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / render_markdown

Function render_markdown

tools/commitlist.py:538–570  ·  view source on GitHub ↗
(
    commits: list[CommitRow], base_ref: str, head_ref: str
)

Source from the content-addressed store, hash-verified

536
537
538def render_markdown(
539 commits: list[CommitRow], base_ref: str, head_ref: str
540) -> str:
541 lines = [
542 '# Release Notes\n\n',
543 f'- Range: `{base_ref}..{head_ref}`\n',
544 f'- Commits: {len(commits)}\n\n',
545 ]
546
547 categories = ordered_values(
548 (commit.category for commit in commits), PR_CATEGORIES
549 )
550 for category in categories:
551 lines.append(f'## {category}\n\n')
552 category_commits = [
553 commit for commit in commits if commit.category == category
554 ]
555 topics = ordered_values(
556 (commit.topic for commit in category_commits), PR_TYPES
557 )
558 for topic in topics:
559 topic_commits = [
560 commit for commit in category_commits if commit.topic == topic
561 ]
562 if not topic_commits:
563 continue
564 lines.append(f'### {topic}\n\n')
565 for commit in topic_commits:
566 lines.append(
567 f'- {markdown_entry_text(commit)} ({get_hash_or_pr_url(commit)})\n'
568 )
569 lines.append('\n')
570 return ''.join(lines)
571
572
573def render_category_markdown(category: str, commits: list[CommitRow]) -> str:

Callers

nothing calls this directly

Calls 5

ordered_valuesFunction · 0.85
markdown_entry_textFunction · 0.85
get_hash_or_pr_urlFunction · 0.85
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected