diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 73542b3a..216250fb 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -52,6 +52,7 @@ jobs: --exclude-path docs/hi \ --exclude-path docs/ar \ --github-token ${{ secrets.GITHUB_TOKEN }} \ + --header "User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.183 Safari/537.36" \ './**/*.md' \ './**/*.html' @@ -82,6 +83,7 @@ jobs: --exclude-path docs/hi \ --exclude-path docs/ar \ --github-token ${{ secrets.GITHUB_TOKEN }} \ + --header "User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.183 Safari/537.36" \ './**/*.md' \ './**/*.html' \ './**/*.yml' \ diff --git a/docs/build_docs.py b/docs/build_docs.py index 67ec5bd1..a6fd39b0 100644 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -192,7 +192,11 @@ def convert_plaintext_links_to_html(content): for paragraph in main_content.find_all(["p", "li"]): # Focus on paragraphs and list items for text_node in paragraph.find_all(string=True, recursive=False): if text_node.parent.name not in {"a", "code"}: # Ignore links and code blocks - new_text = re.sub(r"(https?://\S+?)(?=[,.!?;:]?\s|[,.!?;:]?$)", r'\1', str(text_node)) + new_text = re.sub( + r'(https?://[^\s\'")]+)(?=[,.!?;:]?(?:\s|$)|[\'")])', + r'\1', + str(text_node), + ) if "