Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JIT compilation to replace relative path ../src with full URL to prepare for docfx #3909

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/publish-docfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
push:
branches: ["main"]
paths: ["docs/**", ".github/workflows/publish-docfx.yml"]

pull_request:
branches: ["main"]
paths: ["docs/**", ".github/workflows/publish-docfx.yml"]
Expand Down Expand Up @@ -42,6 +42,12 @@ jobs:
- run: chmod +x ./scripts/generate-docfx-yml.ps1
- run: ./scripts/generate-docfx-yml.ps1 ./docs
shell: pwsh
- run: chmod +x ./scripts/docfx-replace-url.ps1
shell: pwsh
- run: ./scripts/docfx-replace-url.ps1
shell: pwsh
- run: Set-Item -Path Env:DOCFX_SOURCE_BRANCH_NAME -Value 'main'
shell: pwsh
- run: docfx docfx.json
- run: chmod +x ./scripts/update-docfx-site.ps1
- name: Commit Changes
Expand Down
23 changes: 23 additions & 0 deletions scripts/docfx-replace-url.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Define the custom link to replace "../src"
$customLink = "https://github.com/microsoft/msquic/tree/main/src"

# Get the directory of markdown files from the user input
$dir = "./docs"

# Get all the markdown files in the directory
$files = Get-ChildItem -Path $dir -Filter *.md

# Loop through each file
foreach ($file in $files) {
# Read the file content as a string
$content = Get-Content -Path $file.FullName -Raw

# Replace all occurrences of "../src" with the custom link
$content = $content -replace "\.\./src", $customLink

# Write the modified content back to the file
Set-Content -Path $file.FullName -Value $content
}

# Write a message to indicate the completion of the task
Write-Host "All done!"