diff --git a/.github/workflows/ghpages.yml b/.github/workflows/ghpages.yml index a42c873..42579cf 100644 --- a/.github/workflows/ghpages.yml +++ b/.github/workflows/ghpages.yml @@ -34,7 +34,9 @@ jobs: - name: Build Documentation env: DOCFX_SOURCE_BRANCH_NAME: master - run: .tools/docfx/docfx.exe docs/docfx.json + run: | + .tools/docfx/docfx.exe docs/docfx.json + powershell -ExecutionPolicy ByPass -command "docs\FixApiRefLinks" -Path %~dp0..\artifacts\docs_site\api\ - name: Publish Documentation env: diff --git a/docs/BuildDoc.cmd b/docs/BuildDoc.cmd index ce1c972..84336d3 100644 --- a/docs/BuildDoc.cmd +++ b/docs/BuildDoc.cmd @@ -18,4 +18,8 @@ mkdir %~dp0../artifacts/docs/api .tools\omd\generateomd /source=%~dp0../src/NmeaParser /output=%~dp0../artifacts/docs/api/omd.html /preprocessors=NETSTANDARD1_4;NETSTANDARD REM Build the output site (HTML) from the generated metadata and input files (uses configuration in docfx.json in this folder) -%DocFxFolder%\v%DocFXVersion%\docfx.exe %~dp0\docfx.json -t --serve +REM %DocFxFolder%\v%DocFXVersion%\docfx.exe %~dp0\docfx.json +ECHO Fixing API Reference Links +powershell -ExecutionPolicy ByPass -command "%~dp0FixApiRefLinks.ps1" -Path %~dp0..\artifacts\docs_site\api\ +start http://localhost:8080 +%DocFxFolder%\v%DocFXVersion%\docfx.exe serve %~dp0..\artifacts\docs_site\ \ No newline at end of file diff --git a/docs/FixApiRefLinks.ps1 b/docs/FixApiRefLinks.ps1 new file mode 100644 index 0000000..e3949a9 --- /dev/null +++ b/docs/FixApiRefLinks.ps1 @@ -0,0 +1,14 @@ +[cmdletbinding()] +param([string]$Path) + +function FixApiLinks([string]$path) +{ + $files = Get-ChildItem -Path $path -Recurse -Include *.html + foreach ($file in $files) + { + $content = Get-Content -Path $file + $newContent = $content -replace "../(android|ios|uwp|netcore|netstd|netfx)/", '' + $newContent | Set-Content -Path $file + } +} +FixApiLinks -path $Path \ No newline at end of file