diff --git a/README.md b/README.md index d4fd754..5f7aeae 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Our SDK is designed to supercharge your API experience and accelerate your time to insight. It enables you to efficiently pull the data you need, analyze it, and visualize your findings. -## Parcl Labs Data Overview +### Parcl Labs Data Overview The Parcl Labs API provides **instant insights into the U.S. housing market**, delivering data on housing supply, sales, listings, rentals, investor activities, and market trends. diff --git a/scripts/copy_readme.py b/scripts/copy_readme.py index bd34159..15f689d 100644 --- a/scripts/copy_readme.py +++ b/scripts/copy_readme.py @@ -1,19 +1,31 @@ -import os +FRONT_MATTER = "---\ntitle: Python Library\nslug: python-library-1\n---\n\n" def main(): """ - Copy README.md to README_COPY.md and prepend front matter to the copied file to prepare for readme doc deployment + Create custom README copy that adds front matter and deletes irrelevant fields for readme doc deployment """ input_readme = "README.md" output_file = "README_COPY.md" - os.system(f"cp {input_readme} {output_file}") + with open(input_readme, "r") as file: + readme_lines = file.readlines() - prepend_lines = "---\ntitle: Python Library\nslug: python-library-1\n---\n\n" - with open(output_file, "r+") as file: - content = file.read() - file.seek(0, 0) - file.write(prepend_lines + content) + # remove links + for line in readme_lines: + if line.startswith(("![Logo]", "![GitHub Tag]", "![PyPI - Downloads]")): + readme_lines.remove(line) + + # remove irrelavant sections + readme_content = "".join(readme_lines) + count = 0 + for section in readme_content.split("\n### "): + if section.startswith("Parcl Labs Data Overview"): + full_section = "\n### " + section + readme_content = readme_content.replace(full_section, "") + count += 1 + + with open(output_file, "w") as f: + f.write(FRONT_MATTER + readme_content) if __name__ == "__main__":