mirror of
https://github.com/hwchase17/langchain.git
synced 2025-12-02 23:55:31 +00:00
docs: turn on link check (#18924)
This commit is contained in:
21
docs/scripts/resolve_local_links.py
Normal file
21
docs/scripts/resolve_local_links.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
DOCS_DIR = Path(os.path.abspath(__file__)).parents[1]
|
||||
|
||||
|
||||
def update_links(doc_path, docs_link):
|
||||
with open(DOCS_DIR / doc_path, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
# replace relative links
|
||||
content = re.sub("\]\(\.\/", f"]({docs_link}", content)
|
||||
|
||||
with open(DOCS_DIR / doc_path, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
update_links(sys.argv[1], sys.argv[2])
|
||||
Reference in New Issue
Block a user