Skip to content

Commit

Permalink
fix: PDF wait for network idle (#9542)
Browse files Browse the repository at this point in the history
* fix: PDF wait for network idle

* test(snapshot): update snapshots d803445 for windows-latest

---------

Co-authored-by: yufeih <yufeih@users.noreply.github.com>
  • Loading branch information
yufeih and yufeih authored Dec 18, 2023
1 parent 4252c0f commit a58192e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/Docfx.App/PdfBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ IResult TocPage(string url)

await page.AddScriptTagAsync(new() { Content = EnsureHeadingAnchorScript });
await page.WaitForFunctionAsync("!window.docfx || window.docfx.ready");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);

return await page.PdfAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,51 +216,59 @@
"PageNumber": 16,
"Coordinates": {
"Left": 28,
"Top": 552.50006
"Top": 211.24994
}
}
}
]
},
{
"Number": 15,
"Text": "15ImageMermaid DiagramsFlowchartCode SnippetThe example highlights lines 2, line 5 to 7 and lines 9 to the end of the file.MY TODOThis is a TODO.TextOneTwoHardRoundDecisionResult 1Result 2using System;using Azure;using Azure.Storage;using Azure.Storage.Blobs;class Program{ static void Main(string[] args) { // Define the connection string for the storage account string connectionString = \"DefaultEndpointsProtocol=https;AccountName=<your-account-name>;AccountKey=<your-account-key>;EndpointSuffix=core.windows.net\"; // Create a new BlobServiceClient using the connection string var blobServiceClient = new BlobServiceClient(connectionString); // Create a new container var container = blobServiceClient.CreateBlobContainer(\"mycontainer\"); // Upload a file to the container using (var fileStream = File.OpenRead(\"path/to/file.txt\"))",
"Links": []
"NumberOfImages": 1,
"Text": "15ImageMermaid DiagramsFlowchartCode SnippetThe example highlights lines 2, line 5 to 7 and lines 9 to the end of the file.MY TODOThis is a TODO.TextOneTwoHardRoundDecisionResult 1Result 2",
"Links": [
{
"Uri": "https://learn.microsoft.com/en-us/media/learn/not-found/learn-not-found-light-mode.png?branch=main"
},
{
"Uri": "https://learn.microsoft.com/en-us/media/learn/not-found/learn-not-found-light-mode.png?branch=main"
}
]
},
{
"Number": 16,
"Text": "16Math ExpressionsThis sentence uses $ delimiters to show math inline: The Cauchy-Schwarz InequalityThis expression uses \\$ to display a dollar sign: To split $100 in half, we calculate Custom Syntax HighlightingTabsLinuxWindowsThe above tab group was created with the following syntax: { container.UploadBlob(\"file.txt\", fileStream); } // Download the file from the container var downloadedBlob = container.GetBlobClient(\"file.txt\").Download(); using (var fileStream = File.OpenWrite(\"path/to/downloaded-file.txt\")) { downloadedBlob.Value.Content.CopyTo(fileStream); } }}resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = { name: 'hello' // (...)}Content for Linux...# [Linux](#tab/linux)",
"Text": "16Math ExpressionsThis sentence uses $ delimiters to show math inline: The Cauchy-Schwarz InequalityThis expression uses \\$ to display a dollar sign: To split $100 in half, we calculate using System;using Azure;using Azure.Storage;using Azure.Storage.Blobs;class Program{ static void Main(string[] args) { // Define the connection string for the storage account string connectionString = \"DefaultEndpointsProtocol=https;AccountName=<your-account-name>;AccountKey=<your-account-key>;EndpointSuffix=core.windows.net\"; // Create a new BlobServiceClient using the connection string var blobServiceClient = new BlobServiceClient(connectionString); // Create a new container var container = blobServiceClient.CreateBlobContainer(\"mycontainer\"); // Upload a file to the container using (var fileStream = File.OpenRead(\"path/to/file.txt\")) { container.UploadBlob(\"file.txt\", fileStream); } // Download the file from the container var downloadedBlob = container.GetBlobClient(\"file.txt\").Download(); using (var fileStream = File.OpenWrite(\"path/to/downloaded-file.txt\")) { downloadedBlob.Value.Content.CopyTo(fileStream); } }}",
"Links": []
},
{
"Number": 17,
"Text": "17Custom Syntax HighlightingTabsLinuxWindowsThe above tab group was created with the following syntax:Tabs are indicated by using a specific link syntax within a Markdown header. The syntax can be describedas follows:A tab starts with a Markdown header, #, and is followed by a Markdown link [](). The text of the link willbecome the text of the tab header, displayed to the customer. In order for the header to be recognizedas a tab, the link itself must start with #tab/ and be followed by an ID representing the content of thetab. The ID is used to sync all same-ID tabs across the page. Using the above example, when a userselects a tab with the link #tab/windows, all tabs with the link #tab/windows on the page will be selected.Dependent tabsIt's possible to make the selection in one set of tabs dependent on the selection in another set of tabs.Here's an example of that in action:resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = { name: 'hello' // (...)}Content for Linux...# [Linux](#tab/linux)Content for Linux...# [Windows](#tab/windows)Content for Windows...---# [Tab Display Name](#tab/tab-id)",
"Links": [
{
"Goto": {
"PageNumber": 16,
"PageNumber": 17,
"Coordinates": {
"Left": 28,
"Top": 181.24994
"Top": 574.99994
}
}
}
]
},
{
"Number": 17,
"Text": "17Tabs are indicated by using a specific link syntax within a Markdown header. The syntax can be describedas follows:A tab starts with a Markdown header, #, and is followed by a Markdown link [](). The text of the link willbecome the text of the tab header, displayed to the customer. In order for the header to be recognizedas a tab, the link itself must start with #tab/ and be followed by an ID representing the content of thetab. The ID is used to sync all same-ID tabs across the page. Using the above example, when a userselects a tab with the link #tab/windows, all tabs with the link #tab/windows on the page will be selected.Dependent tabsIt's possible to make the selection in one set of tabs dependent on the selection in another set of tabs.Here's an example of that in action:.NETTypeScriptREST APINotice how changing the Linux/Windows selection above changes the content in the .NET andTypeScript tabs. This is because the tab group defines two versions for each .NET and TypeScript, wherethe Windows/Linux selection above determines which version is shown for .NET/TypeScript. Here's themarkup that shows how this is done:Content for Linux...# [Windows](#tab/windows)Content for Windows...---# [Tab Display Name](#tab/tab-id).NET content for Linux...# [.NET](#tab/dotnet/linux).NET content for Linux...# [.NET](#tab/dotnet/windows).NET content for Windows...",
"Number": 18,
"Text": "18.NETTypeScriptREST APINotice how changing the Linux/Windows selection above changes the content in the .NET andTypeScript tabs. This is because the tab group defines two versions for each .NET and TypeScript, wherethe Windows/Linux selection above determines which version is shown for .NET/TypeScript. Here's themarkup that shows how this is done:DetailsDemo.NET content for Linux...# [.NET](#tab/dotnet/linux).NET content for Linux...# [.NET](#tab/dotnet/windows).NET content for Windows...# [TypeScript](#tab/typescript/linux)TypeScript content for Linux...# [TypeScript](#tab/typescript/windows)TypeScript content for Windows...# [REST API](#tab/rest)REST API content, independent of platform...---",
"Links": [
{
"Goto": {
"PageNumber": 17,
"PageNumber": 18,
"Coordinates": {
"Left": 28,
"Top": 324.49994
"Top": 732.49994
}
}
}
]
},
{
"Number": 18,
"Text": "18DetailsDemo# [TypeScript](#tab/typescript/linux)TypeScript content for Linux...# [TypeScript](#tab/typescript/windows)TypeScript content for Windows...# [REST API](#tab/rest)REST API content, independent of platform...---",
"Links": []
}
],
"Bookmarks": [
Expand Down

0 comments on commit a58192e

Please sign in to comment.