Skip to content

Commit

Permalink
chore(weave): Fix image docgen #2678
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtruong authored Oct 11, 2024
1 parent e10ce15 commit 9ccf0e8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/scripts/generate_notebooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
import tempfile

import nbformat
Expand Down Expand Up @@ -63,6 +64,23 @@ def export_notebook(notebook_path, output_path):

output = extract_meta + make_header(notebook_path) + output

# Fixes image paths by replacing markdown links containing '../docs/' with '/docs/'
pattern = re.compile(
r"""
\(
(
\.\./docs/
.*?
)
\)
""",
re.VERBOSE,
)

replacement = r"(/\1)"

output = pattern.sub(replacement, output)

with open(output_path, "w") as f:
f.write(output)

Expand Down

0 comments on commit 9ccf0e8

Please sign in to comment.