Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Update readmepart b/c README uses full URLs now (#92)

Akshay Agrawalc486f2f22ae9
diff --git a/docs/helpers/copy_readme.py b/docs/helpers/copy_readme.py
index 36bc38769a..916854e74b 100644
--- a/docs/helpers/copy_readme.py
+++ b/docs/helpers/copy_readme.py
@@ -15,28 +15,34 @@ class ReadmePartDirective(Directive):
# Read and parse the README.md file
current_dir = os.path.dirname(os.path.realpath(__file__))
- readme = os.path.join(current_dir, '..', '..', 'README.md')
- with open(readme, 'r') as file:
+ readme = os.path.join(current_dir, "..", "..", "README.md")
+ with open(readme, "r") as file:
content = file.read()
# Find the header
- header_pattern = r'#{1,6} ' + re.escape(header)
+ header_pattern = r"#{1,6} " + re.escape(header)
match = re.search(header_pattern, content, re.IGNORECASE)
if not match:
return []
- level = match.group(0).count('#')
- next_header_with_same_level = r'\n#{' + str(level) + r'} '
- next_match = re.search(next_header_with_same_level, content[match.end():], re.IGNORECASE)
+ level = match.group(0).count("#")
+ next_header_with_same_level = r"\n#{" + str(level) + r"} "
+ next_match = re.search(
+ next_header_with_same_level, content[match.end() :], re.IGNORECASE
+ )
- stripped_content = ''
+ stripped_content = ""
if match:
# Extract everything below the header, up to the next header
if next_match and next_match.group(0):
- stripped_content = content[match.end():match.end() + next_match.start()].strip()
+ stripped_content = content[
+ match.end() : match.end() + next_match.start()
+ ].strip()
else:
- stripped_content = content[match.end():].strip()
+ stripped_content = content[match.end() :].strip()
# Update asset links, add a leading slash if needed
- stripped_content = stripped_content.replace("/docs/_static/", "/_static/").replace("docs/_static/", "/_static/")
+ stripped_content = re.sub(
+ r"https.*?docs/_static", "/_static", stripped_content
+ )
Parser().parse(stripped_content, self.state.document)
return []