Skip to content

Commit

Permalink
Fix a Renderer problem related to markdown table (#193)
Browse files Browse the repository at this point in the history
* Fix a Renderer problem related to markdown table

* Fix a Renderer problem related to markdown table and replace <br> with whitespace

---------

Co-authored-by: Arlo <[email protected]>
  • Loading branch information
LiAuTraver and Arlodotexe authored Jul 11, 2024
1 parent d9bfddf commit bc976cb
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private static async Task<string> GetDocumentationFileContents(ToolkitFrontMatte
// TODO: https://github.com/CommunityToolkit/Labs-Windows/issues/142
// MSBuild uses wildcard to find the files, and the wildcards decide where they end up
// Single experiments use relative paths, the allExperiment head uses absolute paths that grab from all experiments
// The wildcard captures decide the paths. This discrepency is accounted for manually.
// The wildcard captures decide the paths. This discrepancy is accounted for manually.
// Logic here is the exact same that MSBuild uses to find and include the files we need.
var assemblyName = typeof(ToolkitSampleRenderer).Assembly.GetName().Name;
if (string.IsNullOrWhiteSpace(assemblyName))
Expand All @@ -178,9 +178,9 @@ private static async Task<string> GetDocumentationFileContents(ToolkitFrontMatte
var textContents = await FileIO.ReadTextAsync(file);

// Remove YAML - need to use array overload as single string not supported on .NET Standard 2.0
var blocks = textContents.Split(new[] { "---" }, StringSplitOptions.RemoveEmptyEntries);
var blocks = textContents.Split(new[] { "---" }, 2, StringSplitOptions.RemoveEmptyEntries);

return blocks.LastOrDefault() ?? "Couldn't find content after YAML Front Matter removal.";
return blocks.LastOrDefault()?.Replace("<br>", " ") ?? "Couldn't find content after YAML Front Matter removal.";
}
catch (Exception e)
{
Expand Down

0 comments on commit bc976cb

Please sign in to comment.