From 8c81b9c133ae3cbbd025dc172107df253855be47 Mon Sep 17 00:00:00 2001 From: Whitney Shake Date: Wed, 3 Apr 2024 12:36:18 -0700 Subject: [PATCH 1/3] Added comments open in new tab functionality, testing needed --- .../APIView/APIViewWeb/CommentMarkdownExtensions.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs b/src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs index 004c98b3251..a37143ea605 100644 --- a/src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs +++ b/src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs @@ -18,7 +18,9 @@ public static IHtmlContent FormatAsMarkdown(this IHtmlHelper helper, string text { try { - return new HtmlString(MarkdownAsHtml(text)); + string htmlContent = MarkdownAsHtml(text); + htmlContent = AddTargetBlankToLinks(htmlContent); + return new HtmlString(htmlContent); } catch { @@ -31,5 +33,11 @@ public static string MarkdownAsHtml(string text) => public static string MarkdownAsPlainText(string text) => Markdown.ToPlainText(text ?? "", MarkdownPipeline); + + // Add target="_blank" to anchor tags + private static string AddTargetBlankToLinks(string htmlContent) + { + return System.Text.RegularExpressions.Regex.Replace(htmlContent, "", ""); + } } } From 5cbadc82aa271b72681e369d797c496e6940ee9c Mon Sep 17 00:00:00 2001 From: Whitney Shake Date: Wed, 3 Apr 2024 14:35:16 -0700 Subject: [PATCH 2/3] Open comment link in new tab complete --- src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs b/src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs index a37143ea605..9784b3257b6 100644 --- a/src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs +++ b/src/dotnet/APIView/APIViewWeb/CommentMarkdownExtensions.cs @@ -34,7 +34,6 @@ public static string MarkdownAsHtml(string text) => public static string MarkdownAsPlainText(string text) => Markdown.ToPlainText(text ?? "", MarkdownPipeline); - // Add target="_blank" to anchor tags private static string AddTargetBlankToLinks(string htmlContent) { return System.Text.RegularExpressions.Regex.Replace(htmlContent, "", ""); From b8daeee093f7cc1a2f4535ea1bbb11837d4fe2a8 Mon Sep 17 00:00:00 2001 From: Whitney Shake Date: Wed, 10 Apr 2024 10:19:33 -0400 Subject: [PATCH 3/3] Corrected program.cs --- src/dotnet/APIView/APIViewWeb/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dotnet/APIView/APIViewWeb/Program.cs b/src/dotnet/APIView/APIViewWeb/Program.cs index 1e1ea36dac0..fa97ce46bbb 100644 --- a/src/dotnet/APIView/APIViewWeb/Program.cs +++ b/src/dotnet/APIView/APIViewWeb/Program.cs @@ -16,8 +16,7 @@ public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .ConfigureAppConfiguration((hostingContext, config) => { - config.AddEnvironmentVariables(prefix: "APIVIEW_"); - config.AddUserSecrets(typeof(Program).Assembly); + config.AddEnvironmentVariables(prefix: "APIVIEW_"); IConfiguration settings = config.Build(); string connectionString = settings.GetValue("APPCONFIG"); // Load configuration from Azure App Configuration @@ -28,6 +27,7 @@ public static IWebHostBuilder CreateWebHostBuilder(string[] args) => kv.SetCredential(new DefaultAzureCredential()); }); }); + config.AddUserSecrets(typeof(Program).Assembly); }) .UseStartup(); }