From 54376c9fa7c6e963162dd9530c71133ffd51f50a Mon Sep 17 00:00:00 2001 From: Yufei Huang Date: Mon, 18 Dec 2023 16:54:45 +0800 Subject: [PATCH 1/2] fix: PDF wait for network idle --- src/Docfx.App/PdfBuilder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Docfx.App/PdfBuilder.cs b/src/Docfx.App/PdfBuilder.cs index ef43faf85c6..5b37c1a5e8c 100644 --- a/src/Docfx.App/PdfBuilder.cs +++ b/src/Docfx.App/PdfBuilder.cs @@ -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(); } From f4c491d69d2759312af3bcb3acae948f2470e528 Mon Sep 17 00:00:00 2001 From: yufeih Date: Mon, 18 Dec 2023 09:03:04 +0000 Subject: [PATCH 2/2] test(snapshot): update snapshots d803445f1a2e63a59dc47c78d6c73dd47f83bf2f for windows-latest --- .../articles/seed.pdf.verified.json | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/test/docfx.Snapshot.Tests/SamplesTest.Seed.Windows/articles/seed.pdf.verified.json b/test/docfx.Snapshot.Tests/SamplesTest.Seed.Windows/articles/seed.pdf.verified.json index d3a8769057c..bba9510958f 100644 --- a/test/docfx.Snapshot.Tests/SamplesTest.Seed.Windows/articles/seed.pdf.verified.json +++ b/test/docfx.Snapshot.Tests/SamplesTest.Seed.Windows/articles/seed.pdf.verified.json @@ -216,7 +216,7 @@ "PageNumber": 16, "Coordinates": { "Left": 28, - "Top": 552.50006 + "Top": 211.24994 } } } @@ -224,43 +224,51 @@ }, { "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=;AccountKey=;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=;AccountKey=;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": [