Skip to content

Commit 56b7b86

Browse files
committed
remove .md extension from relative links in Jekyll export
1 parent 30cb7e2 commit 56b7b86

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

scripts/docs_exporter/export_to_docs_website.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def process_file(source_file, target_file, parent=None, nav_order=1):
3939
r'```\1\n\2```\n{% include copy.html %}',
4040
content, flags=re.MULTILINE | re.DOTALL)
4141

42+
# Remove .md extension from relative links (keep http/https links unchanged)
43+
content = re.sub(r'\]\((?!https?://)(.*?)\.md(#[^\)]*)?\)', r'](\1\2)', content)
44+
4245
title = extract_title(content) or source_file.stem.replace('-', ' ').title()
4346

4447
# Check if this directory has child markdown files in subdirectories

0 commit comments

Comments
 (0)