Skip to content

Commit 71f1f7f

Browse files
committed
📝 Update contributing.md and add it to the docs, also add credits and contact to the docs
1 parent fa391a9 commit 71f1f7f

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

‎docs/index.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ sections_readme/execution
1717
sections_readme/gui
1818
sections_readme/case_studies
1919
sections_readme/web_app_deploy
20+
sections_readme/contributing
2021
sections_readme/citation
22+
sections_readme/credits
23+
sections_readme/contact
2124
```
2225

2326
```{toctree}

‎docs/split_readme.py‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"Web application deployment": "web_app_deploy.md",
1313
"Citation": "citation.md",
1414
"Credits and acknowledgements": "credits.md",
15+
"Contact and feedback": "contact.md",
1516
}
1617

1718

@@ -66,6 +67,22 @@ def decrease_header_levels(content):
6667
return "\n".join(new_lines)
6768

6869

70+
def clean_trailing_links(content):
71+
"""Remove trailing links and clean up extra empty lines."""
72+
# Remove [label]: link style
73+
content = re.sub(r"^\[.+?\]:\s+\S+$", "", content, flags=re.MULTILINE)
74+
# Remove (url): url style
75+
content = re.sub(
76+
r"^\(https?://[^\s)]+\):\s*https?://[^\s)]+$", "", content, flags=re.MULTILINE
77+
)
78+
content = re.sub(
79+
r"^\(mailto:[^\s)]+\):\s*mailto:[^\s)]+$", "", content, flags=re.MULTILINE
80+
)
81+
# Remove empty lines
82+
content = re.sub(r"\n{2,}", "\n\n", content).strip()
83+
return content
84+
85+
6986
def process_readme(readme_path, output_dir):
7087
readme = Path(readme_path).read_text()
7188

@@ -81,12 +98,32 @@ def process_readme(readme_path, output_dir):
8198
myst_content = (
8299
f"## {section_title}\n\n{convert_gfm_to_sphinx(content, links)}"
83100
)
101+
if filename.lower() == "contact.md":
102+
myst_content = clean_trailing_links(myst_content)
84103
myst_content = decrease_header_levels(myst_content)
85104
(output_dir / filename).write_text(myst_content)
86105
print(f"Generated {filename}")
87106
else:
88107
print(f"Warning: Section '{section_title}' not found in README")
89108

109+
# Include CONTRIBUTING.md with its own link references
110+
contrib_path = readme_path.parent / "CONTRIBUTING.md"
111+
if contrib_path.exists():
112+
raw_contrib = contrib_path.read_text()
113+
contrib_links = extract_links_from_readme(raw_contrib)
114+
115+
# Convert content
116+
contrib_converted = convert_gfm_to_sphinx(raw_contrib, contrib_links)
117+
118+
# Remove trailing link definitions
119+
contrib_converted = clean_trailing_links(contrib_converted)
120+
121+
# Write output
122+
(output_dir / "contributing.md").write_text(contrib_converted)
123+
print("Generated contributing.md")
124+
else:
125+
print("Warning: CONTRIBUTING.md not found")
126+
90127

91128
if __name__ == "__main__":
92129
default_readme = Path(__file__).resolve().parent.parent / "README.md"

0 commit comments

Comments
 (0)