From d6266139f8959ebe0e72dd0057b62154807289eb Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Wed, 19 Jul 2023 21:54:42 -0700 Subject: [PATCH] Hugo Titles --- Helpers/HelperMarkdown.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Helpers/HelperMarkdown.cs b/Helpers/HelperMarkdown.cs index d18a4b1..e61dc5e 100644 --- a/Helpers/HelperMarkdown.cs +++ b/Helpers/HelperMarkdown.cs @@ -815,7 +815,6 @@ internal static partial class HelperMarkdown string? directory; string[] segmentsA; string[] segmentsB; - string[] segmentsC; string relativeFile; string segmentsALast; string segmentsBFirst; @@ -845,10 +844,12 @@ internal static partial class HelperMarkdown if (segmentsB.Length != 2) continue; segmentsBFirst = segmentsB.First(); - segmentsC = segmentsA.First().Split('['); - file = Path.GetFullPath(Path.Combine(markdownFile.Directory, segmentsBFirst)); + if (!segmentsBFirst.EndsWith(".md")) + file = Path.GetFullPath(Path.Combine(markdownFile.Directory, segmentsBFirst)); + else + file = Path.GetFullPath(Path.Combine(markdownFile.Directory, segmentsBFirst[..^3])); relativeFile = Path.GetRelativePath(record.Source, file).Replace('\\', '/'); - line = $"{segmentsC.First()}[[{relativeFile}]]{segmentsB.Last()}"; + line = $"{segmentsA.First()}]({relativeFile}){segmentsB.Last()}"; if (lines[i] == line) throw new NotSupportedException($"Line {i} shouldn't match with {line}"); lines[i] = line;