From 9103fb4771e1af64fb9b66a14132f11ef102ff99 Mon Sep 17 00:00:00 2001 From: tkym <42635181+Htkym@users.noreply.github.com> Date: Wed, 9 Sep 2026 13:14:30 +0900 Subject: [PATCH] chore: upgrade LithoSharp to 0.3.1 --- tools/Plotree.Site/Plotree.Site.csproj | 2 +- tools/Plotree.Site/PlotreeDocsTemplate.cs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/Plotree.Site/Plotree.Site.csproj b/tools/Plotree.Site/Plotree.Site.csproj index b10626e..e3bb922 100644 --- a/tools/Plotree.Site/Plotree.Site.csproj +++ b/tools/Plotree.Site/Plotree.Site.csproj @@ -7,6 +7,6 @@ - + diff --git a/tools/Plotree.Site/PlotreeDocsTemplate.cs b/tools/Plotree.Site/PlotreeDocsTemplate.cs index 9498848..6faca96 100644 --- a/tools/Plotree.Site/PlotreeDocsTemplate.cs +++ b/tools/Plotree.Site/PlotreeDocsTemplate.cs @@ -41,12 +41,25 @@ private static string Customize(string relativePath, string html, SiteTemplateCo var languageSwitch = BuildLanguageSwitch(relativePath, context); if (languageSwitch.Length > 0) { - html = html.Replace("", $"{languageSwitch}", StringComparison.Ordinal); + html = InsertLanguageSwitch(html, languageSwitch); } return ReplacePagination(relativePath, html, language, context); } + private static string InsertLanguageSwitch(string html, string languageSwitch) + { + const string headerActions = "
"; + var actionsStart = html.IndexOf(headerActions, StringComparison.Ordinal); + var actionsEnd = actionsStart < 0 + ? -1 + : html.IndexOf("
", actionsStart, StringComparison.Ordinal); + + return actionsEnd >= 0 + ? html.Insert(actionsEnd, languageSwitch) + : html.Replace("", $"{languageSwitch}", StringComparison.Ordinal); + } + private static string BuildNavigation( string relativePath, string language, @@ -115,6 +128,7 @@ private static string LocalizeChrome(string html, string language) .Replace("aria-label=\"Documentation navigation\"", "aria-label=\"ドキュメントナビゲーション\"", StringComparison.Ordinal) .Replace(">On this page<", ">この記事の内容<", StringComparison.Ordinal) .Replace("aria-label=\"On this page\"", "aria-label=\"この記事の内容\"", StringComparison.Ordinal) + .Replace("aria-label=\"Dark mode\"", "aria-label=\"ダークモード\"", StringComparison.Ordinal) .Replace("aria-label=\"Document navigation\"", "aria-label=\"文書ナビゲーション\"", StringComparison.Ordinal); }