Script now looks for a marker ("\n\n# ") in the existing content of the main README.md file. This marker indicates where the subdirectory content begins.
If it finds this marker, it will replace everything after it with the new consolidated content from the subdirectories.
If it doesn't find the marker (which would be the case the first time the script is run), it will append the consolidated content as before.
This approach ensures that:
The original content of the main README.md (before the subdirectory content) is preserved.
The subdirectory content is updated rather than appended each time the script is run.
If there's no existing subdirectory content, it behaves like the original script.
To use this script effectively, make sure that main README.md file has a clear separation between its original content and the content from subdirectories. The script uses the first occurrence of a line starting with "# " (after a blank line) as the marker for where subdirectory content begins.
Script now looks for a marker (
"\n\n# "
) in the existing content of the main README.md file. This marker indicates where the subdirectory content begins.This approach ensures that:
To use this script effectively, make sure that main README.md file has a clear separation between its original content and the content from subdirectories. The script uses the first occurrence of a line starting with "# " (after a blank line) as the marker for where subdirectory content begins.