Skip to content

Commit c8bca1d

Browse files
author
Sreeparna Deb
committed
added README content after metadata without the heading line
1 parent 02c87d4 commit c8bca1d

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

scripts/update_plugininfo.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,26 @@ def fetch_contributors():
2828

2929
# ---------- Fetch README content ----------
3030
def fetch_readme_excerpt(lines=5):
31-
"""Return the first `lines` lines from README.md (preserves empty lines)."""
31+
"""Return first `lines` lines from README.md (skipping initial heading)."""
3232
url = f"https://raw.githubusercontent.com/{ORG}/{REPO}/master/README.md"
3333
r = requests.get(url)
3434
if r.status_code != 200:
3535
return ""
36-
content = r.text.splitlines() # no .strip(): keep leading/trailing blanks as they are
37-
return "\n".join(content[:lines])
36+
37+
all_lines = r.text.splitlines()
38+
39+
# Skip the first heading line (starts with '#')
40+
filtered = []
41+
heading_skipped = False
42+
for line in all_lines:
43+
if not heading_skipped and line.strip().startswith("#"):
44+
heading_skipped = True
45+
continue
46+
filtered.append(line)
47+
if len(filtered) >= lines:
48+
break
49+
50+
return "\n".join(filtered)
3851

3952
# ---------- Write output markdown ----------
4053
def write_markdown(info, authors, readme_snippet=""):

0 commit comments

Comments
 (0)