Skip to content

Commit 9926dc5

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix-issue-10385
2 parents 211a672 + 3ff9ae7 commit 9926dc5

File tree

12 files changed

+1858
-3419
lines changed

12 files changed

+1858
-3419
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<!-- Test only -->
4242
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
4343
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
44-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
44+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
4545
<PackageVersion Include="Verify.DiffPlex" Version="3.1.2" />
4646
<PackageVersion Include="Verify.Xunit" Version="28.3.2" />
4747
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />

Dockerfile

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0-noble
22

33
# Add dotnet tools to path.
44
ENV PATH="${PATH}:/root/.dotnet/tools"
55

6+
# Set Node.js path
7+
ENV PLAYWRIGHT_NODEJS_PATH="/usr/bin/node"
8+
69
# Set target docfx version.
7-
ARG DOCFX_VERSION=2.77.0
10+
ARG DOCFX_VERSION=2.78.1
811

912
# Install DocFX as a dotnet tool.
1013
RUN dotnet tool install docfx -g --version ${DOCFX_VERSION} && \
1114
docfx --version && \
1215
rm -f /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/docfx.nupkg && \
1316
rm -f /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/docfx.${DOCFX_VERSION}.nupkg && \
14-
rm -rf /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/tools/net6.0
15-
16-
# Install Node.js and dependences for chromium PDF.
17-
RUN apt-get update -qq && \
18-
apt-get install -y -qq --no-install-recommends \
19-
nodejs \
20-
libglib2.0-0 libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
21-
libdbus-1-3 libxcb1 libxkbcommon0 libatspi2.0-0 libx11-6 libxcomposite1 libxdamage1 \
22-
libxext6 libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 && \
23-
rm -rf /var/lib/apt/lists/* /tmp/*
17+
rm -rf /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/tools/net9.0
2418

25-
# Install Chromium.
26-
RUN PLAYWRIGHT_NODEJS_PATH="/usr/bin/node" && \
27-
ln -s /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/tools/.playwright /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/tools/net8.0/any/.playwright && \
28-
pwsh -File /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/tools/net8.0/any/playwright.ps1 install chromium && \
29-
unlink /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/tools/net8.0/any/.playwright
19+
# Install Node.js and browser(chromium) with dependencies
20+
RUN apt-get install -y -qq --update --no-install-recommends nodejs && \
21+
pwsh -File /root/.dotnet/tools/.store/docfx/${DOCFX_VERSION}/docfx/${DOCFX_VERSION}/tools/net8.0/any/playwright.ps1 install --with-deps chromium && \
22+
rm -rf /var/lib/apt/lists/* && \
23+
rm -rf /tmp/*
3024

3125
WORKDIR /opt/prj
3226
VOLUME [ "/opt/prj" ]

src/Docfx.App/PdfBuilder.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ async Task MergePdf()
357357
if (!pageBytes.TryGetValue(node, out var bytes))
358358
continue;
359359

360+
var isCoverPage = url.AbsolutePath.TrimStart('/').Equals(outline.pdfCoverPage, GetStringComparison());
361+
360362
var isTocPage = IsTocPage(url);
361363
if (isTocPage)
362364
{
@@ -375,6 +377,9 @@ async Task MergePdf()
375377

376378
var pageBuilder = builder.AddPage(document, i, x => CopyLink(node, x));
377379

380+
if (isCoverPage)
381+
continue;
382+
378383
if (isTocPage)
379384
continue;
380385

@@ -615,4 +620,12 @@ static string getMillimeter(double pt)
615620
return $"{Math.Round(pt * MillimeterPerInch / Dpi)}mm";
616621
}
617622
}
623+
624+
// Gets StringComparison instance for path string.
625+
private static StringComparison GetStringComparison()
626+
{
627+
return PathUtility.IsPathCaseInsensitive()
628+
? StringComparison.OrdinalIgnoreCase
629+
: StringComparison.Ordinal;
630+
}
618631
}

src/Docfx.Dotnet/SymbolUrlResolver.SourceLink.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,15 @@ public SourceLinkProvider(PEReader peReader, MetadataReaderProvider pdbReaderPro
8989
private string? TryGetSourceLinkUrl(DocumentHandle handle)
9090
{
9191
var document = _pdbReader.GetDocument(handle);
92-
if (document.Name.IsNil)
92+
try
93+
{
94+
if (document.Name.IsNil)
95+
return null;
96+
}
97+
catch (BadImageFormatException)
98+
{
9399
return null;
100+
}
94101

95102
var documentName = _pdbReader.GetString(document.Name);
96103
if (documentName is null)

templates/modern/src/docfx.scss

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
* The .NET Foundation licenses this file to you under the MIT license.
44
*/
55

6-
$enable-important-utilities: false;
7-
$container-max-widths: (
8-
xxl: 1768px
9-
) !default;
10-
116
@use "mixins";
12-
@use "bootstrap/scss/bootstrap";
7+
@use "bootstrap/scss/bootstrap" with (
8+
$container-max-widths: (
9+
xxl: 1768px
10+
)
11+
);
1312
@use "highlight";
1413
@use "layout";
1514
@use "nav";

templates/package-lock.json

Lines changed: 48 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@
4141
},
4242
"devDependencies": {
4343
"@types/lunr": "^2.3.7",
44-
"@typescript-eslint/eslint-plugin": "^8.15.0",
45-
"@typescript-eslint/parser": "^8.15.0",
44+
"@typescript-eslint/eslint-plugin": "^8.16.0",
45+
"@typescript-eslint/parser": "^8.16.0",
4646
"browser-sync": "^3.0.3",
4747
"esbuild": "~0.24.0",
4848
"esbuild-sass-plugin": "~3.3.1",
4949
"eslint": "^8.57.1",
5050
"eslint-config-standard": "^17.1.0",
5151
"stylelint": "^16.10.0",
5252
"stylelint-config-standard-scss": "^13.1.0",
53-
"typescript": "^5.6.3",
53+
"typescript": "^5.7.2",
5454
"yargs": "^17.7.2"
5555
}
5656
}

0 commit comments

Comments
 (0)