Skip to content

Commit 4e9e8f8

Browse files
authored
Fix the missing API Reference Table of Contents (#243)
1 parent 8a56a50 commit 4e9e8f8

7 files changed

Lines changed: 135 additions & 17 deletions

File tree

.github/workflows/main.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,24 @@ jobs:
4242
- name: Restore dotnet tools
4343
run: dotnet tool restore
4444

45+
- name: Run Metadata Build
46+
run: dotnet docfx metadata ci.docfx.json
47+
4548
- name: Run Build
46-
run: dotnet docfx ci.docfx.json
49+
run: dotnet docfx build ci.docfx.json
50+
51+
- name: Create PDF build folder
52+
run: |
53+
mkdir -p _pdf
4754
4855
- name: Generate PDF
49-
run: dotnet docfx pdf ci.docfx.json
56+
run: dotnet docfx pdf docfx.pdf.json --output _pdf
5057

5158
- name: Copy PDF to downloads and clean up
5259
run: |
5360
mkdir -p _site/downloads
54-
cp _site/pdf/MonoGameGuide.pdf _site/downloads/
55-
rm -rf _site/pdf
61+
cp _pdf/pdf/MonoGameGuide.pdf _site/downloads/
62+
rm -rf _pdf
5663
5764
- name: Setup Pages
5865
uses: actions/configure-pages@v5

build.ps1

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,22 @@ if (-not (Test-Path $FrameworkDll) -or -not (Test-Path $PipelineDll)) {
1919

2020
# Build documentation
2121
Write-Host "Building DocFx..." -ForegroundColor Green
22-
dotnet docfx docfx.json
22+
dotnet docfx metadata docfx.json
2323

24-
# Generate PDF
24+
# Build documentation
25+
Write-Host "Building DocFx..." -ForegroundColor Green
26+
dotnet docfx build docfx.json
27+
28+
New-Item -ItemType Directory -Force -Path "_pdf" | Out-Null
29+
30+
# Generate PDF (using PDF-specific config that includes pdf/** files)
2531
Write-Host "Generating PDF..." -ForegroundColor Green
26-
dotnet docfx pdf docfx.json
32+
dotnet docfx pdf docfx.pdf.json --output _pdf
2733

2834
# Copy PDF to downloads folder and clean up
2935
Write-Host "Copying PDF to downloads folder..." -ForegroundColor Green
3036
New-Item -ItemType Directory -Force -Path "_site/downloads" | Out-Null
31-
Copy-Item "_site/pdf/MonoGameGuide.pdf" "_site/downloads/"
32-
Remove-Item -Path "_site/pdf" -Recurse -Force
37+
Copy-Item "_pdf/pdf/MonoGameGuide.pdf" "_site/downloads/"
38+
Remove-Item -Path "_pdf" -Recurse -Force
3339

3440
Write-Host "Build and documentation generation completed successfully!" -ForegroundColor Green

build.sh

100644100755
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,25 @@ if [ ! -f "$FRAMEWORK_DLL" ] || [ ! -f "$PIPELINE_DLL" ]; then
1717
dotnet build external/MonoGame/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj -p:DisableNativeBuild=true
1818
fi
1919

20+
# Build documentation
21+
echo "Building DocFx..."
22+
dotnet docfx metadata docfx.json
23+
2024
# Build documentation
2125
echo "Building DocFx..."
2226
dotnet docfx docfx.json
2327

24-
# Generate PDF
28+
mkdir -p _pdf
29+
30+
# Generate PDF (using PDF-specific config that includes pdf/** files)
2531
echo "Generating PDF..."
26-
dotnet docfx pdf docfx.json
32+
dotnet docfx build docfx.pdf.json --output _pdf
33+
dotnet docfx pdf docfx.pdf.json --output _pdf
2734

2835
# Copy PDF to downloads folder and clean up
2936
echo "Copying PDF to downloads folder..."
3037
mkdir -p _site/downloads
31-
cp _site/pdf/MonoGameGuide.pdf _site/downloads/
32-
rm -rf _site/pdf
38+
cp _pdf/pdf/MonoGameGuide.pdf _site/downloads/
39+
rm -rf _pdf
3340

3441
echo "Build and documentation generation completed successfully!"

docfx.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
"roadmap/**/*.md",
4343
"roadmap/**/*.yml",
4444
"errors/**/*.md",
45-
"pdf/**/*.md",
46-
"pdf/**/*.yml",
4745
"toc.yml",
4846
"*.md"
4947
],

docfx.pdf.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"metadata": [
3+
{
4+
"src": [
5+
{
6+
"files": [
7+
"external/MonoGame/Artifacts/MonoGame.Framework/DesktopGL/Debug/MonoGame.Framework.dll",
8+
"external/MonoGame/Artifacts/MonoGame.Framework.Content.Pipeline/Debug/MonoGame.Framework.Content.Pipeline.dll"
9+
]
10+
}
11+
],
12+
"dest": "api",
13+
"filter": "filterConfig.yml",
14+
"includePrivateMembers": false,
15+
"disableGitFeatures": false,
16+
"disableDefaultFilter": false,
17+
"noRestore": false,
18+
"namespaceLayout": "flattened",
19+
"memberLayout": "samePage",
20+
"EnumSortOrder": "alphabetic"
21+
}
22+
],
23+
"rules": {
24+
"InvalidFileLink": "error",
25+
"InvalidBookmark": "error",
26+
"UidNotFound": "error",
27+
"ReferencedXrefPropertyNotString": "error"
28+
},
29+
"build": {
30+
"content": [
31+
{
32+
"files": [
33+
"api/**/*.yml",
34+
"api/**/*.md"
35+
]
36+
},
37+
{
38+
"files": [
39+
"articles/**/*.md",
40+
"articles/**/*.yml",
41+
"foundation/**/*.md",
42+
"roadmap/**/*.md",
43+
"roadmap/**/*.yml",
44+
"errors/**/*.md",
45+
"pdf/**/*.md",
46+
"pdf/**/*.yml",
47+
"toc.yml",
48+
"*.md"
49+
],
50+
"exclude": [ "_site/**", "README.md" ]
51+
}
52+
],
53+
"resource": [
54+
{
55+
"files": [
56+
"**/images/**",
57+
"**/videos/**",
58+
"**/files/**",
59+
"**/snippets/**",
60+
"**/*.docx",
61+
"CNAME"
62+
]
63+
}
64+
],
65+
"output": "_site",
66+
"globalMetadata": {
67+
"_appLogoUrl": "https://monogame.net",
68+
"_appFaviconPath": "/images/favicon.png",
69+
"_disableBreadcrumb": "true",
70+
"_appFooter": "Copyright © 2009-2026 MonoGame Foundation, Inc.",
71+
"_hostname": "monogame.net",
72+
"_openGraphImage": "images/social_embed_image.png",
73+
"_description": "One framework for creating powerful cross-platform games.",
74+
"_appTitle": "MonoGame",
75+
"_enableSearch": true,
76+
"pdfFooterTemplate": "<div style='width: 100%; font-size: 11px; font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-serif; border-top: 2px solid #e73c00; padding: 8px 20px 0 20px; display: flex; justify-content: space-between; align-items: center;'><span style='color: #e73c00; font-weight: 600;'>MonoGame Complete Reference Guide</span><span style='color: #666;'>Page <span class='pageNumber'></span> of <span class='totalPages'></span></span></div>"
77+
},
78+
"template": [
79+
"default",
80+
"modern",
81+
"templates/monogame"
82+
],
83+
"markdownEngineProperties": {
84+
"markdigExtensions": [
85+
"Abbreviations",
86+
"Figures",
87+
"CustomContainers",
88+
"attributes"
89+
]
90+
},
91+
"postProcessors": [],
92+
"keepFileLink": false,
93+
"disableGitFeatures": false,
94+
"sitemap": {
95+
"baseUrl": "https://docs.monogame.net/",
96+
"priority": 0.1,
97+
"changefreq": "monthly"
98+
}
99+
}
100+
}

serve.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ $ErrorActionPreference = "Stop"
55
.\build.ps1
66

77
# Start DocFx serve
8-
dotnet docfx docfx.json --serve
8+
dotnet docfx serve .\_site

serve.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ set -e
66
./build.sh
77

88
# Start DocFx serve
9-
dotnet docfx docfx.json --serve
9+
dotnet docfx serve _site

0 commit comments

Comments
 (0)